Fail is an Attoparsec Result constructor for a parser that cannot complete successfully. It carries the remaining input together with error information, unlike Partial, which carries a continuation for more input. section 12.2.1
Read Attoparsec results by distinguishing their three outcomes:
- Done reports a successful parse and the unparsed remainder. section 12.2.1
- Fail reports the unparsed remainder and error details. section 12.2.1
- Partial requests more input through a continuation rather than declaring failure. section 12.2.1
A failed byte-string parse
Running AP.parse (AP.string "Hello") "hello" produces Fail "hello" [] "string". The parser has not consumed the input, and the result records the failure information. By contrast, parsing "He" produces Partial _, because more input may still complete the match. section 12.2.1
mhead :: (Monad m) => m [a] -> m a mhead m = do (x : _) <- m return x
Inspect the Attoparsec REPL examples to compare successful, failed, and incomplete parses. section 12.2.1

