[<<][haskell][>>][..]
Sat Dec 2 20:00:18 EST 2017

parsec

<|> is not commutative

Below, in the definition of 'atom', the two combinators cannot be
swapped.

file   = endBy line (char '\n')
line   = sepBy atom (char ',')
atom   = quoted <|> plain
quoted = do char '"'; a <- many $ noneOf "\","; char '"'; return a
plain  = many $ noneOf ",\n\""
parseCSV :: String -> Either ParseError [[String]]
parseCSV input = parse file "(unknown)" input

This:
https://kunigami.blog/2014/01/21/an-introduction-to-the-parsec-library/

Says to use the 'try' combinator "which will make a parser to not
consume its input if it fails to match".


Wait... it might just be many1



[Reply][About]
[<<][haskell][>>][..]