[Haskell-cafe] Parsec question
C K Kashyap
ckkashyap at gmail.com
Wed Jul 24 16:26:29 CEST 2013
I am trying to implement parsec in go using the "Monadic Parser
Combinators" paper  . I've been able to implement "plus" "bind" and
While doing the implementation - I looked at bind closely
bind :: Parser a -> (a -> Parser b) -> Parser b
p `bind` f = \inp -> concat [f v inp' | (v,inp') <- p inp]
I wondered if the result needs the complete list - wouldn't just the first
successful value suffice?
p `bind` f = \inp -> take 1 $ concat [f v inp' | (v,inp') <- p inp]
Will this miss out matches?
 Monadic Parser Combinators: Graham Hutton, Erik Meijer
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe