free-algebras-0.0.3.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.

Minimal complete definition

mact

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, FreeAlgebra m, AlgebraType m d) => MAction m (Const d :: * -> *) 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 #

(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 #

(Pointed r, Functor f) => MAction ((->) r :: * -> *) 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 f a Source #

Free algebra associated with the @MAction constraint.

Constructors

FreeMAction 

Fields

Instances
(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 => FreeAlgebra1 (FreeMAction m :: (Type -> *) -> Type -> *) Source # 
Instance details

Defined in Control.Monad.Action

(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 #

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 :: (k2 -> k1) -> k2 -> *) (f :: * -> *) Source # 
Instance details

Defined in Control.Monad.Action

type AlgebraType0 (FreeMAction m :: (k2 -> k1) -> k2 -> *) (f :: * -> *) = Functor f
type AlgebraType (FreeMAction m :: (k -> *) -> k -> *) (f :: * -> *) Source # 
Instance details

Defined in Control.Monad.Action

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