Re: [Haskell-cafe] Missing a Deriving?

2009-06-01 Thread michael rice
I went back and tried to convert the YAHT example to Monad, importing Monad, commenting out all but the data descriptions and the searchAll function, and finally replacing success, failure, augment, and combine in the searchAll function with return, fail, =, and mplus. *Main let g = Graph

Re: [Haskell-cafe] Missing a Deriving?

2009-06-01 Thread Daniel Fischer
Am Montag 01 Juni 2009 19:02:36 schrieb michael rice: All good so far, but then tried to convert Failable from Computation to Monad instance Monad Failable where     return = Success     fail = Fail     = (Success x) f = f x     = (Fail s) _ = Fail s     mplus (Fail _) y = y     mplus

Re: [Haskell-cafe] Missing a Deriving?

2009-06-01 Thread michael rice
Got it. Thanks! Michael --- On Mon, 6/1/09, Daniel Fischer daniel.is.fisc...@web.de wrote: From: Daniel Fischer daniel.is.fisc...@web.de Subject: Re: [Haskell-cafe] Missing a Deriving? To: haskell-cafe@haskell.org Date: Monday, June 1, 2009, 1:51 PM Am Montag 01 Juni 2009 19:02:36 schrieb

Re: [Haskell-cafe] Missing a Deriving?

2009-06-01 Thread michael rice
Still stumped. Maybe and [] are in the same MonadPlus monad, but how do I make monad Failable understand mplus? I'm now getting this error upon loading: Prelude :l graph5 [1 of 1] Compiling Main ( graph5.hs, interpreted ) graph5.hs:36:4: `mplus' is not a (visible) method of class

Re: [Haskell-cafe] Missing a Deriving?

2009-06-01 Thread Ross Mellgren
mplus is a method of class MonadPlus, so you need to write it in a separate instance from the one for Monad, e.g. instance MonadPlus Failable where mplus = ... -Ross On Jun 1, 2009, at 9:28 PM, michael rice wrote: Still stumped. Maybe and [] are in the same MonadPlus monad, but how do

Re: [Haskell-cafe] Missing a Deriving?

2009-06-01 Thread michael rice
/1/09, Ross Mellgren rmm-hask...@z.odi.ac wrote: From: Ross Mellgren rmm-hask...@z.odi.ac Subject: Re: [Haskell-cafe] Missing a Deriving? To: michael rice nowg...@yahoo.com Cc: haskell-cafe Cafe haskell-cafe@haskell.org Date: Monday, June 1, 2009, 9:33 PM mplus is a method of class MonadPlus, so

Re: [Haskell-cafe] Missing a Deriving?

2009-06-01 Thread Ross Mellgren
it mplus)? Michael --- On Mon, 6/1/09, Ross Mellgren rmm-hask...@z.odi.ac wrote: From: Ross Mellgren rmm-hask...@z.odi.ac Subject: Re: [Haskell-cafe] Missing a Deriving? To: michael rice nowg...@yahoo.com Cc: haskell-cafe Cafe haskell-cafe@haskell.org Date: Monday, June 1, 2009, 9:33 PM mplus

Re: [Haskell-cafe] Missing a Deriving?

2009-06-01 Thread michael rice
searchAll g 3 1 :: Maybe [Int] Nothing *Main searchAll g 1 3 :: [[Int]] [[1,2,3],[1,4,3]] *Main searchAll g 3 1 :: [[Int]] [] *Main --- On Mon, 6/1/09, Ross Mellgren rmm-hask...@z.odi.ac wrote: From: Ross Mellgren rmm-hask...@z.odi.ac Subject: Re: [Haskell-cafe] Missing a Deriving? To: michael

Re: [Haskell-cafe] Missing a Deriving?

2009-06-01 Thread Ryan Ingram
1 :: [[Int]] [] *Main --- On Mon, 6/1/09, Ross Mellgren rmm-hask...@z.odi.ac wrote: From: Ross Mellgren rmm-hask...@z.odi.ac Subject: Re: [Haskell-cafe] Missing a Deriving? To: michael rice nowg...@yahoo.com Cc: haskell-cafe Cafe haskell-cafe@haskell.org Date: Monday, June 1, 2009, 9:43

Re: [Haskell-cafe] Missing a Deriving?

2009-05-30 Thread Miguel Mitrofanov
It's trying to 'Show' the 'c [Int]' type, but doesn't know which 'c' to use; so it's trying to find a generic instance, which doesn't exist. You can't fix this with 'deriving' or anything like this; instead, provide the type annotation like this: *Main searchAll g 1 3 :: Maybe [Int] On 31

Re: [Haskell-cafe] Missing a Deriving?

2009-05-30 Thread Ketil Malde
michael rice nowg...@yahoo.com writes: The following code is from Section 8.4.2, pgs. 111-112 (PDF paging) of YAHT. It compiles fine, but upon trying it I get the following error message. It seems to be trying to 'Show' the Computation class but I'm not sure where to put the 'Deriving'. My

Re: [Haskell-cafe] Missing a Deriving?

2009-05-30 Thread michael rice
there are five possibilities. MIchael --- On Sat, 5/30/09, Miguel Mitrofanov miguelim...@yandex.ru wrote: From: Miguel Mitrofanov miguelim...@yandex.ru Subject: Re: [Haskell-cafe] Missing a Deriving? To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Saturday, May 30, 2009, 5:36 PM

Re: [Haskell-cafe] Missing a Deriving?

2009-05-30 Thread David Menendez
On Sat, May 30, 2009 at 9:00 PM, michael rice nowg...@yahoo.com wrote: That works. but it gives just a single solution [1,2,3] when there are supposed to be two [[1,2,3],[1,4,3]]. Of course the code in YAHT may be in error. Works for me. *Main searchAll g 1 3 :: [[Int]] [[1,2,3],[1,4,3]]

Re: [Haskell-cafe] Missing a Deriving?

2009-05-30 Thread Ryan Ingram
On Sat, May 30, 2009 at 6:33 PM, David Menendez d...@zednenem.com wrote: *Main :t searchAll searchAll :: (Computation c) = Graph t t1 - Int - Int - c [Int] The way searchAll is written, the choice of which functions to use depends on the type variable c. That's determined by the calling

Re: [Haskell-cafe] Missing a Deriving?

2009-05-30 Thread michael rice
Menendez d...@zednenem.com Subject: Re: [Haskell-cafe] Missing a Deriving? To: michael rice nowg...@yahoo.com Cc: Miguel Mitrofanov miguelim...@yandex.ru, haskell-cafe@haskell.org Date: Saturday, May 30, 2009, 9:33 PM On Sat, May 30, 2009 at 9:00 PM, michael rice nowg...@yahoo.com wrote

Re: [Haskell-cafe] Missing a Deriving?

2009-05-30 Thread michael rice
Belay that last question. I just realized that its the const function being used rather than a constant declaration in const Nothing and const []. MIchael --- On Sat, 5/30/09, David Menendez d...@zednenem.com wrote: From: David Menendez d...@zednenem.com Subject: Re: [Haskell-cafe] Missing

Re: [Haskell-cafe] Missing a Deriving?

2009-05-30 Thread nowgate
Hi Ryan, Is there something missing or mislabeled in your post, because I don't see any definition of toDynamic. Michael --- On Sun, 5/31/09, Ryan Ingram ryani.s...@gmail.com wrote: From: Ryan Ingram ryani.s...@gmail.com Subject: Re: [Haskell-cafe] Missing a Deriving? To: David Menendez d

Re: [Haskell-cafe] Missing a Deriving?

2009-05-30 Thread Ryan Ingram
, because I don't see any definition of toDynamic. Michael --- On Sun, 5/31/09, Ryan Ingram ryani.s...@gmail.com wrote: From: Ryan Ingram ryani.s...@gmail.com Subject: Re: [Haskell-cafe] Missing a Deriving? To: David Menendez d...@zednenem.com Cc: michael rice nowg...@yahoo.com, haskell