module Data.Monoid.Utils (
mintercalate
, mspace
, smappend
, smconcat
, (<+>)
) where
import Data.List
import Data.String
{-# INLINE mintercalate #-}
mintercalate :: Monoid m => m -> [m] -> m
mintercalate m = mconcat . intersperse m
{-# INLINE mspace #-}
mspace :: (IsString m, Monoid m) => m
mspace = fromString " "
{-# INLINE smappend #-}
smappend :: (IsString m, Monoid m) => m -> m -> m
smappend a b = mconcat [a, mspace, b]
{-# INLINE smconcat #-}
smconcat :: (IsString m, Monoid m) => [m] -> m
smconcat = mintercalate mspace
{-# INLINE (<+>) #-}
(<+>) :: (IsString m, Monoid m) => m -> m -> m
(<+>) = smappend
infixr 6 <+>