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

2008-01-03 Thread Felipe Lessa
On Nov 18, 2007 10:22 PM, Ryan Ingram [EMAIL PROTECTED] 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

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

2007-12-30 Thread Ryan Ingram
Currently, yes; I was experimenting with type families. But it's pretty simple to get it to compile on 6.6.1: - remove the {-# LANGUAGE #-} pragma and replace with {-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances #-} - change the class declaration for MonadPrompter from class Monad

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

2007-12-29 Thread Ryan Ingram
I posted the current version of this code at http://ryani.freeshell.org/haskell/ On 12/28/07, Thomas Hartman [EMAIL PROTECTED] wrote: Would you mind posting the code for Prompt used by import Prompt I tried using Prompt.lhs from your first post but it appears to be incompatible with the

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

2007-12-28 Thread Thomas Hartman
Would you mind posting the code for Prompt used by import Prompt I tried using Prompt.lhs from your first post but it appears to be incompatible with the guessing game program when I got tired of reading the code and actually tried running it. best, thomas. 2007/12/4, Ryan Ingram [EMAIL

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

2007-12-04 Thread Ryan Ingram
Ask and ye shall receive. A simple guess-a-number game in MonadPrompt follows. But before I get to that, I have some comments: Serializing the state at arbitrary places is hard; the Prompt contains a continuation function so unless you have a way to serialize closures it seems like you lose.

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

2007-12-04 Thread Thomas Hartman
Thank you! I really appreciate your explanation, and I hope this will enable me to do some interesting and usefull stuff, in addition to firming up my understanding of some of the more advanced haskell type system features. MACID is a sort of RDBMS replacement used as a backend by the HAppS web

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

2007-12-03 Thread Thomas Hartman
will be saved if I understand correctly. t. Ryan Ingram [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 11/18/2007 07:22 PM To haskell haskell-cafe@haskell.org cc Subject [Haskell-cafe] An interesting monad: Prompt (This message is a literate haskell file. Code for the Prompt monad is preceded

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

2007-11-25 Thread Ryan Ingram
Also, I didn't realize this at first, but in order to use any of the MonadTrans instances, like having StateT s (Prompt p) automatically be a MonadPrompt, you sadly also need -fallow-overlapping-instances. This is because MonadTrans monads looks a lot like Prompt. arbitrary MonadTrans monad: t

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

2007-11-24 Thread Thomas Hartman
Looks very cool. So I tried playing with this code, unfortunately couldn't get it to compile. Could you double check that what you posted compiles, and if it does, any idea what I'm doing wrong? This is with {-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-} thanks, t. Prelude :r

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

2007-11-24 Thread Thomas Hartman
fwiw, if I comment those two lines around 141 out, it compiles. t. 2007/11/24, Thomas Hartman [EMAIL PROTECTED]: Looks very cool. So I tried playing with this code, unfortunately couldn't get it to compile. Could you double check that what you posted compiles, and if it does, any idea what

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

2007-11-24 Thread Brent Yorgey
-- Just for fun, make it work with StateT as well -- (needs -fallow-undecidable-instances) instance (Monad (t m), MonadTrans t, MonadPrompt p m) = MonadPrompt p (tm) where prompt = lift . prompt Looks like that should be MonadPrompt p (t m) rather than (tm). Note the space. -Brent

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

2007-11-24 Thread Thomas Hartman
that did it, thanks. 2007/11/24, Brent Yorgey [EMAIL PROTECTED]: -- Just for fun, make it work with StateT as well -- (needs -fallow-undecidable-instances) instance (Monad (t m), MonadTrans t, MonadPrompt p m) = MonadPrompt p (tm) where prompt = lift . prompt Looks like

[Haskell-cafe] An interesting monad: Prompt

2007-11-18 Thread Ryan Ingram
(This message is a literate haskell file. Code for the Prompt monad is preceded by ; code for my examples is preceded by ] and isn't complete, but intended for illustration.) I've been trying to implement a few rules-driven board/card games in Haskell and I always run into the ugly problem of