Commits

Bryan O'Sullivan  committed b7c99b2

Mark a few more definitions as inlined.

The benefit here is a little dubious, since I see a tiny performance gain.

  • Participants
  • Parent commits c08ea04

Comments (0)

Files changed (2)

File Data/Attoparsec/Internal/Types.hs

 
 instance Functor Result where
     fmap = fmapR
+    {-# INLINE fmap #-}
 
 newtype Input = I {unI :: B.ByteString}
 newtype Added = A {unA :: B.ByteString}
 
 instance Functor Parser where
     fmap = fmapP
+    {-# INLINE fmap #-}
 
 apP :: Parser (a -> b) -> Parser a -> Parser b
 apP d e = do
 
 instance Applicative Parser where
     pure   = returnP
+    {-# INLINE pure #-}
     (<*>)  = apP
+    {-# INLINE (<*>) #-}
 
     -- These definitions are equal to the defaults, but this
     -- way the optimizer doesn't have to work so hard to figure
     -- that out.
     (*>)   = (>>)
+    {-# INLINE (*>) #-}
     x <* y = x >>= \a -> y >> return a
+    {-# INLINE (<*) #-}
 
 instance Monoid (Parser a) where
     mempty  = failDesc "mempty"
     {-# INLINE mempty #-}
     mappend = plus
+    {-# INLINE mappend #-}
 
 instance Alternative Parser where
     empty = failDesc "empty"
     {-# INLINE empty #-}
     (<|>) = plus
+    {-# INLINE (<|>) #-}
 
 failDesc :: String -> Parser a
 failDesc err = Parser (\i0 a0 m0 kf _ks -> kf i0 a0 m0 [] msg)

File Data/Attoparsec/Zepto.hs

 
 instance Applicative Parser where
     pure   = return
+    {-# INLINE pure #-}
     (<*>)  = ap
+    {-# INLINE (<*>) #-}
 
 gets :: (S -> a) -> Parser a
 gets f = Parser $ \s -> (# OK (f s), s #)
     mempty  = fail "mempty"
     {-# INLINE mempty #-}
     mappend = mplus
+    {-# INLINE mappend #-}
 
 instance Alternative Parser where
     empty = fail "empty"
     {-# INLINE empty #-}
     (<|>) = mplus
+    {-# INLINE (<|>) #-}
 
 -- | Consume input while the predicate returns 'True'.
 takeWhile :: (Word8 -> Bool) -> Parser ByteString