A parser is a function that accepts an input String
and either fails or produces a value and the
remaining input String
.
data Parser a = P {
parse :: String -> Maybe (String, a)
}
Examine the type of parse
*MyParser> :type parse parse :: Parser a -> String -> Maybe (String, a)
parse
accepts a parser and input and either fails or produces a value and the remaining input.