free-agent-0.1.0: Multi agent systems based on free monads.

Portabilityghc
Stabilityexperimental
Maintainernickolay.kudasov@gmail.com
Safe HaskellNone

Control.Agent.Free

Description

Internals of the free agent.

Synopsis

Documentation

type Agent f t m = FT f (t m)

An Agent f t a is a program which uses functor f as a low-level API, monad transformer t — for high-level features and which returns a value of type a.

The important thing is that the environment may mess with t on initialization of the agent or on low-level API calls. This was designed for the possibility of behaviosites (see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.114.4071 for more details).

type Agent' f m = Agent f IdentityT m

An Agent without any exposed structure.

type FMT f m t = (Functor f, Monad m, MonadTrans t, Monad (t m))

A constraint synonym to make type signatures less scary.

transform :: FMT f m t => (f (t m a) -> t m a) -> FT f m a -> t m a

transform phi agent applies phi to each low-level API command in agent program. This is the basis for behaviosites.

execAgent :: FMT f m t => (forall b. f (m b) -> m b) -> Agent f t m a -> t m a

Execute an agent program with particular interpreter. execAgent int agent give an interpretation to the low-level API.

execAgent' :: (Functor f, Monad m) => (forall b. f (m b) -> m b) -> Agent' f m a -> m a

Like execAgent for agents with no exposed structure.

execAgent_ :: FMT f m t => (forall b. f (m b) -> m b) -> Agent f t m a -> t m ()

Like execAgent but discards the result.

execAgent'_ :: (Functor f, Monad m) => (forall b. f (m b) -> m b) -> Agent' f m a -> m ()

Like execAgent' but discards the result.