transformers-base-0.4.5.2/0000755000000000000000000000000013260001175013476 5ustar0000000000000000transformers-base-0.4.5.2/Setup.hs0000644000000000000000000000005613260001175015133 0ustar0000000000000000import Distribution.Simple main = defaultMain transformers-base-0.4.5.2/README.md0000644000000000000000000000110413260001175014751 0ustar0000000000000000Transformers-Base ================= [![Travis](https://img.shields.io/travis/mvv/transformers-base/master.svg)](https://travis-ci.org/mvv/transformers-base) [![Hackage](https://img.shields.io/hackage/v/transformers-base.svg)](http://hackage.haskell.org/package/transformers-base) This package provides a straightforward port of [monadLib][monadLib]'s BaseM typeclass to [transformers][transformers]. [monadLib]: http://hackage.haskell.org/package/monadLib [transformers]: http://hackage.haskell.org/package/transformers Installation ------------ The usual: $ cabal install transformers-base-0.4.5.2/transformers-base.cabal0000644000000000000000000000301613260001175020117 0ustar0000000000000000Name: transformers-base Version: 0.4.5.2 Category: Control Stability: experimental Synopsis: Lift computations from the bottom of a transformer stack Description: This package provides a straightforward port of @monadLib@'s BaseM typeclass to @transformers@. Homepage: https://github.com/mvv/transformers-base Bug-Reports: https://github.com/mvv/transformers-base/issues Author: Mikhail Vorozhtsov , Bas van Dijk Maintainer: Mikhail Vorozhtsov Copyright: 2011 Mikhail Vorozhtsov , Bas van Dijk License: BSD3 License-File: LICENSE Extra-Source-Files: README.md Tested-With: GHC==7.0.4, GHC==7.4.2, GHC==7.6.3, GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.1 Cabal-Version: >= 1.8 Build-Type: Simple Source-Repository head Type: git Location: https://github.com/mvv/transformers-base.git Flag OrphanInstances Description: Import orphan Applicative instances for lazy and strict ST if needed Default: True Library Build-Depends: base >= 3 && < 5 && (< 4.4 || >= 4.5), stm >= 2.3, transformers >= 0.2, transformers-compat >= 0.6.1 Hs-Source-Dirs: src GHC-Options: -Wall if flag(OrphanInstances) Build-Depends: base-orphans >= 0.3 CPP-Options: -DHS_TRANSFORMERS_BASE__ORPHANS=1 else CPP-Options: -DHS_TRANSFORMERS_BASE__ORPHANS=0 Exposed-Modules: Control.Monad.Base transformers-base-0.4.5.2/LICENSE0000644000000000000000000000275313260001175014512 0ustar0000000000000000Copyright (c) 2011, Mikhail Vorozhtsov, Bas van Dijk 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 names of the copyright owners nor the names of the 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. transformers-base-0.4.5.2/src/0000755000000000000000000000000013260001175014265 5ustar0000000000000000transformers-base-0.4.5.2/src/Control/0000755000000000000000000000000013260001175015705 5ustar0000000000000000transformers-base-0.4.5.2/src/Control/Monad/0000755000000000000000000000000013260001175016743 5ustar0000000000000000transformers-base-0.4.5.2/src/Control/Monad/Base.hs0000644000000000000000000000554713260001175020164 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE UnicodeSyntax #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} #if MIN_VERSION_base(4,4,0) {-# LANGUAGE Safe #-} #endif #if MIN_VERSION_transformers(0,4,0) -- Hide warnings for the deprecated ErrorT transformer: {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} #endif module Control.Monad.Base ( MonadBase(..) , liftBaseDefault ) where import Data.Functor.Identity import Control.Monad.Trans.Class import Control.Monad.Trans.Identity import Control.Monad.Trans.Maybe import Control.Monad.Trans.List import Control.Monad.Trans.Reader import qualified Control.Monad.Trans.Writer.Lazy as L import qualified Control.Monad.Trans.Writer.Strict as S import qualified Control.Monad.Trans.State.Lazy as L import qualified Control.Monad.Trans.State.Strict as S import qualified Control.Monad.Trans.RWS.Lazy as L import qualified Control.Monad.Trans.RWS.Strict as S import Control.Monad.Trans.Error import Control.Monad.Trans.Cont import Control.Monad.Trans.Except import Control.Monad.Trans.Accum import Control.Monad.Trans.Select #if !MIN_VERSION_base(4,8,0) import Data.Monoid import Control.Applicative (Applicative(..)) #endif #if !MIN_VERSION_base(4,4,0) && HS_TRANSFORMERS_BASE__ORPHANS import qualified Control.Monad.ST.Lazy as L import qualified Control.Monad.ST.Strict as S import Data.Orphans () #endif #if MIN_VERSION_base(4,4,0) import qualified Control.Monad.ST.Lazy.Safe as L import qualified Control.Monad.ST.Safe as S #endif import Control.Monad.STM (STM) class (Applicative b, Applicative m, Monad b, Monad m) ⇒ MonadBase b m | m → b where -- | Lift a computation from the base monad liftBase ∷ b α → m α #define BASE(M) \ instance MonadBase (M) (M) where liftBase = id BASE(IO) BASE(Maybe) BASE(Either e) BASE([]) BASE((→) r) BASE(Identity) BASE(STM) #if !MIN_VERSION_base(4,4,0) && HS_TRANSFORMERS_BASE__ORPHANS BASE(L.ST s) BASE(S.ST s) #endif #if MIN_VERSION_base(4,4,0) BASE(L.ST s) BASE(S.ST s) #endif #undef BASE -- | Can be used as a default implementation for 'liftBase'. -- -- Note that: @liftBaseDefault = 'lift' . 'liftBase'@ liftBaseDefault ∷ (MonadTrans t, MonadBase b m) ⇒ b α → t m α liftBaseDefault = lift . liftBase #define TRANS(T) \ instance (MonadBase b m) ⇒ MonadBase b (T m) where liftBase = liftBaseDefault TRANS(IdentityT) TRANS(MaybeT) TRANS(ListT) TRANS(ReaderT r) TRANS(L.StateT s) TRANS(S.StateT s) TRANS(ContT r) TRANS(ExceptT e) TRANS(SelectT r) #undef TRANS #define TRANS_CTX(CTX, T) \ instance (CTX, MonadBase b m) ⇒ MonadBase b (T m) where liftBase = liftBaseDefault TRANS_CTX(Monoid w, L.WriterT w) TRANS_CTX(Monoid w, S.WriterT w) TRANS_CTX(Monoid w, L.RWST r w s) TRANS_CTX(Monoid w, S.RWST r w s) TRANS_CTX(Error e, ErrorT e) TRANS_CTX(Monoid w, AccumT w) #undef TRANS_CTX