Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Abstraction layer for network functionality.
The intention is to (i) separate the logic of the protocol from its binary encoding, and (ii) allow a simulated network in place of actual network IO.
Synopsis
- class Monad m => Networked m where
- sendPacket :: (Binary payload, Show payload) => NodeInfo -> Packet payload -> m ()
- type NetworkState = ()
- type NetworkEvent = String
- newtype NetworkLogged m a = NetworkLogged (WriterT [NetworkEvent] m a)
- runNetworkLogged :: Monad m => NetworkLogged m a -> m (a, [NetworkEvent])
- evalNetworkLogged :: (Monad m, Applicative m) => NetworkLogged m a -> m a
- execNetworkLogged :: Monad m => NetworkLogged m a -> m [NetworkEvent]
Documentation
class Monad m => Networked m where Source #
Instances
Monad m => Networked (NetworkLogged m) Source # | just log network events |
Defined in Network.Tox.Network.Networked sendPacket :: (Binary payload, Show payload) => NodeInfo -> Packet payload -> NetworkLogged m () Source # | |
Networked m => Networked (KeyedT m) Source # | |
Defined in Network.Tox.Crypto.KeyedT | |
Networked m => Networked (TimedT m) Source # | |
Defined in Network.Tox.TimedT | |
Networked m => Networked (RandT s m) Source # | |
Defined in Network.Tox.Network.Networked | |
Networked m => Networked (StateT s m) Source # | |
Defined in Network.Tox.Network.Networked | |
Networked (StateT NetworkState IO) Source # | actual network IO |
Defined in Network.Tox.Network.Networked sendPacket :: (Binary payload, Show payload) => NodeInfo -> Packet payload -> StateT NetworkState IO () Source # | |
Networked m => Networked (ReaderT r m) Source # | |
Defined in Network.Tox.Network.Networked | |
(Monoid w, Networked m) => Networked (WriterT w m) Source # | |
Defined in Network.Tox.Network.Networked |
type NetworkState = () Source #
TODO: sockets etc
type NetworkEvent = String Source #
newtype NetworkLogged m a Source #
NetworkLogged (WriterT [NetworkEvent] m a) |
Instances
runNetworkLogged :: Monad m => NetworkLogged m a -> m (a, [NetworkEvent]) Source #
evalNetworkLogged :: (Monad m, Applicative m) => NetworkLogged m a -> m a Source #
execNetworkLogged :: Monad m => NetworkLogged m a -> m [NetworkEvent] Source #