packages feed

pipes-errors (empty) → 0.1

raw patch · 5 files changed

+121/−0 lines, 5 filesdep +basedep +errorsdep +pipessetup-changed

Dependencies added: base, errors, pipes

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2014, Danny Navarro++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.++    * Neither the name of Danny Navarro nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++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.
+ Pipes/Lift/EitherRT.hs view
@@ -0,0 +1,35 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+module Pipes.Lift.EitherRT where++import Control.Monad ((>=>))+import Pipes (Proxy, MFunctor, lift, hoist)+import Pipes.Lift (distribute)+import Pipes.Internal (unsafeHoist)+import Control.Error+  ( EitherT(..)+  , EitherRT(..)+  , runEitherT+  , runEitherRT+  , flipET+  , flipE+  )+import Pipes.Lift.EitherT++instance MFunctor (EitherRT r) where+    hoist nat m = EitherRT (hoist nat (runEitherRT m))++-- | Turn 'EitherT' in the base monad into 'EitherRT'+eitherRP :: Monad m+         => Proxy a' a b' b (EitherT e m) r+         -> Proxy a' a b' b (EitherRT r m) e+eitherRP = unsafeHoist lift . runEitherP+       >=> lift . EitherRT . EitherT . return+{-# INLINABLE eitherRP #-}++-- | Turn 'EitherRT' in the base monad into 'EitherT'+runEitherRP :: Monad m+            => Proxy a' a b' b (EitherRT r m) e+            -> Proxy a' a b' b (EitherT e m) r+runEitherRP = unsafeHoist lift . runEitherT . flipET . runEitherRT . distribute+          >=> lift . EitherT . return . flipE+{-# INLINABLE runEitherRP #-}
+ Pipes/Lift/EitherT.hs view
@@ -0,0 +1,25 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+module Pipes.Lift.EitherT where++import Control.Monad ((>=>))+import Pipes (Proxy, MFunctor, hoist, lift)+import Pipes.Lift (distribute)+import Pipes.Internal (unsafeHoist)+import Control.Error (EitherT(..), runEitherT)++instance MFunctor (EitherT e) where+    hoist nat m = EitherT (nat (runEitherT m))++-- | Wrap the base monad in 'EitherT'+eitherP :: Monad m+        => Proxy a' a b' b m (Either e r)+        -> Proxy a' a b' b (EitherT e m) r+eitherP = unsafeHoist lift >=> lift . EitherT . return+{-# INLINABLE eitherP #-}++-- | Run 'EitherT' in the base monad+runEitherP :: Monad m+           => Proxy a' a b' b (EitherT e m) r+           -> Proxy a' a b' b m (Either e r)+runEitherP = runEitherT . distribute+{-# INLINABLE runEitherP #-}
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ pipes-errors.cabal view
@@ -0,0 +1,29 @@+name:                pipes-errors+version:             0.1+cabal-version:       >=1.10+build-type:          Simple+license:             BSD3+license-file:        LICENSE+author:              Danny Navarro+maintainer:          j@dannynavarro.net+homepage:            https://github.com/jdnavarro/pipes-errors+bug-reports:         https://github.com/jdnavarro/pipes-errors/issues+category:            Control, Monad, Pipes, Error Handling+synopsis:            Integration between pipes and errors+description:+  This package provides orphan `MFunctor` instances for `EitherT` and+  `EitherRT`, in addition to functions for base monad manipulation in the+  presence of `Proxy` monad transformers.++source-repository head+  type: git+  location: https://github.com/jdnavarro/pipes-errors++library+  exposed-modules:     Pipes.Lift.EitherT+                       Pipes.Lift.EitherRT+  build-depends:       base >=4.6 && <4.8,+                       errors >=1.3,+                       pipes >=4.0+  default-language:    Haskell2010+  ghc-options:         -O2 -Wall