Sun Jul 19 20:19:28 EDT 2015

Parameterized arrow

It is possible to "partially apply" type constructors to create
instances that require smaller kinds.  E.g. the Applicative class
requires kind * -> *, while function application is of kind * -> * ->
*.  To fix this, an arbitrary type a can be used to create:

   Applicative ((->) a)

The same can be done for building parameterized arrows.

Given a type

   Proc x i o

where x represents the semantics (eXplanation for lack of better
mnemonic. s is taken for state in SSM), create the arrow instance

   Arrow (Proc x)

What constraints are there on x?  What is Proc? Let's try.

   data Proc x i o = ... SSM ...

The question is how to shoe-horn SSM into Proc somehow..

   data Monad m => SSM m s i o = SSM ((s, i) -> m (s, o)) (m s)

Any concrete SSM has an associated state.  There will be many
instances of that type parameter.  It seems that the objective is to
find a way to somehow tuck s inside of x.

One way to do this as explained above is to think of (s,i) -> (s,o) as
the end result of a combination of a set of primitives.  This "type"
is then constant and is what x should be.

So what we do is to somehow "record" all the compositons into a value,
a program constructor, and then evaluate that to build

  - a model = a haskell function that can be 

  - code: a representation that can be compiled e.g. to C

  - others...

'x' is a program.  Let's call it p.

This is actually more general: an arrow constructor class, so let's
call it that.

It's getting circular in it's vagueness.  Time to disambiguate the
strange loop..

Let's try first to build this arrow constructor class.