Re: [Haskell-cafe] Sequencing Parsers: a Simple Example

2007-12-01 Thread PR Stanley
> PRS: (>>=) :: Parser a -> Parser b -> Parser b > p >>= f = \inp -> >case p inp of > [] -> [] > [(v, out)] -> parse (f v) out You probably want: (>>=) :: Parser a -> (a -> Parser b) -> Parser b p >>= f = \inp -> case parse p inp of [] -> []

Re: [Haskell-cafe] Sequencing Parsers: a Simple Example

2007-12-01 Thread Shachaf Ben-Kiki
> Hi > (>>=) :: Parser a -> Parser b -> Parser b > p >>= f = \inp -> >case p inp of > [] -> [] > [(v, out)] -> parse (f v) out > based on a lot of guesswork, after the mess created by the OCR, I > managed to get the above example to work syntactically but is it > semantically correct?

[Haskell-cafe] Sequencing Parsers: a Simple Example

2007-12-01 Thread PR Stanley
Hi (>>=) :: Parser a -> Parser b -> Parser b p >>= f = \inp -> case p inp of [] -> [] [(v, out)] -> parse (f v) out based on a lot of guesswork, after the mess created by the OCR, I managed to get the above example to work syntactically but is it semantically correct? Thanks, Paul __