git.iko.soy/typeable/attoparsec
on master help sign in
Drop optionMaybe, which duplicates Control.Applicative.optional
commit5026b25163ac409ffeb96d70f693b4170d791cb7 authorBryan O'Sullivan <bos@serpentine.com> dateThu 2 Jan 2014, 14:36 (13 years ago) parent144f0ae
1 file changed−13
Data/Attoparsec/Combinator.hs−13
Data/Attoparsec/Combinator.hs−13
@@ -14,7 +14,6 @@ module Data.Attoparsec.Combinator
1414 choice
1515 , count
1616 , option
17− , optionMaybe
1817 , many'
1918 , many1
2019 , many1'
@@ -67,18 +66,6 @@ option x p = p <|> pure x
6766{-# SPECIALIZE option :: a -> Z.Parser a -> Z.Parser a #-}
6867#endif
6968
70−-- | @option@ specialized to @Maybe@. @optionMaybe p@ tries to apply
71−-- action @p@. If @p@ fails without consuming input, it returns
72−-- @Nothing@, otherwise @Just@ the value returned by @p@.
73−--
74−-- > mDecimal :: Integral a => Parser (Maybe a)
75−-- > mDecimal = optionMaybe decimal
76−optionMaybe :: Alternative f => f a -> f (Maybe a)
77−optionMaybe = option Nothing . fmap Just
78−{-# SPECIALIZE optionMaybe :: Parser ByteString a -> Parser ByteString (Maybe a) #-}
79−{-# SPECIALIZE optionMaybe :: Parser Text a -> Parser Text (Maybe a) #-}
80−{-# SPECIALIZE optionMaybe :: Z.Parser a -> Z.Parser (Maybe a) #-}
81−
8269-- | A version of 'liftM2' that is strict in the result of its first
8370-- action.
8471liftM2' :: (Monad m) => (a -> b -> c) -> m a -> m b -> m c