Changes between Version 16 and Version 17 of Proposals/transformers

11/04/10 18:19:21 (7 years ago)
ross (IP:

suggestions for upgrading


  • Proposals/transformers

    v16 v17  
    100100The attached test report lists the packages involved. 
     102=== Transition to mtl-2 === 
     103Most packages build unchanged with mtl-2.  Most of the remainder require only small changes to upgrade to it, though that will usually render them incompatible with mtl-1 without some CPP directives.  Here are the fixes for common messages: 
     105''Illegal instance declaration for Applicative (State a)'' 
     106 This usually means that the instance you're defining is now defined in the {{{transformers}}} package.  You may wish to check it's the same, so you can just delete it. 
     108''Could not deduce (Functor m) from the context (Monad m)'' 
     109 This will be in a situation where you're using a monad constructed with a transformer as a Functor.  You can replace the {{{Monad m}} with {{{Functor m}}}.  Alternatively, if you add a {{{Functor m}}} constraint it will work with old and new versions of mtl. 
     111''Not in scope: data constructor State'' 
     112 The {{{State}}} type is now a type synonym.  You could replace the {{State}} data constructor with the {{state}} function from {{{Control.Monad.Trans.State}}} in the {{{transformers}}} package. 
     114''Not in scope: runState'' 
     115 You probably imported {{{State(..)}}}, which won't work now that {{{State}}} is a type synonym.  You need to import {{{State}}} and {{{runState}}}.  (That will work with old versions on mtl too.) 
     117''Illegal instance declaration for MyClass (State Foo)'' 
     118 If you have a matching instance for {{StateT}}, you can delete this one.  Otherwise you need to generalize your instance to {{StateT}}.  If that's not possible, you may need to introduce a newtype. 
    102121== Issues raised in the discussion == 
    106125 The two should generate the same code ([ example]). 
     127 * The {{{transformers}}} package provides a function {{{state}}} as a replacement for the removed data constructors {{{State}}} when used as a function (and similarly for the others).  Should mtl re-export those? 
    108129== Other issues ==