Bryan O'Sullivan avatar Bryan O'Sullivan committed ec23283

Use Monoid in a few more spots

Comments (0)

Files changed (3)

Data/Attoparsec/ByteString/Internal.hs

 import Data.Attoparsec.Combinator
 import Data.Attoparsec.Internal.Types
     hiding (Parser, Input, Added, Failure, Success)
+import Data.Monoid (Monoid(..))
 import Data.Word (Word8)
 import Foreign.ForeignPtr (withForeignPtr)
 import Foreign.Ptr (castPtr, minusPtr, plusPtr)
 
 -- | Run a parser.
 parse :: Parser a -> B.ByteString -> Result a
-parse m s = T.runParser m (I s) (A B.empty) Incomplete failK successK
+parse m s = T.runParser m (I s) mempty Incomplete failK successK
 {-# INLINE parse #-}
 
 -- | Run a parser that cannot be resupplied via a 'Partial' result.
 parseOnly :: Parser a -> B.ByteString -> Either String a
-parseOnly m s = case T.runParser m (I s) (A B.empty) Complete failK successK of
+parseOnly m s = case T.runParser m (I s) mempty Complete failK successK of
                   Fail _ _ err -> Left err
                   Done _ a     -> Right a
                   _            -> error "parseOnly: impossible error!"

Data/Attoparsec/Internal/Types.hs

 noAdds :: (Monoid t) =>
           Input t -> Added t -> More
        -> (Input t -> Added t -> More -> r) -> r
-noAdds i0 _a0 m0 f = f i0 (A mempty) m0
+noAdds i0 _a0 m0 f = f i0 mempty m0
 {-# INLINE noAdds #-}
 
 plus :: (Monoid t) => Parser t a -> Parser t a -> Parser t a

Data/Attoparsec/Text/Internal.hs

 import Control.Monad (when)
 import Data.Attoparsec.Combinator
 import Data.Attoparsec.Internal.Types hiding (Parser, Input, Added, Failure, Success)
+import Data.Monoid (Monoid(..))
 import Data.String (IsString(..))
 import Data.Text (Text)
 import Prelude hiding (getChar, take, takeWhile)
 
 -- | Run a parser.
 parse :: Parser a -> Text -> Result a
-parse m s = runParser m (I s) (A T.empty) Incomplete failK successK
+parse m s = runParser m (I s) mempty Incomplete failK successK
 {-# INLINE parse #-}
 
 -- | Run a parser that cannot be resupplied via a 'Partial' result.
 parseOnly :: Parser a -> Text -> Either String a
-parseOnly m s = case runParser m (I s) (A T.empty) Complete failK successK of
+parseOnly m s = case runParser m (I s) mempty Complete failK successK of
                   Fail _ _ err -> Left err
                   Done _ a     -> Right a
                   _            -> error "parseOnly: impossible error!"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.