Free (left) monoid actions

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.

1 Like

I’m not sure I understand how the question is well-posed. You’ve defined a two-parameter type class and then asked is there (one) two-parameter type constructor that is an instance of it.

1 Like

Yeah, that’s a good point actually. Going to revise my question.