Sunday, February 4, 2007

Parsec - a combinator to drop 'water'

Poor man's island parsing with Parsec, water drops lines until the parser p succeeds.
(Somehow Blogger seems to drop the whitespace before where)

water :: Parser a -> Parser a
water p = p <|> do { line; water p }
where line = manyTill anyChar newline


Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.