free-alacarte-1.0.0.6: Free monads based on intuitions from the Data types à la Carte.
Safe HaskellSafe-Inferred
LanguageGHC2021

Free.AlaCarte

Documentation

data (f :+: g) e infixr 8 Source #

Constructors

Left' (f e) 
Right' (g e) 

Instances

Instances details
(Functor f, Functor g) => f :<: (f :+: g) Source # 
Instance details

Defined in Free.AlaCarte

Methods

inj :: f a -> (f :+: g) a Source #

prj :: (f :+: g) a -> Maybe (f a) Source #

(Functor f, Functor g, f :<: g, Functor h) => f :<: (h :+: g) Source # 
Instance details

Defined in Free.AlaCarte

Methods

inj :: f a -> (h :+: g) a Source #

prj :: (h :+: g) a -> Maybe (f a) Source #

(Functor f, Functor g) => Functor (f :+: g) Source # 
Instance details

Defined in Free.AlaCarte

Methods

fmap :: (a -> b) -> (f :+: g) a -> (f :+: g) b #

(<$) :: a -> (f :+: g) b -> (f :+: g) a #

(Exec f, Exec g) => Exec (f :+: g) Source # 
Instance details

Defined in Free.AlaCarte

Methods

execAlgebra :: (f :+: g) (IO a) -> IO a Source #

class (Functor sub, Functor sup) => sub :<: sup where Source #

Methods

inj :: sub a -> sup a Source #

prj :: sup a -> Maybe (sub a) Source #

Instances

Instances details
Functor f => f :<: f Source # 
Instance details

Defined in Free.AlaCarte

Methods

inj :: f a -> f a Source #

prj :: f a -> Maybe (f a) Source #

(Functor f, Functor g) => f :<: (f :+: g) Source # 
Instance details

Defined in Free.AlaCarte

Methods

inj :: f a -> (f :+: g) a Source #

prj :: (f :+: g) a -> Maybe (f a) Source #

(Functor f, Functor g, f :<: g, Functor h) => f :<: (h :+: g) Source # 
Instance details

Defined in Free.AlaCarte

Methods

inj :: f a -> (h :+: g) a Source #

prj :: (h :+: g) a -> Maybe (f a) Source #

data Free f a Source #

Constructors

Pure a 
Impure (f (Free f a)) 

Instances

Instances details
Functor f => Applicative (Free f) Source # 
Instance details

Defined in Free.AlaCarte

Methods

pure :: a -> Free f a #

(<*>) :: Free f (a -> b) -> Free f a -> Free f b #

liftA2 :: (a -> b -> c) -> Free f a -> Free f b -> Free f c #

(*>) :: Free f a -> Free f b -> Free f b #

(<*) :: Free f a -> Free f b -> Free f a #

Functor f => Functor (Free f) Source # 
Instance details

Defined in Free.AlaCarte

Methods

fmap :: (a -> b) -> Free f a -> Free f b #

(<$) :: a -> Free f b -> Free f a #

Functor f => Monad (Free f) Source # 
Instance details

Defined in Free.AlaCarte

Methods

(>>=) :: Free f a -> (a -> Free f b) -> Free f b #

(>>) :: Free f a -> Free f b -> Free f b #

return :: a -> Free f a #

foldFree :: forall f a b. Functor f => (a -> b) -> (f b -> b) -> Free f a -> b Source #

exec :: Exec f => Free f a -> IO a Source #

class Functor f => Exec f where Source #

Methods

execAlgebra :: f (IO a) -> IO a Source #

Instances

Instances details
(Exec f, Exec g) => Exec (f :+: g) Source # 
Instance details

Defined in Free.AlaCarte

Methods

execAlgebra :: (f :+: g) (IO a) -> IO a Source #

injectFree :: g :<: f => g (Free f a) -> Free f a Source #