[Haskell-cafe] Re: An interesting monad: Prompt

2008-01-04 Thread apfelmus
Felipe Lessa wrote: Ryan Ingram wrote: [snip] data Prompt (p :: * - *) :: (* - *) where PromptDone :: result - Prompt p result -- a is the type needed to continue the computation Prompt :: p a - (a - Prompt p result) - Prompt p result [snip] runPromptM :: Monad m = (forall a. p a

Re: [Haskell-cafe] Re: An interesting monad: Prompt

2008-01-04 Thread Felipe Lessa
On Jan 4, 2008 9:59 AM, apfelmus [EMAIL PROTECTED] wrote: Felipe Lessa wrote: How can we prove that (runPromptM prompt === id)? I was trying to go with You probably mean runPromptM id = id Actually, I meant an specialization of 'runPromptM prompt': runPromptM id :: (Monad p) =

[Haskell-cafe] Re: An interesting monad: Prompt

2007-11-24 Thread apfelmus
Derek Elkins wrote: Ryan Ingram wrote: apfelmus wrote: A context passing implementation (yielding the ContT monad transformer) will remedy this. Wait, are you saying that if you apply ContT to any monad that has the left recursion on = takes quadratic time problem,

Re: [Haskell-cafe] Re: An interesting monad: Prompt

2007-11-24 Thread Derek Elkins
On Sat, 2007-11-24 at 11:10 +0100, apfelmus wrote: Derek Elkins wrote: Ryan Ingram wrote: apfelmus wrote: A context passing implementation (yielding the ContT monad transformer) will remedy this. Wait, are you saying that if you apply ContT to any monad

Re: [Haskell-cafe] Re: An interesting monad: Prompt

2007-11-23 Thread Ryan Ingram
On 11/22/07, apfelmus [EMAIL PROTECTED] wrote: A context passing implementation (yielding the ContT monad transformer) will remedy this. Wait, are you saying that if you apply ContT to any monad that has the left recursion on = takes quadratic time problem, and represent all primitive

Re: [Haskell-cafe] Re: An interesting monad: Prompt

2007-11-23 Thread Derek Elkins
On Fri, 2007-11-23 at 21:11 -0800, Ryan Ingram wrote: On 11/22/07, apfelmus [EMAIL PROTECTED] wrote: A context passing implementation (yielding the ContT monad transformer) will remedy this. Wait, are you saying that if you apply ContT to any monad that has the

[Haskell-cafe] Re: An interesting monad: Prompt

2007-11-21 Thread apfelmus
Ryan Ingram wrote: I've been trying to implement a few rules-driven board/card games in Haskell and I always run into the ugly problem of how do I get user input? The usual technique is to embed the game in the IO Monad: The problem with this approach is that now arbitrary IO computations are

Re: [Haskell-cafe] Re: An interesting monad: Prompt

2007-11-21 Thread Ryan Ingram
On 11/21/07, apfelmus [EMAIL PROTECTED] wrote: A slightly different point of view is that you use a term implementation for your monad, at least for the interesting primitive effects That's a really interesting point of view, which had struck me slightly, but putting it quite clearly like