glazier-1.0.0.0: Extensible effects using ContT, State and variants.

Safe HaskellNone
LanguageHaskell2010

Glazier.Command.Exec

Synopsis

Documentation

type family CmdTypes c cmd :: [Type] Source #

type function to get the list of effects in a c, parameterized over cmd

Instances
type CmdTypes (NoIOCmd c) cmd Source # 
Instance details

Defined in Glazier.Command.Exec

type CmdTypes (NoIOCmd c) cmd = Remove (IO cmd) (CmdTypes c cmd)

newtype NoIOCmd cmd Source #

A command type that removes the IO cmd from the CmdTypes of the input cmd

Constructors

NoIOCmd 

Fields

Instances
AsFacet a (Which (CmdTypes (NoIOCmd cmd) (NoIOCmd cmd))) => AsFacet a (NoIOCmd cmd) Source # 
Instance details

Defined in Glazier.Command.Exec

Methods

facet :: Prism' (NoIOCmd cmd) a #

type CmdTypes (NoIOCmd c) cmd Source # 
Instance details

Defined in Glazier.Command.Exec

type CmdTypes (NoIOCmd c) cmd = Remove (IO cmd) (CmdTypes c cmd)

maybeExec :: (Applicative m, AsFacet a c) => (a -> m b) -> c -> MaybeT m (Proxy '[a], b) Source #

Create an executor for a variant in the command type. returns a Proxy to keep track of the the types handled by the executor.

fixExec :: Functor m => ((cmd -> m ()) -> cmd -> MaybeT m (Proxy cmds, ())) -> cmd -> m (Proxy cmds, ()) Source #

Tie an executor with itself to get the final interpreter

verifyExec :: (AppendUnique '[] ys ~ ys, AppendUnique xs ys ~ xs, AppendUnique ys xs ~ ys, Functor m) => (cmd -> Which xs) -> (cmd -> m (Proxy ys, b)) -> cmd -> m b Source #

Use this function to verify at compile time that the given executor will fullfill all the variant types in a command type. redundant-constraints: used to constrain xs and ys

verifyFixExec :: (AppendUnique '[] ys ~ ys, AppendUnique xs ys ~ xs, AppendUnique ys xs ~ ys, Functor m, Functor m) => (cmd -> Which xs) -> ((cmd -> m ()) -> cmd -> MaybeT m (Proxy ys, ())) -> cmd -> m () Source #

orMaybeExec :: (Monad m, a'' ~ Append a a') => MaybeT m (Proxy a, b) -> MaybeT m (Proxy a', b) -> MaybeT m (Proxy a'', b) infixl 3 Source #

Combines executors, keeping track of the combined list of types handled. redundant-constraints: used to constrain a''

execConcur :: MonadUnliftIO m => (cmd -> m ()) -> Concur cmd a -> m a Source #