Should primMonad class live in base or mtl?

Andrew Martin andrew.thaddeus at
Mon Jun 8 13:27:20 UTC 2020

Relatedly, in an MR I started years ago but never finished, I did some work
on the event manager to cut out a bunch of unneeded allocations [1]. This
included replacing cons lists in several places with SmallArray. I had to
copy in a bunch of code from primitive to do this. The strongest argument I
see for moving some of primitive's machinery into base (and then
reexporting it in primitive) is that there might be other places in base
that could benefit from it. But I'm not certain of what those other places


On Mon, Jun 8, 2020 at 9:18 AM Carter Schonwald <carter.schonwald at>

> This is something I’ve pondered on and off, And the classes PrimMonad and
> PrimMonadBase are super stable
> Argument in favor of base :
> there’s absolutely code in base, and packages like array, which would
> benefit from PrimMonad.   Plus it might allow more reuse / encourage more
> ST monad code in the wild? (I always feel like ST monad is underused. )
> Argument against base:
> Then a lot of PrimMonad instances would need to live in transformers. And
> I’m not sure if maintainers over there would want that?
> Argument in favor of mtl: it’s where all the other transformer stack stuff
> gets defined. So all the upkeep for monad instances is already going on
> there regularly.
> Argument against mtl :  aside from concentrating the upkeep on transformer
> stack instances it seems like it wouldn’t enable new improvements to base.
> Another option is to have some sort of clone of the class in base , as
> long as it pays for itself in code reuse / simplification within base
> _______________________________________________
> Libraries mailing list
> Libraries at

-Andrew Thaddeus Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list