gore-and-ash-network-1.4.0.0: Core module for Gore&Ash engine with low level network API

Copyright(c) Anton Gushcha, 2015-2016
LicenseBSD3
Maintainerncrashed@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Game.GoreAndAsh.Network.Module

Contents

Description

The module contains declaration of module monad transformer and instance of GameModule.

Synopsis

Documentation

newtype NetworkT s m a Source #

Monad transformer of network core module.

s
- State of next core module in modules chain;
m
- Next monad in modules monad stack;
a
- Type of result value;

How to embed module:

type AppStack = ModuleStack [LoggingT, NetworkT, ... other modules ... ] IO

newtype AppMonad a = AppMonad (AppStack a)
  deriving (Functor, Applicative, Monad, MonadFix, MonadIO, LoggingMonad, NetworkMonad)

The module is NOT pure within first phase (see ModuleStack docs), therefore currently only IO end monad can handler the module.

Constructors

NetworkT 

Fields

Instances

MonadBase IO m => MonadBase IO (NetworkT s m) Source # 

Methods

liftBase :: IO α -> NetworkT s m α

MonadError e m => MonadError e (NetworkT s m) Source # 

Methods

throwError :: e -> NetworkT s m a

catchError :: NetworkT s m a -> (e -> NetworkT s m a) -> NetworkT s m a

MonadTrans (NetworkT s) Source # 

Methods

lift :: Monad m => m a -> NetworkT s m a #

Monad m => MonadState (NetworkState s) (NetworkT s m) Source # 

Methods

get :: NetworkT s m (NetworkState s)

put :: NetworkState s -> NetworkT s m ()

state :: (NetworkState s -> (a, NetworkState s)) -> NetworkT s m a

Monad m => Monad (NetworkT s m) Source # 

Methods

(>>=) :: NetworkT s m a -> (a -> NetworkT s m b) -> NetworkT s m b #

(>>) :: NetworkT s m a -> NetworkT s m b -> NetworkT s m b #

return :: a -> NetworkT s m a #

fail :: String -> NetworkT s m a #

Functor m => Functor (NetworkT s m) Source # 

Methods

fmap :: (a -> b) -> NetworkT s m a -> NetworkT s m b #

(<$) :: a -> NetworkT s m b -> NetworkT s m a #

MonadFix m => MonadFix (NetworkT s m) Source # 

Methods

mfix :: (a -> NetworkT s m a) -> NetworkT s m a #

Monad m => Applicative (NetworkT s m) Source # 

Methods

pure :: a -> NetworkT s m a #

(<*>) :: NetworkT s m (a -> b) -> NetworkT s m a -> NetworkT s m b #

(*>) :: NetworkT s m a -> NetworkT s m b -> NetworkT s m b #

(<*) :: NetworkT s m a -> NetworkT s m b -> NetworkT s m a #

MonadIO m => MonadIO (NetworkT s m) Source # 

Methods

liftIO :: IO a -> NetworkT s m a #

MonadThrow m => MonadThrow (NetworkT s m) Source # 

Methods

throwM :: Exception e => e -> NetworkT s m a

MonadMask m => MonadMask (NetworkT s m) Source # 

Methods

mask :: ((forall a. NetworkT s m a -> NetworkT s m a) -> NetworkT s m b) -> NetworkT s m b

uninterruptibleMask :: ((forall a. NetworkT s m a -> NetworkT s m a) -> NetworkT s m b) -> NetworkT s m b

MonadCatch m => MonadCatch (NetworkT s m) Source # 

Methods

catch :: Exception e => NetworkT s m a -> (e -> NetworkT s m a) -> NetworkT s m a

MonadResource m => MonadResource (NetworkT s m) Source # 

Methods

liftResourceT :: ResourceT IO a -> NetworkT s m a

(MonadIO m, MonadCatch m) => NetworkMonad (NetworkT s m) Source # 
type ModuleState (NetworkT s m) Source # 
type ModuleState (NetworkT s m) = NetworkState s

Orphan instances

GameModule m s => GameModule (NetworkT s m) (NetworkState s) Source # 

Associated Types

type ModuleState (NetworkT s m :: * -> *) :: *

Methods

runModule :: MonadIO m' => NetworkT s m a -> NetworkState s -> m' (a, NetworkState s)

newModuleState :: MonadIO m' => m' (NetworkState s)

withModule :: Proxy (* -> *) (NetworkT s m) -> IO a -> IO a

cleanupModule :: NetworkState s -> IO ()