free-algebras-0.0.8.0: Free algebras in Haskell.

Safe HaskellNone
LanguageHaskell2010

Control.Monad.Action

Synopsis

Documentation

class (Monad m, Functor f) => MAction m f where Source #

A monad action is an m-algebra parametrized over a functor f. This is direct translation of a monoid action in the monoidal category of endofunctors with monoidal product: functor composition.

mact should be associative: prop> mact . mact = mact . join and unital: prop> mact . return = id

There are monads which do not have any (safe) instances, like IO.

Methods

mact :: m (f a) -> f a Source #

Instances
Monad m => MAction m m Source # 
Instance details

Defined in Control.Monad.Action

Methods

mact :: m (m a) -> m a Source #

(Monad m, Functor f) => MAction m (FreeMAction m f) Source # 
Instance details

Defined in Control.Monad.Action

Methods

mact :: m (FreeMAction m f a) -> FreeMAction m f a Source #

(Monad m, FreeAlgebra m, AlgebraType m d) => MAction m (Const d :: Type -> Type) Source #

Every algebra d which satisfies the constraint AlgebraType m d lifts to an action on the constant functor Const d. This is the same as to say that d is an m-algebra (as of f-algebras in category theory).

Instance details

Defined in Control.Monad.Action

Methods

mact :: m (Const d a) -> Const d a Source #

(Pointed r, Functor f) => MAction ((->) r :: Type -> Type) f Source #

You can use PointedMonoid newtype wrapper if you want to laverage Pointed instance for a Monoid.

Instance details

Defined in Control.Monad.Action

Methods

mact :: (r -> f a) -> f a Source #

newtype FreeMAction (m :: Type -> Type) (f :: Type -> Type) a Source #

Free algebra associated with the @MAction constraint.

Constructors

FreeMAction 

Fields

Instances
Monad m => FreeAlgebra1 (FreeMAction m :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Control.Monad.Action

(Monad m, Functor f) => MAction m (FreeMAction m f) Source # 
Instance details

Defined in Control.Monad.Action

Methods

mact :: m (FreeMAction m f a) -> FreeMAction m f a Source #

(Functor m, Functor f) => Functor (FreeMAction m f) Source # 
Instance details

Defined in Control.Monad.Action

Methods

fmap :: (a -> b) -> FreeMAction m f a -> FreeMAction m f b #

(<$) :: a -> FreeMAction m f b -> FreeMAction m f a #

(Applicative m, Applicative f) => Applicative (FreeMAction m f) Source # 
Instance details

Defined in Control.Monad.Action

Methods

pure :: a -> FreeMAction m f a #

(<*>) :: FreeMAction m f (a -> b) -> FreeMAction m f a -> FreeMAction m f b #

liftA2 :: (a -> b -> c) -> FreeMAction m f a -> FreeMAction m f b -> FreeMAction m f c #

(*>) :: FreeMAction m f a -> FreeMAction m f b -> FreeMAction m f b #

(<*) :: FreeMAction m f a -> FreeMAction m f b -> FreeMAction m f a #

Eq (m (f a)) => Eq (FreeMAction m f a) Source # 
Instance details

Defined in Control.Monad.Action

Methods

(==) :: FreeMAction m f a -> FreeMAction m f a -> Bool #

(/=) :: FreeMAction m f a -> FreeMAction m f a -> Bool #

Ord (m (f a)) => Ord (FreeMAction m f a) Source # 
Instance details

Defined in Control.Monad.Action

Methods

compare :: FreeMAction m f a -> FreeMAction m f a -> Ordering #

(<) :: FreeMAction m f a -> FreeMAction m f a -> Bool #

(<=) :: FreeMAction m f a -> FreeMAction m f a -> Bool #

(>) :: FreeMAction m f a -> FreeMAction m f a -> Bool #

(>=) :: FreeMAction m f a -> FreeMAction m f a -> Bool #

max :: FreeMAction m f a -> FreeMAction m f a -> FreeMAction m f a #

min :: FreeMAction m f a -> FreeMAction m f a -> FreeMAction m f a #

Show (m (f a)) => Show (FreeMAction m f a) Source # 
Instance details

Defined in Control.Monad.Action

Methods

showsPrec :: Int -> FreeMAction m f a -> ShowS #

show :: FreeMAction m f a -> String #

showList :: [FreeMAction m f a] -> ShowS #

type AlgebraType0 (FreeMAction m :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # 
Instance details

Defined in Control.Monad.Action

type AlgebraType0 (FreeMAction m :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) = Functor f
type AlgebraType (FreeMAction m :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # 
Instance details

Defined in Control.Monad.Action

type AlgebraType (FreeMAction m :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) = MAction m f