At 09:31 +0200 98/07/06, Francois-Nicola Demers wrote:
>> 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.
>
>If it is possible, who could find a counter example?  What about
>Extended Continuation Passing Style (used to express Danvy's
>composable continuation or operators reset/shift) ?

  I was not able to write the exception monad on this form.

  Note however that I am working with the concept that the monads should be
exactly the same, not "simulating" each other. From the algebraic point of
view, this makes sense: The monad expresses a class of algebras with the
same algebraic property and their algebra homomorphisms, for example,
monoids or groups, and not groups "simulated" by monoids or something. One
uses the monad to exactly pinpoint that algebraic structure one wants to
describe.

  Hans Aberg
                  * Email: Hans Aberg <mailto:[EMAIL PROTECTED]>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>



Reply via email to