hans-2.4.0.0: IPv4 Network Stack

Safe HaskellSafe-Inferred
LanguageHaskell98

Hans.Layer

Synopsis

Documentation

data LayerState i Source

Constructors

LayerState 

Fields

lsNow :: POSIXTime
 
lsState :: i
 

data Action Source

Constructors

Nop 
Action (IO ()) 

Instances

type Exit i r = LayerState i -> Action -> Result i r Source

Early exit continuation

type Failure i r = Action -> Result i r Source

Failure continuation

type Success a i r = a -> LayerState i -> Action -> Result i r Source

Success continuation

newtype Layer i a Source

Constructors

Layer 

Fields

getLayer :: forall r. LayerState i -> Action -> Exit i r -> Failure i r -> Success a i r -> Result i r
 

Instances

loopLayer :: String -> i -> IO msg -> (msg -> Layer i ()) -> IO () Source

finish :: Layer i a Source

Finish early, successfully, with no further processing.

output :: IO () -> Layer i () Source

type Handlers k a = Map k a Source

class ProvidesHandlers i k a | i -> k a where Source

Methods

getHandlers :: i -> Handlers k a Source

setHandlers :: Handlers k a -> i -> i Source

getHandler :: (Ord k, ProvidesHandlers i k a) => k -> Layer i a Source

addHandler :: (Ord k, ProvidesHandlers i k a) => k -> a -> Layer i () Source

removeHandler :: (Ord k, ProvidesHandlers i k a) => k -> Layer i () Source