| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Tox.Network.Core.Networked
Description
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 = ()
- data NetworkAction = SendPacket NodeInfo (Packet ByteString)
- newtype NetworkLogged m a = NetworkLogged (WriterT [NetworkAction] m a)
- runNetworkLogged :: Monad m => NetworkLogged m a -> m (a, [NetworkAction])
- evalNetworkLogged :: (Monad m, Applicative m) => NetworkLogged m a -> m a
- execNetworkLogged :: Monad m => NetworkLogged m a -> m [NetworkAction]
Documentation
class Monad m => Networked m where Source #
Instances
type NetworkState = () Source #
TODO: sockets etc
data NetworkAction Source #
Constructors
| SendPacket NodeInfo (Packet ByteString) |
Instances
| Eq NetworkAction Source # | |
Defined in Tox.Network.Core.Networked Methods (==) :: NetworkAction -> NetworkAction -> Bool # (/=) :: NetworkAction -> NetworkAction -> Bool # | |
| Show NetworkAction Source # | |
Defined in Tox.Network.Core.Networked Methods showsPrec :: Int -> NetworkAction -> ShowS # show :: NetworkAction -> String # showList :: [NetworkAction] -> ShowS # | |
newtype NetworkLogged m a Source #
Constructors
| NetworkLogged (WriterT [NetworkAction] m a) |
Instances
runNetworkLogged :: Monad m => NetworkLogged m a -> m (a, [NetworkAction]) Source #
evalNetworkLogged :: (Monad m, Applicative m) => NetworkLogged m a -> m a Source #
execNetworkLogged :: Monad m => NetworkLogged m a -> m [NetworkAction] Source #