[Haskell-cafe] stuck with a sample of "programming in haskell"
Stephen Tetley
stephen.tetley at gmail.com
Fri Mar 19 04:23:23 EDT 2010
On 19 March 2010 04:35, 国平张 <zhangguoping at gmail.com> wrote:
> Sorry to bother again. I just cannot figure out how it could compile.
> I got compile errors.
> Can someone point out what is right code to use a do notion to make a
> Parser works.
It looks like the p parser may have the wrong indentation - although
this might be due to either your mail client or my client formatting
wrongly:
p :: Parser (Char,Char)
p = do x <- item
item
y <- item
return (x,y)
Try - with white space all aligned to the start character /x/ of the
first statement in the do:
p :: Parser (Char,Char)
p = do x <- item
item
y <- item
return (x,y)
Or with braces and semis:
p :: Parser (Char,Char)
p = do { x <- item
; item
; y <- item
; return (x,y) }
Best wishes
Stephen
More information about the Haskell-Cafe
mailing list