module Prairie.Monoid where

import Prairie.Class

-- | Create a 'mempty' 'Record' assuming that all of the fields of the
-- record have a 'Monoid' instance.
--
-- @since 0.0.4.0
emptyRecord :: (Record rec, FieldDict Monoid rec) => rec
emptyRecord :: forall rec. (Record rec, FieldDict Monoid rec) => rec
emptyRecord = (forall ty. Field rec ty -> ty) -> rec
forall rec. Record rec => (forall ty. Field rec ty -> ty) -> rec
tabulateRecord (\Field rec ty
field -> forall (c :: Type -> Constraint) rec a r.
FieldDict c rec =>
Field rec a -> (c a => r) -> r
withFieldDict @Monoid Field rec ty
field ty
Monoid ty => ty
forall a. Monoid a => a
mempty)