transformers-compat 0.3.3.4 → 0.4.0.2
raw patch · 3 files changed
+114/−10 lines, 3 filesdep +mtl
Dependencies added: mtl
Files
- 0.3/Control/Monad/Trans/Except.hs +63/−5
- CHANGELOG.markdown +34/−0
- transformers-compat.cabal +17/−5
0.3/Control/Monad/Trans/Except.hs view
@@ -1,7 +1,19 @@+{-# LANGUAGE CPP #-}++#ifndef MIN_VERSION_mtl+#define MIN_VERSION_mtl(x,y,z) 1+#endif++#ifndef HASKELL98+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE UndecidableInstances #-}+#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Except -- Copyright : (C) 2013 Ross Paterson+-- (C) 2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : ross@soi.city.ac.uk@@ -39,16 +51,25 @@ liftPass, ) where +import Control.Applicative+import Control.Monad+import Control.Monad.Fix import Control.Monad.IO.Class import Control.Monad.Signatures import Control.Monad.Trans.Class-import Data.Functor.Classes-import Data.Functor.Identity -import Control.Applicative-import Control.Monad-import Control.Monad.Fix+#ifndef HASKELL98+import Control.Monad.Writer.Class+import Control.Monad.State.Class+import Control.Monad.Reader.Class+import Control.Monad.Cont.Class+import Control.Monad.Error.Class+import Control.Monad.RWS.Class+#endif+ import Data.Foldable (Foldable(foldMap))+import Data.Functor.Classes+import Data.Functor.Identity import Data.Monoid import Data.Traversable (Traversable(traverse)) @@ -223,3 +244,40 @@ return $! case a of Left l -> (Left l, id) Right (r, f) -> (Right r, f)++-- incurring the mtl dependency for these avoids packages that need them introducing orphans.++#ifndef HASKELL98++instance Monad m => MonadError e (ExceptT e m) where+ throwError = throwE+ catchError = catchE++instance MonadWriter w m => MonadWriter w (ExceptT e m) where+ tell = lift . tell+ listen = liftListen listen+ pass = liftPass pass+#if MIN_VERSION_mtl(2,1,0)+ writer = lift . writer+#endif++instance MonadState s m => MonadState s (ExceptT e m) where+ get = lift get+ put = lift . put+#if MIN_VERSION_mtl(2,1,0)+ state = lift . state+#endif++instance MonadReader r m => MonadReader r (ExceptT e m) where+ ask = lift ask+ local = mapExceptT . local+#if MIN_VERSION_mtl(2,1,0)+ reader = lift . reader+#endif++instance MonadRWS r w s m => MonadRWS r w s (ExceptT e m)++instance MonadCont m => MonadCont (ExceptT e m) where+ callCC = liftCallCC callCC++#endif
CHANGELOG.markdown view
@@ -1,3 +1,37 @@+0.4.0.4+-------++0.4.0.3+-------++0.4.0.2+-------+* Each of these is a build with a different set of flags configured. Building this way allows us to work around bugs in `cabal`'s backtracker.++0.4+---+* Added support for the missing `ExceptT` instances from `mtl`.++ This was not done lightly. While this means that by default incurring a dependency on `transformers-compat` drags in `mtl` when you are+ using an old `transformers`, it means that users do not have to orphan these instances and permits wider adoption of `ExceptT`.++ If you absolutely can't stand `mtl` and really want this package to build as valid `Haskell98`, then you can use `cabal install transformers-compat -f-mtl` to avoid incurring the dependency to get these instances. However, that is effectively an unsupported configuration.++0.3.3.4+-------++0.3.3.3+-------++0.3.3.2+-------+* These releases were a successful attempt to fix build problems caused by the cabal backtracker.+* Each of these is a build with a different set of flags configured.++0.3.2+-----+* This release was a failed (or at least, only partially successful) attempt to fix build problems caused by the cabal backtracker.+ 0.3.1 ----- * `transformers 0.4.1` compatibility
transformers-compat.cabal view
@@ -1,6 +1,6 @@ name: transformers-compat category: Compatibility-version: 0.3.3.4+version: 0.4.0.2 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -13,7 +13,7 @@ synopsis: A small compatibility shim exposing the new types from transformers 0.3 and 0.4 to older Haskell platforms. description: This package includes backported versions of types that were added- to transformers in transformers 0.3 an 0.4 for users who need strict+ to transformers in transformers 0.3 and 0.4 for users who need strict transformers 0.2 or 0.3 compatibility to run on old versions of the platform, but also need those types. .@@ -39,7 +39,7 @@ location: git://github.com/ekmett/transformers-compat.git flag two- default: False+ default: True description: Use transformers 0.2. This must be selected manually and should probably only be used on older GHCs around 7.0.x. manual: True@@ -49,6 +49,11 @@ manual: True description: Use transformers 0.3. This should toggle on/off automatically. +flag mtl+ default: True+ manual: True+ description: -f-mtl Disables support for mtl for transformers 0.2 and 0.3. That is an unsupported configuration, and results in missing instances for `ExceptT`, but keeps the package Haskell 98.+ library build-depends: base >= 4.3 && < 5@@ -58,13 +63,20 @@ if flag(three) hs-source-dirs: 0.3- build-depends: transformers >= 0.3 && < 0.4+ build-depends:+ transformers >= 0.3 && < 0.4,+ mtl >= 2.1 && < 2.2 else if flag(two) hs-source-dirs: 0.2 0.3- build-depends: transformers >= 0.2 && < 0.3+ build-depends:+ transformers >= 0.2 && < 0.3,+ mtl >= 2.0 && < 2.1 else build-depends: transformers >= 0.4.1 && < 0.5++ if !flag(mtl)+ cpp-options: -DHASKELL98 if flag(two) exposed-modules: