Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: a problem with happy ABCParser example (Stephen Tetley)
2. Re: a problem with happy ABCParser example (kak dod)
3. functional parser type error (felipe zapata)
----------------------------------------------------------------------
Message: 1
Date: Mon, 2 Apr 2012 18:08:25 +0100
From: Stephen Tetley <[email protected]>
Subject: Re: [Haskell-beginners] a problem with happy ABCParser
example
To: kak dod <[email protected]>
Cc: [email protected]
Message-ID:
<CAB2TPRAsj9kssC05oce9TkmdmDfbx-0VsUzviqVG=4gpxbh...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Have you tried
> parse "abc\n"
The grammar looks as though it mandates a terminating newline.
------------------------------
Message: 2
Date: Mon, 2 Apr 2012 23:13:52 +0530
From: kak dod <[email protected]>
Subject: Re: [Haskell-beginners] a problem with happy ABCParser
example
To: Stephen Tetley <[email protected]>
Cc: [email protected]
Message-ID:
<CAJ4=wneu66v27odehsxpucfzh4sog7gb+ughure57153mgu...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
thanks a lot ... really overlooked it foolishly ...
On Mon, Apr 2, 2012 at 10:38 PM, Stephen Tetley <[email protected]>wrote:
> Have you tried
>
> > parse "abc\n"
>
> The grammar looks as though it mandates a terminating newline.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20120402/64a7c2f9/attachment-0001.htm>
------------------------------
Message: 3
Date: Mon, 2 Apr 2012 21:58:31 +0100
From: felipe zapata <[email protected]>
Subject: [Haskell-beginners] functional parser type error
To: [email protected]
Message-ID:
<CA+AeLgTUD=xzdvejr4h63isejx1g7sandchzvucqbb2c-vy...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi.
I'm Following the book of Programming in haskell written by Graham Hutton.
In Chapter number 8 there is a discussion about functional parsers and it
is defined a functional Parser item and some basic parsers as follow
*success :: a -> Parser a*
*success v = \ inp -> [(v,inp)]*
*failure :: Parser a*
*failure = \inp -> [ ]*
*item :: Parser Char*
*item = \inp -> case inp of*
*[ ] -> [ ]*
*(x:xs) -> [(x,xs)]*
Based on this parser it is defined a* *new parser called *sat p*
*sat :: (Char -> Bool ) -> Parser Char*
*sat p = do x <- item*
*if p x then success x else failure*
as result, this error appears
*Couldn't match expected type `Char'*
*with actual type `[(Char, String)]'*
*In the first argument of `p', namely `x'*
*In the expression: p x*
*In the expression: if p x then success x else failure*
Can you help me ?
Greets,
Felipe
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20120402/332803c2/attachment-0001.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 46, Issue 2
****************************************