fused-effects-readline-0.0.0.0: A readline-like effect and carrier for fused-effects
Safe HaskellNone
LanguageHaskell2010

Control.Effect.Readline

Synopsis

Readline effect

data Readline m k Source #

Constructors

Prompt String (Int -> Maybe String -> m k) 
Print (Doc AnsiStyle) (m k) 

Instances

Instances details
HFunctor Readline Source # 
Instance details

Defined in Control.Effect.Readline

Methods

hmap :: Functor m => (forall x. m x -> n x) -> Readline m a -> Readline n a #

Effect Readline Source # 
Instance details

Defined in Control.Effect.Readline

Methods

thread :: (Functor ctx, Monad m) => ctx () -> (forall x. ctx (m x) -> n (ctx x)) -> Readline m a -> Readline n (ctx a) #

MonadException m => Algebra Readline (ReadlineC m) Source # 
Instance details

Defined in Control.Carrier.Readline.Haskeline

Methods

alg :: Readline (ReadlineC m) a -> ReadlineC m a #

Functor m => Functor (Readline m) Source # 
Instance details

Defined in Control.Effect.Readline

Methods

fmap :: (a -> b) -> Readline m a -> Readline m b #

(<$) :: a -> Readline m b -> Readline m a #

Generic1 (Readline m :: Type -> Type) Source # 
Instance details

Defined in Control.Effect.Readline

Associated Types

type Rep1 (Readline m) :: k -> Type #

Methods

from1 :: forall (a :: k). Readline m a -> Rep1 (Readline m) a #

to1 :: forall (a :: k). Rep1 (Readline m) a -> Readline m a #

type Rep1 (Readline m :: Type -> Type) Source # 
Instance details

Defined in Control.Effect.Readline

print :: Has Readline sig m => Doc AnsiStyle -> m () Source #

Re-exports

class (HFunctor sig, Monad m) => Algebra (sig :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) | m -> sig #

The class of carriers (results) for algebras (effect handlers) over signatures (effects), whose actions are given by the alg method.

Since: fused-effects-1.0.0.0

Minimal complete definition

alg

Instances

Instances details
Algebra NonDet [] 
Instance details

Defined in Control.Algebra

Methods

alg :: NonDet [] a -> [a] #

Algebra Empty Maybe 
Instance details

Defined in Control.Algebra

Methods

alg :: Empty Maybe a -> Maybe a #

Algebra Choose NonEmpty 
Instance details

Defined in Control.Algebra

Methods

alg :: Choose NonEmpty a -> NonEmpty a #

MonadException m => Algebra Readline (ReadlineC m) Source # 
Instance details

Defined in Control.Carrier.Readline.Haskeline

Methods

alg :: Readline (ReadlineC m) a -> ReadlineC m a #

Algebra sig m => Algebra sig (IdentityT m) 
Instance details

Defined in Control.Algebra

Methods

alg :: sig (IdentityT m) a -> IdentityT m a #

Algebra sig m => Algebra sig (Ap m)

This instance permits effectful actions to be lifted into the Ap monad given a monoidal return type, which can provide clarity when chaining calls to mappend.

mappend <$> act1 <*> (mappend <$> act2 <*> act3)

is equivalent to

getAp (act1 <> act2 <> act3)

Since: fused-effects-1.0.1.0

Instance details

Defined in Control.Algebra

Methods

alg :: sig (Ap m) a -> Ap m a #

Algebra sig m => Algebra sig (Alt m)

This instance permits effectful actions to be lifted into the Alt monad, which eases the invocation of repeated alternation with <|>:

a <|> b <|> c <|> d

is equivalent to

getAlt (mconcat [a, b, c, d])

Since: fused-effects-1.0.1.0

Instance details

Defined in Control.Algebra

Methods

alg :: sig (Alt m) a -> Alt m a #

Algebra (Lift IO) IO 
Instance details

Defined in Control.Algebra

Methods

alg :: Lift IO IO a -> IO a #

Algebra (Lift Identity) Identity 
Instance details

Defined in Control.Algebra

Methods

alg :: Lift Identity Identity a -> Identity a #

Monoid w => Algebra (Writer w) ((,) w) 
Instance details

Defined in Control.Algebra

Methods

alg :: Writer w ((,) w) a -> (w, a) #

Algebra (Error e) (Either e) 
Instance details

Defined in Control.Algebra

Methods

alg :: Error e (Either e) a -> Either e a #

Monad m => Algebra (Lift m) (LiftC m) 
Instance details

Defined in Control.Carrier.Lift

Methods

alg :: Lift m (LiftC m) a -> LiftC m a #

Algebra (Reader r) ((->) r :: Type -> Type) 
Instance details

Defined in Control.Algebra

Methods

alg :: Reader r ((->) r) a -> r -> a #

(Algebra sig m, Effect sig, Monoid w) => Algebra (Writer w :+: sig) (WriterT w m) 
Instance details

Defined in Control.Algebra

Methods

alg :: (Writer w :+: sig) (WriterT w m) a -> WriterT w m a #

(Algebra sig m, Effect sig, Monoid w) => Algebra (Writer w :+: sig) (WriterT w m) 
Instance details

Defined in Control.Algebra

Methods

alg :: (Writer w :+: sig) (WriterT w m) a -> WriterT w m a #

(Algebra sig m, Effect sig) => Algebra (Error e :+: sig) (ExceptT e m) 
Instance details

Defined in Control.Algebra

Methods

alg :: (Error e :+: sig) (ExceptT e m) a -> ExceptT e m a #

(Algebra sig m, Effect sig) => Algebra (State s :+: sig) (StateT s m) 
Instance details

Defined in Control.Algebra

Methods

alg :: (State s :+: sig) (StateT s m) a -> StateT s m a #

(Algebra sig m, Effect sig) => Algebra (State s :+: sig) (StateT s m) 
Instance details

Defined in Control.Algebra

Methods

alg :: (State s :+: sig) (StateT s m) a -> StateT s m a #

Algebra sig m => Algebra (Reader r :+: sig) (ReaderT r m) 
Instance details

Defined in Control.Algebra

Methods

alg :: (Reader r :+: sig) (ReaderT r m) a -> ReaderT r m a #

Algebra sig m => Algebra (Reader r :+: sig) (ReaderC r m) 
Instance details

Defined in Control.Carrier.Reader

Methods

alg :: (Reader r :+: sig) (ReaderC r m) a -> ReaderC r m a #

(Algebra sig m, Effect sig, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) 
Instance details

Defined in Control.Algebra

Methods

alg :: (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) a -> RWST r w s m a #

(Algebra sig m, Effect sig, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) 
Instance details

Defined in Control.Algebra

Methods

alg :: (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) a -> RWST r w s m a #

type Has (eff :: (Type -> Type) -> Type -> Type) (sig :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = (Members eff sig, Algebra sig m) #

m is a carrier for sig containing eff.

Note that if eff is a sum, it will be decomposed into multiple Member constraints. While this technically allows one to combine multiple unrelated effects into a single Has constraint, doing so has two significant drawbacks:

  1. Due to a problem with recursive type families, this can lead to significantly slower compiles.
  2. It defeats ghc’s warnings for redundant constraints, and thus can lead to a proliferation of redundant constraints as code is changed.

run :: Identity a -> a #

Run an action exhausted of effects to produce its final result value.

Since: fused-effects-1.0.0.0