[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] tree with labeled edges as a monad
From:       Iavor Diatchki <iavor.diatchki () gmail ! com>
Date:       2005-01-19 18:25:43
Message-ID: 5ab17e7905011910253f6fba29 () mail ! gmail ! com
[Download RAW message or body]

Hi,
This is a "hey that's cool" post :-)
I have seen both of those separately --- the generalized resumptions monad,
and the IO (and others) monad written in continuation passing style,
but never realized that the one was an instance of the other.
It is neat how the basic operations are separated from the sequencing.
Does anyone know how related (it seems somewhat related) is all that to the
recent work by Plotkin and Power on deriving monad implementations
from their operations?
-Iavor


> More generally:
> 
>         data Resumptions f a = Val a | Resume (f (Resumptions f a))
> 
>         instance Functor f => Monad (Resumptions f) where
>                 return          = Val
>                 Leaf a >>= f    = f a
>                 Resume t >>= f  = Resume (fmap (>>= f) t)
> 
> An example is a model of the IO monad, with f instantiated to
> 
>         data SysCall a
>                 = GetChar (Char -> a)
>                 | PutChar Char a
>                 | ...
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic