Commits

Mario Blažević  committed 4065854

Fixed the merge.

  • Participants
  • Parent commits de1b47a

Comments (0)

Files changed (4)

File Data/Attoparsec/Monoid.hs

     , eitherResult
 
     -- * Combinators
-    , (I.<?>)
-    , I.try
     , module Data.Attoparsec.Combinator
 
     -- * Parsing individual tokens
 
     -- * Text parsing
     , I.endOfLine
-
-    -- * State observation and manipulation functions
-    , I.endOfInput
-    , I.atEnd
     ) where
 
 import Data.Monoid (Monoid, (<>))

File Data/Attoparsec/Monoid/Internal.hs

     , parseOnly
 
     -- * Combinators
-    , (<?>)
-    , try
     , module Data.Attoparsec.Combinator
 
     -- * Parsing individual tokens
 
     -- ** Consume all remaining input
     , takeRest
-      
-    -- * State observation and manipulation functions
-    , endOfInput
-    , atEnd
 
     -- * Utilities
     , endOfLine
 put :: t -> Parser t ()
 put s = T.Parser $ \_i0 a0 m0 _kf ks -> ks (I s) a0 m0 ()
 
--- | Attempt a parse, and if it fails, rewind the input so that no
--- input appears to have been consumed.
---
--- This combinator is provided for compatibility with Parsec.
--- Attoparsec parsers always backtrack on failure.
-try :: Parser t a -> Parser t a
-try p = p
-{-# INLINE try #-}
-
 -- | The parser @satisfy p@ succeeds for any prime input token for
 -- which the predicate @p@ returns 'True'. Returns the token that is
 -- actually parsed.
 char c = satisfyChar (== c) <?> show c
 {-# INLINE char #-}
 
--- | Match only if all input has been consumed.
-endOfInput :: MonoidNull t => Parser t ()
-endOfInput = T.Parser $ \i0 a0 m0 kf ks ->
-             if null (unI i0)
-             then if m0 == Complete
-                  then ks i0 a0 m0 ()
-                  else let kf' i1 a1 m1 _ _ = addS i0 a0 m0 i1 a1 m1 $
-                                              \ i2 a2 m2 -> ks i2 a2 m2 ()
-                           ks' i1 a1 m1 _   = addS i0 a0 m0 i1 a1 m1 $
-                                              \ i2 a2 m2 -> kf i2 a2 m2 []
-                                                            "endOfInput"
-                       in  T.runParser demandInput i0 a0 m0 kf' ks'
-             else kf i0 a0 m0 [] "endOfInput"
-
--- | Return an indication of whether the end of input has been
--- reached.
-atEnd :: MonoidNull t => Parser t Bool
-atEnd = not <$> wantInput
-{-# INLINE atEnd #-}
-
 -- | Match either a single newline character @\'\\n\'@, or a carriage
 -- return followed by a newline character @\"\\r\\n\"@.
 endOfLine :: (Eq t, TextualMonoid t) => Parser t ()
 endOfLine = (char '\n' >> return ()) <|> (string "\r\n" >> return ())
 
--- | Name the parser, in case failure occurs.
-(<?>) :: Parser t a
-      -> String                 -- ^ the name to use if parsing fails
-      -> Parser t a
-p <?> msg0 = T.Parser $ \i0 a0 m0 kf ks ->
-             let kf' i a m strs msg = kf i a m (msg0:strs) msg
-             in T.runParser p i0 a0 m0 kf' ks
-{-# INLINE (<?>) #-}
-infix 0 <?>
-
 -- | Terminal failure continuation.
 failK :: Failure t a
 failK i0 _a0 _m0 stack msg = Fail (unI i0) stack msg

File attoparsec.cabal

                  monoid-subclasses < 0.4,
                  text >= 0.11.3.1,
                  scientific >= 0.2
-                 scientific >= 0.2
 
   exposed-modules: Data.Attoparsec
                    Data.Attoparsec.ByteString

File tests/QC/Monoid.hs

 
 takeWhile1_empty = maybeP (P.takeWhile1 undefined) L.empty == Nothing
 
-endOfInput s = maybeP P.endOfInput s == if L.null s
+endOfInput s = maybeP P.endOfInput s == if B.null s
                                         then Just ()
                                         else Nothing