Copyright | (c) Riley Evans 2020 |
---|---|
License | BSD 3-Clause |
Maintainer | haskell@rly.rocks |
Safe Haskell | None |
Language | Haskell2010 |
Contains the tools needed to create, interact with and stop a network.
Synopsis
- task :: (DataStore' fs as, DataStore g b, Eq (g b)) => (HList' fs as -> g b -> ExceptT SomeException IO ()) -> Circuit fs as '[g] '[b] (Length fs)
- multiInputTask :: (DataStore' fs as, DataStore g b, Eq (g b), NFData b) => (HList as -> b) -> Circuit fs as '[g] '[b] (Length fs)
- functionTask :: (DataStore f a, DataStore g b, Eq (g b), Eq a, Eq (f a), NFData b) => (a -> b) -> Circuit '[f] '[a] '[g] '[b] ('Succ 'Zero)
- data HList (xs :: [Type]) where
- data HList' (fs :: [Type -> Type]) (as :: [Type]) where
- data ExceptT e (m :: Type -> Type) a
Creating a Task
A Task
, is one of the key components of this system.
They will be converted into threads in the process network.
The function a Task
executes has a specific type and a task will need to do multiple things.
The first agument will be a HList'
containing all the DataStore
s, to be fetched from.
The second argument is the "empty" DataStore
s or "pointers" to a storage location, where the result should be saved.
A task should:
:: (DataStore' fs as, DataStore g b, Eq (g b)) | |
=> (HList' fs as -> g b -> ExceptT SomeException IO ()) | The function a Task will execute. |
-> Circuit fs as '[g] '[b] (Length fs) |
Constructor for a task
Smart Constructors
:: (DataStore' fs as, DataStore g b, Eq (g b), NFData b) | |
=> (HList as -> b) | The function to execute |
-> Circuit fs as '[g] '[b] (Length fs) |
This allows a function with multiple inputs to be converted into a Task
.
:: (DataStore f a, DataStore g b, Eq (g b), Eq a, Eq (f a), NFData b) | |
=> (a -> b) | The function to execute |
-> Circuit '[f] '[a] '[g] '[b] ('Succ 'Zero) |
This allows a single a -> b
to be converted into a Task
.
Misc
data HList (xs :: [Type]) where #
A heterogeneous list used as input/output to a task.
This is commonly used in the multiInputTask
function,
which automatically fetches the data from DataStore
.
data HList' (fs :: [Type -> Type]) (as :: [Type]) where #
A heterogeneous list used as input/output to a network or task.
data ExceptT e (m :: Type -> Type) a #
A monad transformer that adds exceptions to other monads.
ExceptT
constructs a monad parameterized over two things:
- e - The exception type.
- m - The inner monad.
The return
function yields a computation that produces the given
value, while >>=
sequences two subcomputations, exiting on the
first exception.
Instances
MonadBaseControl b m => MonadBaseControl b (ExceptT e m) | |
Defined in Control.Monad.Trans.Control type StM (ExceptT e m) a | |
MonadTrans (ExceptT e) | |
Defined in Control.Monad.Trans.Except | |
MonadTransControl (ExceptT e) | |
Monad m => Monad (ExceptT e m) | |
Functor m => Functor (ExceptT e m) | |
MonadFix m => MonadFix (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
MonadFail m => MonadFail (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
(Functor m, Monad m) => Applicative (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
Foldable f => Foldable (ExceptT e f) | |
Defined in Control.Monad.Trans.Except fold :: Monoid m => ExceptT e f m -> m # foldMap :: Monoid m => (a -> m) -> ExceptT e f a -> m # foldMap' :: Monoid m => (a -> m) -> ExceptT e f a -> m # foldr :: (a -> b -> b) -> b -> ExceptT e f a -> b # foldr' :: (a -> b -> b) -> b -> ExceptT e f a -> b # foldl :: (b -> a -> b) -> b -> ExceptT e f a -> b # foldl' :: (b -> a -> b) -> b -> ExceptT e f a -> b # foldr1 :: (a -> a -> a) -> ExceptT e f a -> a # foldl1 :: (a -> a -> a) -> ExceptT e f a -> a # toList :: ExceptT e f a -> [a] # null :: ExceptT e f a -> Bool # length :: ExceptT e f a -> Int # elem :: Eq a => a -> ExceptT e f a -> Bool # maximum :: Ord a => ExceptT e f a -> a # minimum :: Ord a => ExceptT e f a -> a # | |
Traversable f => Traversable (ExceptT e f) | |
Defined in Control.Monad.Trans.Except | |
Contravariant m => Contravariant (ExceptT e m) | |
(Eq e, Eq1 m) => Eq1 (ExceptT e m) | |
(Ord e, Ord1 m) => Ord1 (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
(Read e, Read1 m) => Read1 (ExceptT e m) | |
Defined in Control.Monad.Trans.Except liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ExceptT e m a) # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ExceptT e m a] # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ExceptT e m a) # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ExceptT e m a] # | |
(Show e, Show1 m) => Show1 (ExceptT e m) | |
MonadZip m => MonadZip (ExceptT e m) | |
MonadIO m => MonadIO (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
(Functor m, Monad m, Monoid e) => Alternative (ExceptT e m) | |
(Monad m, Monoid e) => MonadPlus (ExceptT e m) | |
PrimMonad m => PrimMonad (ExceptT e m) | |
(Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a) | |
(Ord e, Ord1 m, Ord a) => Ord (ExceptT e m a) | |
Defined in Control.Monad.Trans.Except compare :: ExceptT e m a -> ExceptT e m a -> Ordering # (<) :: ExceptT e m a -> ExceptT e m a -> Bool # (<=) :: ExceptT e m a -> ExceptT e m a -> Bool # (>) :: ExceptT e m a -> ExceptT e m a -> Bool # (>=) :: ExceptT e m a -> ExceptT e m a -> Bool # | |
(Read e, Read1 m, Read a) => Read (ExceptT e m a) | |
(Show e, Show1 m, Show a) => Show (ExceptT e m a) | |
type StT (ExceptT e) a | |
Defined in Control.Monad.Trans.Control | |
type PrimState (ExceptT e m) | |
Defined in Control.Monad.Primitive type PrimState (ExceptT e m) = PrimState m | |
type StM (ExceptT e m) a | |
Defined in Control.Monad.Trans.Control |