Hi,

Am Freitag, den 25.04.2008, 11:49 -0700 schrieb Dan Weston:
> I guess like minds think alike! See the very recent e-mail thread 
> started by Ryan Ingram:
> http://thread.gmane.org/gmane.comp.lang.haskell.cafe/39155/focus=39159
> 
> Take a look at the code referenced in Luke Palmer's reply:
> http://luqui.org/git/?p=luqui-misc.git;a=blob;f=work/code/haskell/frp/Fregl/Suspend.hs
> 
> A snippet follows:
> 
>  > class (Monad m) => MonadSuspend v m | m -> v where
>  >   attempt :: m a -> m (Either a (v -> m a))
>  >   suspend :: m v
>  >
>  > newtype SuspendT v m a
>  >   = SuspendT { runSuspendT :: m (Either a (v -> SuspendT v m a)) }
> 
> Your (Coroutine m a) appears to be isomorphic to (SuspendT () m a) [so 
> Coroutine m () = SuspendT () m ()]
> 
> Your runCoroutineT appears to be isomorphic to a specialization of 
> runSuspendT:
> 
> runSuspendT' :: SuspendT () m () -> m (Either () (() -> SuspendT () m ()))
> 
> Here the () -> a ~ a and Either () a ~ Maybe a

You are quite right, it really is the same thing. The implementation
behind runCoroutineT is not just a specialization, but the exact same
thing (with Left and Right switched). I just put the specialization
there because I had no need for a return value in my use case.

And interesting how Ryan and me had the same thoughts on the same day.
Maybe the April 24th should be considered Suspend You Monadic Action
Day.

Greetings,
Joachim

-- 
Joachim Breitner
  e-Mail: [EMAIL PROTECTED]
  Homepage: http://www.joachim-breitner.de
  ICQ#: 74513189
  Jabber-ID: [EMAIL PROTECTED]

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to