> 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.
Sure it is. See my paper, `The essence of functional programming'.
Also see Filinski's work. -- P
-----------------------------------------------------------------------
Philip Wadler [EMAIL PROTECTED]
Bell Labs, Lucent Technologies http://www.cs.bell-labs.com/~wadler
600 Mountain Ave, room 2T-402 office: +1 908 582 4004
Murray Hill, NJ 07974-0636 fax: +1 908 582 5857
USA home: +1 908 626 9252
-----------------------------------------------------------------------
``There may, indeed, be other applications of the system
than its use as a logic.'' -- A. Church, 1932
-----------------------------------------------------------------------