quiver-instances 0.1.0.1 → 0.2.0.0
raw patch · 3 files changed
+26/−5 lines, 3 filesdep +resourcetdep +transformers-base
Dependencies added: resourcet, transformers-base
Files
- README.md +3/−1
- quiver-instances.cabal +3/−1
- src/Control/Quiver/Instances.hs +20/−3
README.md view
@@ -7,7 +7,9 @@ library. At this time these consist of instances for the typeclasses found in-the [exceptions] library.+the [exceptions], [transformers-base] and [resourcet] libraries. [Quiver]: http://hackage.haskell.org/package/quiver [exceptions]: http://hackage.haskell.org/package/exceptions+[transformers-base]: http://hackage.haskell.org/package/transformers-base+[resourcet]: http://hackage.haskell.org/package/resourcet
quiver-instances.cabal view
@@ -1,5 +1,5 @@ name: quiver-instances-version: 0.1.0.1+version: 0.2.0.0 synopsis: Extra instances for Quiver description: Various extra instances for Quiver that aren't yet in the main library.@@ -30,7 +30,9 @@ build-depends: base >=4.8 && <4.9 , exceptions == 0.8.* , quiver >= 1.1.3 && < 1.2+ , resourcet == 1.1.* , transformers+ , transformers-base hs-source-dirs: src default-language: Haskell2010
src/Control/Quiver/Instances.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, RankNTypes,+ UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} @@ -18,11 +19,14 @@ import Control.Quiver.Internal +import Control.Monad.Base (MonadBase (..), liftBaseDefault) import Control.Monad.Catch-import Control.Monad.IO.Class (MonadIO (..))-import Data.IORef (newIORef, readIORef, writeIORef)+import Control.Monad.IO.Class (MonadIO (..))+import Control.Monad.Trans.Resource (MonadResource (..))+import Data.IORef (newIORef, readIORef, writeIORef) --------------------------------------------------------------------------------+-- Instances for classes from the exceptions library. -- | Throws exceptions into the base monad. instance (MonadThrow f) => MonadThrow (P a a' b b' f) where@@ -78,3 +82,16 @@ Enclose m -> m >>= mergeAdjacent _ -> return p maskM (pk unmask)++--------------------------------------------------------------------------------+-- Instances for classes from the transformers-base library.++-- This requires UndecidableInstances+instance (MonadBase bm f) => MonadBase bm (P a a' b b' f) where+ liftBase = liftBaseDefault++--------------------------------------------------------------------------------+-- Instances for classes from the resourcet library.++instance (MonadResource f) => MonadResource (P a a' b b' f) where+ liftResourceT = qlift . liftResourceT