MonoFoldable in the mono-traversable package seems to be able to implement all of the usual Foldable containers and more, for example, things like Bytestring
and homogeneous tuples can be made MonoFoldable
but not Foldable
. My question is, do we lose anything from MonoFoldable
that we don't have in Foldable
, aside from requiring some advanced GHC features, making it slightly more tricky for instance writers and perhaps getting uglier error messages?
For example, is there some code which when using Foldable
compiles but with MonoFoldable
types are not inferred for example? Or anything else that makes client (not instance writer code) significantly simpler with Foldable
than MonoFoldable
?
TypeFamilies
whileFoldable
doesn't for one? – AstrologyMonoFoldable
's cousinMonoFunctor
is inferior toFunctor
in that you can't change the type of the things inside it. Same goes forMonoTraversable
– AciculaMonoFoldable
fully generalizesFoldable
, with the caveats around error messages and type extensions you mentioned. As @BenjaminHodgson mentions, the other classes in the hierarchy don't fulfill this. I'd be interested if someone has a counter-example to this, as I have no proof that this belief is correct. – Rauscher