Hi All,<br><br>I am a newbie to Haskell, and have been using Programming in Haskell along with Eric Meijer videos covering the book syllabus. I am currently on Chapter 8 Functional Parsers, and trying to implement few of the examples given in the book. <br>
<br>Following is the example :<br><br>item = \inp -> case inp of<br> [] -> []<br> (x:xs) -> [(x,xs)]<br><br>p = do x <- item<br> y <- item<br> z <- item<br> return (x,y,z)<br>
<br>=========<br><br>When I compile it using GHCI, I get the following error :<br><br>[1 of 1] Compiling Main ( parser.hs, interpreted )<br><br>parser.hs:5:8:<br> No instance for (Monad ((->) [t]))<br> arising from a do statement at parser.hs:5:8-16<br>
Possible fix: add an instance declaration for (Monad ((->) [t]))<br> In a stmt of a 'do' expression: x <- item<br> In the expression:<br> do x <- item<br> y <- item<br> z <- item<br>
return (x, y, z)<br> In the definition of `p':<br> p = do x <- item<br> y <- item<br> z <- item<br> ....<br>Failed, modules loaded: none.<br><br>
=========<br><br>I tried googling for samples, above error message etc. But not getting to solution. Can anyone guide me as to what am I doing wrong and how can I fix this.<br><br clear="all">Regards,<br>Amiruddin Nagri,<br>
India<br><br>GTalk : <a href="mailto:amir.nagri@gmail.com" target="_blank">amir.nagri@gmail.com</a><br>
<br>