Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- newtype Pid = Pid Int
- type Time = Word
- data Timestamp = Timestamp !Time !Pid
- class Applicative f => Clock f where
- type LamportClock = State LamportTime
- runLamportClock :: LamportClock a -> a
- type Process = ReaderT Pid LamportClock
- runProcess :: Pid -> Process a -> LamportClock a
- barrier :: [Pid] -> LamportClock ()
Documentation
Unique process identifier
Timestamps are assumed unique, totally ordered, and consistent with causal order; i.e., if assignment 1 happened-before assignment 2, the former’s timestamp is less than the latter’s.
class Applicative f => Clock f where Source #
newTimestamp :: f Timestamp Source #
Get another unique timestamp
type LamportClock = State LamportTime Source #
runLamportClock :: LamportClock a -> a Source #
runProcess :: Pid -> Process a -> LamportClock a Source #
barrier :: [Pid] -> LamportClock () Source #
XXX Make sure all subsequent calls to newTimestamp
return timestamps
greater than all prior calls.