ekmett / transformers-compat

transformers compatibility shim
Other
10 stars 12 forks source link

Backport Eq1, Ord1, Show1, and Read1 instances for Const #9

Closed RyanGlScott closed 8 years ago

RyanGlScott commented 9 years ago

transformers-0.4.3.0 added Eq1, Ord1, Show1, and Read1 instances for Const from Control.Applicative. These instances would be useful for me in projects where I can't use the latest version of transformers, but the problem is I can't figure out what the best way of putting them into transformers-compat is. We could define the instances in transformers-compat's backported Data.Functor.Classes module, but then they wouldn't be visible when using transformers 0.4.0.0 through 0.4.2.0. Perhaps it would be best to create a Control.Monad.Trans.Instances module, define them there as orphan instances, and import that from the backported Data.Functor.Classes module? I'm not sure what the best approach would be.

RyanGlScott commented 9 years ago

There are also some other transformers-related orphan instances that could be addressed. For example, the Data.Traversable.Instances module from semigroupoids currently has orphan Foldable (IdentityT m) and Traversable (IdentityT m) instances, but there isn't currently a way to backport these instances via transformers-compat, since it's always had a Control.Monad.Trans.Identity module.

The cleanest approach I could think of is to migrate all orphan instances to a single module (similar to Data.Orphans from base-orphans) and reexport it from each module in transformers-compat that needs it.

ekmett commented 8 years ago

I have no objection to adding a .Instances module for those.

RyanGlScott commented 8 years ago

Pull request #13 fixes this (and more).