Commit 38d09209 authored by Yiannis Tsiouris's avatar Yiannis Tsiouris

Minor refinements in case-of stmts

parent ba82c36d
...@@ -14,6 +14,7 @@ module Worker( --init ...@@ -14,6 +14,7 @@ module Worker( --init
) where ) where
import Control.Distributed.Process (NodeId) import Control.Distributed.Process (NodeId)
import Data.Maybe (fromJust)
import Table (Freq, freq_to_stat) import Table (Freq, freq_to_stat)
import Utils (now) import Utils (now)
...@@ -57,36 +58,24 @@ worker_stats node frequency statData = ...@@ -57,36 +58,24 @@ worker_stats node frequency statData =
verts_recvd_from_stat :: WorkerStats -> Int verts_recvd_from_stat :: WorkerStats -> Int
verts_recvd_from_stat stat = verts_recvd_from_stat stat =
case "vertices_recvd" `lookup` stat of read (fromJust ("vertices_recvd" `lookup` stat)) :: Int
Just val -> read val :: Int
Nothing -> 0 -- instead of false
credit_retd_from_stat :: WorkerStats -> Int credit_retd_from_stat :: WorkerStats -> Int
credit_retd_from_stat stat = credit_retd_from_stat stat =
case "credit_retd" `lookup` stat of read (fromJust ("credit_retd" `lookup` stat)) :: Int
Just val -> read val :: Int
Nothing -> 0 -- instead of false
min_atomic_credit_from_stat :: WorkerStats -> Int min_atomic_credit_from_stat :: WorkerStats -> Int
min_atomic_credit_from_stat stat = min_atomic_credit_from_stat stat =
case "min_atomic_credit" `lookup` stat of read (fromJust ("min_atomic_credit" `lookup` stat)) :: Int
Just val -> read val :: Int
Nothing -> 0 -- instead of false
init_idle_from_stat :: WorkerStats -> Int init_idle_from_stat :: WorkerStats -> Int
init_idle_from_stat stat = init_idle_from_stat stat =
case "init_idle_time" `lookup` stat of read (fromJust ("init_idle_time" `lookup` stat)) :: Int
Just val -> read val :: Int
Nothing -> 0 -- instead of false
tail_idle_from_stat :: WorkerStats -> Int tail_idle_from_stat :: WorkerStats -> Int
tail_idle_from_stat stat = tail_idle_from_stat stat =
case "tail_idle_time" `lookup` stat of read (fromJust ("tail_idle_time" `lookup` stat)) :: Int
Just val -> read val :: Int
Nothing -> 0 -- instead of false
max_idle_from_stat :: WorkerStats -> Int max_idle_from_stat :: WorkerStats -> Int
max_idle_from_stat stat = max_idle_from_stat stat =
case "max_idle_time" `lookup` stat of read (fromJust ("max_idle_time" `lookup` stat)) :: Int
Just val -> read val :: Int
Nothing -> 0 -- instead of false
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment