>>>>> "Hans" == Hans Aberg <[EMAIL PROTECTED]> writes:
Hans> 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.
Hans> I do not think it is possible to write every monad on this form.
In this case, you should probably check Andrzej Filinski's paper which
proves something closely related.
@INPROCEEDINGS{Filinski1994-popl,
CROSSREF = {POPL1994},
AUTHOR = {Andrzej Filinski},
TITLE = {Representing Monads},
YEAR = 1994,
PAGES = {446-457}
}
Cheers
Peter