module Agda.Utils.Semigroup (
module Data.Semigroup)
where
import Data.Semigroup ( Semigroup, (<>) )
import Control.Applicative (liftA2)
import Control.Monad.Reader (ReaderT)
import Control.Monad.State (StateT)
instance (Applicative m, Semigroup doc) => Semigroup (ReaderT s m doc) where
{-# INLINE (<>) #-}
<> :: ReaderT s m doc -> ReaderT s m doc -> ReaderT s m doc
(<>) = (doc -> doc -> doc)
-> ReaderT s m doc -> ReaderT s m doc -> ReaderT s m doc
forall a b c.
(a -> b -> c) -> ReaderT s m a -> ReaderT s m b -> ReaderT s m c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 doc -> doc -> doc
forall a. Semigroup a => a -> a -> a
(<>)
instance (Monad m, Semigroup doc) => Semigroup (StateT s m doc) where
{-# INLINE (<>) #-}
<> :: StateT s m doc -> StateT s m doc -> StateT s m doc
(<>) = (doc -> doc -> doc)
-> StateT s m doc -> StateT s m doc -> StateT s m doc
forall a b c.
(a -> b -> c) -> StateT s m a -> StateT s m b -> StateT s m c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 doc -> doc -> doc
forall a. Semigroup a => a -> a -> a
(<>)