hans-3.0.2: Network Stack

Safe HaskellNone
LanguageHaskell2010

Hans.Monad

Synopsis

Documentation

data Hans a Source #

Instances

Monad Hans Source # 

Methods

(>>=) :: Hans a -> (a -> Hans b) -> Hans b #

(>>) :: Hans a -> Hans b -> Hans b #

return :: a -> Hans a #

fail :: String -> Hans a #

Functor Hans Source # 

Methods

fmap :: (a -> b) -> Hans a -> Hans b #

(<$) :: a -> Hans b -> Hans a #

Applicative Hans Source # 

Methods

pure :: a -> Hans a #

(<*>) :: Hans (a -> b) -> Hans a -> Hans b #

(*>) :: Hans a -> Hans b -> Hans b #

(<*) :: Hans a -> Hans b -> Hans a #

BaseM Hans IO Source # 

Methods

inBase :: IO a -> Hans a #

runHans :: Hans () -> IO () Source #

Loop forever, running the underlying operation.

runHansOnce :: Hans a -> IO (Maybe a) Source #

Run only one iteration of the Hans monad.

setEscape :: Hans () -> Hans () Source #

Set the escape continuation to the current position, within the operation given, so that control flow always restores back through this point.

escape :: Hans a Source #

Invoke the escape continuation.

dropPacket :: DeviceStats -> Hans a Source #

Synonym for escape that also updates device statistics.

callCC :: ((b -> Hans a) -> Hans b) -> Hans b Source #

Call-cc. NOTE: the continuation will inherit the escape point of the calling context.

io :: IO a -> Hans a Source #

Lift an IO operation into Hans.

decode :: DeviceStats -> Get a -> ByteString -> Hans a Source #

Run a Get action in the context of the Hans monad,

decode' :: DeviceStats -> Get a -> ByteString -> Hans (a, ByteString) Source #

Run a Get action in the context of the Hans monad, returning any unconsumed input.