1. Bryan O'Sullivan
  2. attoparsec

Commits

Bryan O'Sullivan  committed 7b88337

Document parseOnly not forcing consumption of all input (gh-59)

  • Participants
  • Parent commits e1cf7c7
  • Branches default

Comments (0)

Files changed (2)

File Data/Attoparsec/ByteString/Internal.hs

View file
 {-# INLINE parse #-}
 
 -- | Run a parser that cannot be resupplied via a 'Partial' result.
+--
+-- This function does not force a parser to consume all of its input.
+-- Instead, any residual input will be discarded.  To force a parser
+-- to consume all of its input, use something like this:
+--
+-- @
+--'parseOnly' (myParser 'Control.Applicative.<*' 'endOfInput')
+-- @
 parseOnly :: Parser a -> ByteString -> Either String a
 parseOnly m s = case T.runParser m (buffer s) (Pos 0) Complete failK successK of
                   Fail _ _ err -> Left err

File Data/Attoparsec/Text/Internal.hs

View file
 {-# INLINE parse #-}
 
 -- | Run a parser that cannot be resupplied via a 'Partial' result.
+--
+-- This function does not force a parser to consume all of its input.
+-- Instead, any residual input will be discarded.  To force a parser
+-- to consume all of its input, use something like this:
+--
+-- @
+--'parseOnly' (myParser 'Control.Applicative.<*' 'endOfInput')
+-- @
 parseOnly :: Parser a -> Text -> Either String a
 parseOnly m s = case runParser m (buffer s) 0 Complete failK successK of
                   Fail _ _ err -> Left err