Sun Aug 14 15:53:24 CEST 2011

State machines and applicative.

Again, what's an applicative Functor?

A Functor is something that has

  fmap :: Functor f => (x -> y) -> f x -> f y

An Applicative functor is something that has <*>  (map-apply?)

  (<*>) :: Applicative a => a (x -> y) -> a x -> a y

So a functor is an abstraction that supports a lift from a function to
a function over abstractions.  An applicative functor is something
that has a lift from an abstraction of a function to a function over

A state machine can be represented by an applicative functor.  The
state threads behind the scenes, but the observable i/o behaviour is
what we can expose.

  Smach s t = Smach s -> (s, t)

A state machine is a function that produces a value of type t (which
can be a function) and a next state s.

The iteration of this is also Applicative.

( construct! )

Why is this trivial?  Because it is also a Monad (the state monad),
which is more specific than Applicative.

Is it really that simple?  Pd is a state monad.

Is there a useful modification that can be made to the state monad
that will no longer make it monadic?  Maybe causality?