[Haskell-cafe] Simple Parsec example, question
Peter Schmitz
ps.haskell at gmail.com
Wed Sep 15 20:00:21 EDT 2010
Daniel,
Thanks much; the more I learn Haskell and Parsec, the more I like them.
-- Peter
On Wed, Sep 15, 2010 at 4:02 PM, Daniel Fischer
<daniel.is.fischer at web.de> wrote:
> On Wednesday 15 September 2010 23:01:34, Peter Schmitz wrote:
>> > textLine :: Parser String
>> > textLine = do
>> > x <- many (noneOf "\n")
>> > char '\n'
>> > return x
>> >
>> > textLines :: Parser [String]
>> > textLines = many textLine
>>
>> And it can probably be coded more succinctly that that (suggestions
>> welcome).
>
> textLine = manyTill anyChar (char '\n')
>
More information about the Haskell-Cafe
mailing list