packages feed

mtl-compat 0.1.1 → 0.2.0.4

raw patch · 4 files changed

+39/−52 lines, 4 filesdep ~transformers-compat

Dependency ranges changed: transformers-compat

Files

CHANGELOG.md view
@@ -1,3 +1,17 @@+### 0.2.0.3+* A specific build with no flags explicitly enabled, intended for use with the latest version of `mtl`. This is a workaround for `cabal` backtracker bugs.++### 0.2.0.2+* A specific build with the `-ftwo-point-two` flag explicitly enabled. This is a workaround for `cabal` backtracker bugs.++### 0.2.0.1+* A specific build with the `-ftwo-point-one` flag explicitly enabled. This is a workaround for `cabal` backtracker bugs.++# 0.2+* Require use of `transformers-compat-0.4` or greater when building with `mtl-2.1.3.1` or earlier. `transformers-compat-0.4.0.*` adds the missing `ExceptT` instances, which means that `mtl-compat`'s only purpose is to backport the `Control.Monad.Except` module for those who want an `mtl`-style import for `ExceptT` and/or `MonadError`.+  +  I would recommend just using `Control.Monad.Trans.Except` from `transformers-compat-0.4.0.*` and `Control.Monad.Error.Class` instead, since they accomplish the same thing as `mtl-compat` without an extra dependency.+ ## 0.1.1 * Allowed the `two-point-one` flag to toggle on/off automatically 
README.md view
@@ -1,2 +1,7 @@-# `mtl-compat`-Orphan [`mtl`](http://hackage.haskell.org/package/mtl) instances for `ExceptT` from [`transformers-compat`](http://hackage.haskell.org/package/transformers-compat)+# `mtl-compat` [![Hackage version](https://img.shields.io/hackage/v/mtl-compat.svg?style=flat)](http://hackage.haskell.org/package/mtl-compat) [![Build Status](https://img.shields.io/travis/RyanGlScott/mtl-compat.svg?style=flat)](https://travis-ci.org/RyanGlScott/mtl-compat)++This package backports the `Control.Monad.Except` module from `mtl` (if using `mtl-2.2.0.1` or earlier), which reexports the `ExceptT` monad transformer and the `MonadError` class.++This package should only be used if there is a need to use the `Control.Monad.Except` module specifically. If you just want `mtl` class instances for `ExceptT`, use `transformers-compat` instead, since `mtl-compat` does nothing but reexport the instances from that package.++Note that unlike how `mtl-2.2` or later works, the `Control.Monad.Except` module defined in this package exports all of `ExceptT`'s monad class instances. Therefore, you may have to declare `import Control.Monad.Except ()` at the top of your file to get all of the `ExceptT` instances in scope.
mtl-compat.cabal view
@@ -1,11 +1,16 @@ name:                mtl-compat-version:             0.1.1-synopsis:            Orphan mtl instances for ExceptT from transformers-compat-description:         This package backports the "Control.Monad.Except" module (if-                     using @mtl-2.2.0.1@ or earlier) and monad class instances for-                     @ExceptT@ from @transformers-compat@ (if using @mtl-2.1.3.1@-                     or earlier).+version:             0.2.0.4+synopsis:            Backported Control.Monad.Except module from mtl+description:         This package backports the "Control.Monad.Except" module from+                     @mtl@ (if using @mtl-2.2.0.1@ or earlier), which reexports the+                     @ExceptT@ monad transformer and the @MonadError@ class.                      .+                     This package should only be used if there is a need to use the+                     @Control.Monad.Except@ module specifically. If you just want+                     the @mtl@ class instances for @ExceptT@, use+                     @transformers-compat@ instead, since @mtl-compat@ does nothing+                     but reexport the instances from that package.+                     .                      Note that unlike how @mtl-2.2@ or later works, the                      "Control.Monad.Except" module defined in this package exports                      all of @ExceptT@'s monad class instances. Therefore, you may @@ -30,15 +35,15 @@  flag two-point-one   default:             False-  manual:              False-  description:         Use mtl-2.1.3.1 or earlier with transformers-compat.-                       This should toggle on/off automatically.+  manual:              True+  description:         Use mtl-2.1.3.1 or earlier with transformers-compat. This+                       will cause this package to export the Control.Monad.Except module.  flag two-point-two   default:             False   manual:              True-  description:         Use mtl-2.2.0.1. This is probably not what you want, so-                       this must be selected manually.+  description:         Use mtl-2.2.0.1 with transformers. This will cause this+                       package to export the Control.Monad.Except module.  library   build-depends:       base                >= 4.3     && < 5@@ -49,7 +54,7 @@      if flag(two-point-one)     build-depends:     mtl                 >= 2.0.1   && < 2.2-                     , transformers-compat >= 0.3     && < 0.4+                     , transformers-compat >= 0.4     && < 0.5   else     if flag(two-point-two)       build-depends:   mtl                 >= 2.2.0.1 && < 2.2.1
src/Control/Monad/Except.hs view
@@ -1,8 +1,4 @@ {-# LANGUAGE CPP #-}-#if !(MIN_VERSION_mtl(2,2,0))-{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, UndecidableInstances #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-#endif {- | Module      :  Control.Monad.Error Copyright   :  (c) Michael Weber <michael.weber@post.rwth-aachen.de> 2001,@@ -74,45 +70,12 @@ import Control.Monad.Instances () #endif -#if MIN_VERSION_mtl(2,2,0)+#if MIN_VERSION_mtl(2,2,0) && !(MIN_VERSION_mtl(2,2,1)) import Control.Monad.Cont.Class   () import Control.Monad.RWS.Class    () import Control.Monad.Reader.Class () import Control.Monad.State.Class  () import Control.Monad.Writer.Class ()-#else-import Control.Monad.Cont.Class (MonadCont(..))-import Control.Monad.Reader.Class (MonadReader(..))-import Control.Monad.RWS.Class (MonadRWS)-import Control.Monad.State.Class (MonadState(..))-import Control.Monad.Writer.Class (MonadWriter(..))-import Control.Monad.Trans.Except-  ( liftCallCC, throwE, catchE, liftListen, liftPass )--instance MonadCont m => MonadCont (ExceptT e m) where-    callCC = liftCallCC callCC--instance Monad m => MonadError e (ExceptT e m) where-    throwError = throwE-    catchError = catchE--instance MonadRWS r w s m => MonadRWS r w s (ExceptT e m)--instance MonadReader r m => MonadReader r (ExceptT e m) where-    ask    = lift ask-    local  = mapExceptT . local-    reader = lift . reader--instance MonadState s m => MonadState s (ExceptT e m) where-    get   = lift get-    put   = lift . put-    state = lift . state--instance MonadWriter w m => MonadWriter w (ExceptT e m) where-    writer = lift . writer-    tell   = lift . tell-    listen = liftListen listen-    pass   = liftPass pass #endif  {- $customErrorExample