Bryan O'Sullivan avatar 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.

Comments (0)

Files changed (2)

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)

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
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.