Koen Claessen wrote:
>I think you can "encode", or "mimick" every monad by the following type,
>which is the monad of continuations:
>
> type M a = (a -> Action) -> Action
>
> unit :: a -> M a
> unit a = \cont -> cont a
>
> bind :: M a -> (a -> M b) -> M b
> m `bind` k = \cont -> m (\a -> k a cont)
>
>As you see, the type Action is not mentioned in these definitions, so we
>can choose any structure on Action we want, to encode the "features" of
>the monad.
I do not think it is possible to write every monad on this form.
I can note though that the continuation monad contains an exception monad:
Let E be the constant functions of Action in M(A), identify A with its
image in M(A), and define E(A) = A | E, a subset of M(A). Then the
restrictions of the monad operations on M gives an exception monad E.
Hans Aberg
* Email: Hans Aberg <mailto:[EMAIL PROTECTED]>
* Home Page: <http://www.matematik.su.se/~haberg/>
* AMS member listing: <http://www.ams.org/cml/>