1{-# LANGUAGE NoImplicitPrelude #-} 2-- | More readable combinators for writing parsers. 3 4module Data.Attoparsec.Combinators where 5 6import Stack.Prelude 7 8-- | Concatenate two parsers. 9appending :: (Applicative f,Semigroup a) 10 => f a -> f a -> f a 11appending a b = (<>) <$> a <*> b 12 13-- | Alternative parsers. 14alternating :: Alternative f 15 => f a -> f a -> f a 16alternating a b = a <|> b 17 18-- | Pure something. 19pured :: (Applicative g,Applicative f) => g a -> g (f a) 20pured = fmap pure 21 22-- | Concatting the result of an action. 23concating :: (Monoid m,Applicative f) => f [m] -> f m 24concating = fmap mconcat 25