Haskell Platform Proposal: add transformers and revise the mtl package to depend on it

Johan Tibell johan.tibell at gmail.com
Thu Sep 16 05:10:37 EDT 2010


Hi,

Thanks for creating this proposal and doing a thorough analysis of the
issues, including the package breakage analysis.

On Thu, Sep 16, 2010 at 10:23 AM, Ross Paterson <ross at soi.city.ac.uk> wrote:

>  * simple monads are now aliases for monad trasformers applied to Identity,
>   e.g.
>
>        newtype Reader r a = Reader { runReader :: r -> a }
>
>   is replaced by
>
>        type Reader r = ReaderT r Identity
>
>        reader :: (r -> a) -> Reader r a
>        reader f = ReaderT (Identity . f)
>
>        runReader :: Reader r a -> r -> a
>        runReader m = runIdentity . runReaderT m
>
>   Rationale: This avoids repetition in the interfaces of both
>   transformers and the proposed mtl-2.  It makes transformers more useful
>   on its own, and also saves clients of mtl from defining instances
>   for both Reader r and ReaderT r and ensuring that they are consistent.
>

I would like to know if this additional abstraction has a noticeable
performance cost. Does anyone know of a benchmark that could be used to test
this? Perhaps one involving State.

Paying careful attention to inlining should help remove any overhead.

== Transition issues ==
>
>  * 41 failed with the new mtl:
>    * 11 because they defined their own Applicative instances (which can
>      now be deleted)
>    * 11 because of the changed constraint on Functor instances
>    * 15 that used the constructors of base monads (which can be trivially
>      replaced)
>    * 3 that defined instances for base monads
>    * 1 that defined an overlapping Error instance
>

Should we try to get these 41 package to add an upper bound on their mtl
dependency before mtl-2 is released so they don't break? The authors could
then migrate their code over to mtl-2 as soon as it has been published.

If this proposal is approved, we should create a small wiki with migration
tips.

Cheers,
Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20100916/91c9a3c6/attachment-0001.html


More information about the Libraries mailing list