[Haskell-cafe] Yet another IO initializer: Effectful declarations and an ACIO monad

Ian.Stark at ed.ac.uk Ian.Stark at ed.ac.uk
Thu Nov 25 11:13:04 EST 2004

On Thu, 25 Nov 2004, Jules Bean wrote:
> On 25 Nov 2004, at 10:07, Ian.Stark at ed.ac.uk wrote:
> >
> > Thus an element u of (IO a) is affine central if for all v::IO b and
> > w::IO c,
> >
> >   do { x <- u; v } = v                                (affine)
> If x does not occur in v, I presume?

Yes, and similarly for centrality:

  do { x <- u; y <-v; w } = do { y <- v; x <- u; w }  (central)

applies only when x not free in v and y not free in u.

This means that ACIO computations can be rearranged and discarded, but
only within the limits of dataflow dependencies between the values.

Working out these dependencies are the job of a compiler, exactly as with
standard value declarations in Haskell.  I think it should even be
possible to have mutually recursive ACIO declarations, provided non-strict
constructors intervene.


More information about the Haskell-Cafe mailing list