[Haskell-cafe] state in the continuation monad...
Chung-chieh Shan
ccshan at post.harvard.edu
Fri Jul 9 03:28:15 EDT 2004
On 2004-07-02T16:15:15+0200, Ralf Laemmel wrote:
> I wonder whether perhaps a more basic step is to understand
> how type-changing monadic computations can be understood.
> By this I mean, that the effects model by the monad can change
> their type as part of the computation. Such a monad would be
> parameterised by effect types a b, where a is the type of the
> effect before computation and b is the type after computation.
A monad on a category C is a monoid in the category of endofunctors on
C. Dylan Thurston, who knows more category theory than I do, tells me
that a monoid in a category D is a D-enriched category with a single
object. Hence a monad on a category C is a single-object category
enriched by the category of endofunctors on C. If we remove the
single-object restriction, we arrive at a generalization of monads: a
category enriched by the category of endofunctors on C. I call this an
efect on C, where "efect" stands for "endofunctor-enriched category".
Intuitively, each object in an efect is a state, and each morphism a
transition, in a directed graph. For example, a file may be open or
closed, and can only be accessed while open. That'd be a two-state
efect.
John Power, who knows way more category theory than I do, tells me that
an enriched category is much nicer (i.e., it actually helps to be an
enriched category) when the enriching category is closed. I wonder how
this statement plays out in the case of efects.
The state monad is one example of a monad that can be generalized to
an efect. The continuation monad can also be generalized to an efect;
indeed, Danvy and Filinski did so in 1989 when they gave a type system
for the delimited control operators shift and reset that allows the
answer type to change during a computation (DIKU technical report 89/12;
http://www.daimi.au.dk/~danvy/Papers/fatc.ps.gz). Just as the state
monad can be implemented with the continuation monad, the state efect
can be implemented with the continuation efect.
I wonder whether Filinski's representation of monads in terms of shift
and reset (POPL 1994, 1999; CMU dissertation 1996) generalizes to
efects. That is, can any efect be implemented with the continuation
efect? More pragmatically important perhaps, how can we make efects at
least as easy to use and understand as monads by the practical
programmer?
--
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
It is dry and hot, but cloudy, in Phnom Penh, Cambodia
Do Ken. Ken Do Ken Do. Do Ken Do Ken Do Ken Do. Ken. Do. Ken.
"The following ballot is for voting on a General Resolution to address
the effect of the previous general resolution." - Debian Project Secretary
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20040709/d8a78749/attachment.bin
More information about the Haskell-Cafe
mailing list