commaSep p = p `sepBy` (symbol ",")
commaSep p = p `sepBy` (char ',')
commaSep p = p `sepBy` (symbol ",")
commaSep p = p `sepBy` comma
commaSep p = p `sepBy` comma
commaSep p = p `sepBy` (symbol ",")
>>> match (decimal `sepBy` char ',') "1,2,3" [[1,2,3]] >>> match (decimal `sepBy` char ',') "" [[]]
>>> sepBy p1 p2 f = Parser.deintercalate p1 p2 (Fold.catLefts f) >>> sepBy p1 p2 f = Parser.sepBy1 p1 p2 f <|> Parser.fromEffect (Fold.extractM f)Examples:
>>> p1 = Parser.takeWhile1 (not . (== '+')) Fold.toList >>> p2 = Parser.satisfy (== '+') >>> p = Parser.sepBy p1 p2 Fold.toList >>> Stream.parse p $ Stream.fromList "" Right [] >>> Stream.parse p $ Stream.fromList "1" Right ["1"] >>> Stream.parse p $ Stream.fromList "1+" Right ["1"] >>> Stream.parse p $ Stream.fromList "1+2+3" Right ["1","2","3"]
>>> testParse (takeCharsWhile isLetter `sepBy` literal ",") "foo,bar,baz" Right [([],"foo,bar,baz"),(["foo"],",bar,baz"),(["foo","bar"],",baz"),(["foo","bar","baz"],"")]