haskell / haskeline

A Haskell library for line input in command-line programs.
https://hackage.haskell.org/package/haskeline
BSD 3-Clause "New" or "Revised" License
221 stars 75 forks source link

MonadException instances for remaining data types in transformers #22

Closed RyanGlScott closed 8 years ago

RyanGlScott commented 9 years ago

Currently, there are no MonadException instances for ExceptT, strict WriterT, strict RWST, or lazy StateT from transformers, so this pull request adds them. Since ExceptT was only introduced in transformers-0.4, this uses transformers-compat to ensure that ExceptT is always defined so that users of transformers-0.3 and earlier can make use of the MonadException (ExceptT e m) instance.

This fixes issue #18.

hvr commented 9 years ago

There's just the issue that depending on transfomers-compat (which pulls in mtl) will have serious ramifications since GHC currently has to ship with haskeline in its global package db, and until Cabal is extended to make use of GHC 7.10's new multi-instance feature, it would be unfortunate to have haskeline start depending on additional dependencies.

RyanGlScott commented 9 years ago

Oh yeah, I forgot about that. In the meantime, I changed my pull request to use CPP pragmas so that haskeline only provides a MonadException instance for ExceptT on transformers-0.4+.

This has the disadvantage that those who still need to use transformers-0.3 (i.e., GHC 7.8 users) won't be able to take advantage of the new MonadException ExceptT instance, but I suppose someone can release a haskeline-compat package if they really want it :)

banacorn commented 5 years ago

Is it okay to create some package named haskeline-mtl and put my favorite instances of MonadException there?