Suppose we had a type class similar to this one:
class (Monoid a) => MonoidAction s a where
act :: a -> Endo s
such that the following laws held:
act mempty = mempty
act x <> act y = act (x <> y)
Suppose I wanted a free structure for this type class, similar to how []
is a free Monoid
for any choice of a
(if you squint a bit) and Free f
is a free Monad
for any f
(as long as it’s also a Functor
). I would assume that a free Monoid
for a
alone would not be sufficient, but I’m not sure what would be sufficient in this case.