{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}

#if __GLASGOW_HASKELL__ >= 704
{-# LANGUAGE Safe #-}
#elif __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif

module Generics.Deriving.Monoid (module Generics.Deriving.Monoid.Internal) where

import Generics.Deriving.Monoid.Internal
import Generics.Deriving.Semigroup (GSemigroup(..))

#if MIN_VERSION_base(4,9,0)
import Data.Semigroup (WrappedMonoid)
#endif

instance GSemigroup a => GMonoid (Maybe a) where
  gmempty :: Maybe a
gmempty = Maybe a
forall a. Maybe a
Nothing
  gmappend :: Maybe a -> Maybe a -> Maybe a
gmappend = Maybe a -> Maybe a -> Maybe a
forall a. GSemigroup a => a -> a -> a
gsappend

#if MIN_VERSION_base(4,9,0)
instance GMonoid m => GMonoid (WrappedMonoid m) where
  gmempty :: WrappedMonoid m
gmempty  = WrappedMonoid m
forall a. (Generic a, GMonoid' (Rep a)) => a
gmemptydefault
  gmappend :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m
gmappend = WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m
forall a. (Generic a, GMonoid' (Rep a)) => a -> a -> a
gmappenddefault
#endif