summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregoryCrosswhite <>2013-02-12 10:08:26 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2013-02-12 10:08:26 (GMT)
commit6f0834bbb989b8b73d62f7a27350781256cd122a (patch)
tree6aed069063ad799fc174b13596bb70408388920a
version 1.01.0
-rw-r--r--AbortT-mtl.cabal28
-rw-r--r--Control/Monad/Trans/Abort/Instances/MTL.hs36
-rw-r--r--LICENSE22
-rw-r--r--Setup.hs2
4 files changed, 88 insertions, 0 deletions
diff --git a/AbortT-mtl.cabal b/AbortT-mtl.cabal
new file mode 100644
index 0000000..5391fdb
--- /dev/null
+++ b/AbortT-mtl.cabal
@@ -0,0 +1,28 @@
+Name: AbortT-mtl
+Version: 1.0
+License: BSD3
+License-file: LICENSE
+Author: Gregory Crosswhite
+Maintainer: Gregory Crosswhite <gcrosswhite@gmail.com>
+Stability: Provisional
+Homepage: http://github.com/gcross/AbortT-mtl
+Synopsis: mtl instances for the AbortT monad transformer
+Description: This module provides instances for the mtl classes for AbortT.
+Cabal-version: >=1.6
+Build-type: Simple
+Category: Control
+
+Library
+ Build-depends: base >= 3 && < 5,
+ AbortT-transformers >= 1.0.1 && < 1.1,
+ mtl == 2.1.*
+ Exposed-modules: Control.Monad.Trans.Abort.Instances.MTL
+
+source-repository head
+ type: git
+ location: git://github.com/gcross/AbortT-mtl.git
+
+source-repository this
+ type: git
+ location: git://github.com/gcross/AbortT-mtl.git
+ tag: 1.0
diff --git a/Control/Monad/Trans/Abort/Instances/MTL.hs b/Control/Monad/Trans/Abort/Instances/MTL.hs
new file mode 100644
index 0000000..8bc2f40
--- /dev/null
+++ b/Control/Monad/Trans/Abort/Instances/MTL.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE FunctionalDependencies #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Control.Monad.Trans.Abort.Instances.MTL where
+
+import Control.Monad.Cont.Class (MonadCont(..))
+import Control.Monad.Error.Class (MonadError(..))
+import Control.Monad.RWS.Class (MonadRWS(..))
+import Control.Monad.Reader.Class (MonadReader(..))
+import Control.Monad.Trans (lift)
+import Control.Monad.Trans.Abort
+import Control.Monad.State.Class (MonadState(..))
+import Control.Monad.Writer.Class (MonadWriter(..))
+
+instance MonadCont m => MonadCont (AbortT a m) where
+ callCC = liftCallCC callCC
+
+instance MonadError e m => MonadError e (AbortT a m) where
+ throwError = lift . throwError
+ catchError = liftCatch catchError
+
+instance MonadReader r m => MonadReader r (AbortT a m) where
+ ask = lift ask
+ local f = AbortT . local f . unwrapAbortT
+
+instance MonadWriter w m => MonadWriter w (AbortT a m) where
+ tell = lift . tell
+ listen = liftListen listen
+ pass = liftPass pass
+
+instance MonadState s m => MonadState s (AbortT a m) where
+ get = lift get
+ put = lift . put
+
+instance MonadRWS r w s m => MonadRWS r w s (AbortT a m)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..bc2802a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2012, Gregory Crosswhite
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
index 0000000..9a994af
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain