module Data.Monoid.Action where

{- | * @mact mempty = id@
   * @mact (f <> g) = mact f . mact g@
-}
class (Monoid f) => MonoidAction f a where
  mact :: f -> a -> a

instance MonoidAction () m where
  mact :: () -> m -> m
mact = (m -> m) -> () -> m -> m
forall a b. a -> b -> a
const m -> m
forall a. a -> a
id
  {-# INLINE mact #-}

instance (Monoid m) => MonoidAction m m where
  mact :: m -> m -> m
mact = m -> m -> m
forall a. Semigroup a => a -> a -> a
(<>)
  {-# INLINE mact #-}