contstuff-monads-tf (empty) → 0.1.0
raw patch · 4 files changed
+133/−0 lines, 4 filesdep +basedep +contstuffdep +monads-tfsetup-changed
Dependencies added: base, contstuff, monads-tf
Files
- Control/ContStuff/MonadsTf.hs +59/−0
- LICENSE +32/−0
- Setup.lhs +12/−0
- contstuff-monads-tf.cabal +30/−0
+ Control/ContStuff/MonadsTf.hs view
@@ -0,0 +1,59 @@+-- |+-- Module: Control.ContStuff.MonadsTf+-- Copyright: (c) 2010 Ertugrul Soeylemez+-- License: BSD3+-- Maintainer: Ertugrul Soeylemez <es@ertes.de>+-- Stability: experimental+--+-- This module provides contstuff class instances for the monads from+-- the monads-tf package. This makes using both transformer libraries+-- in a single project much more convenient.++{-# LANGUAGE+ FlexibleInstances,+ TypeFamilies,+ UndecidableInstances+ #-}++module Control.ContStuff.MonadsTf () where++import qualified Control.Monad.Trans as T+import Control.Applicative+import Control.ContStuff.Classes+import Control.Monad.Cont as Cont (MonadCont(..), ContT(..))+import Control.Monad.Error (MonadError(..))+import Control.Monad.State.Class as State (MonadState(..))+++-- ================= --+-- Generic instances --+-- ================= --++instance MonadCont m => CallCC m where+ callCC = Cont.callCC++instance (Applicative m, MonadError m) => HasExceptions m where+ type Exception m = ErrorType m+ raise = throwError+ try = flip catchError (pure . Left) . fmap Right++instance T.MonadIO m => LiftBase m where+ type Base m = IO+ base = T.liftIO++instance MonadState m => Stateful m where+ type StateOf m = StateType m+ get = State.get+ putLazy = State.put++instance T.MonadTrans t => Transformer t where+ lift = T.lift+++-- ================== --+-- Specific instances --+-- ================== --++instance Applicative m => Abortable (ContT r m) where+ type Result (ContT r m) = r+ abort = ContT . const . pure
+ LICENSE view
@@ -0,0 +1,32 @@+contstuff-monads-tf license+Copyright (c) 2010, Ertugrul Soeylemez++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 the author nor the names of any 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.
+ Setup.lhs view
@@ -0,0 +1,12 @@+contstuff-monads-tf setup script+Copyright (C) 2010, Ertugrul Soeylemez++Please see the LICENSE file for terms and conditions of use,+modification and distribution of this package, including this file.++> module Main where+>+> import Distribution.Simple+>+> main :: IO ()+> main = defaultMain
+ contstuff-monads-tf.cabal view
@@ -0,0 +1,30 @@+Name: contstuff-monads-tf+Version: 0.1.0+Category: Control, Monads+Synopsis: ContStuff instances for monads-tf transformers+Maintainer: Ertugrul Söylemez <es@ertes.de>+Author: Ertugrul Söylemez <es@ertes.de>+Copyright: (c) 2010 Ertugrul Söylemez+License: BSD3+License-file: LICENSE+Build-type: Simple+Stability: experimental+Cabal-version: >= 1.6+Description:++ This package provides contstuff class instances for the monads from+ the monads-tf package. This makes using both transformer libraries+ in a single project much more convenient.++Library+ Build-depends:+ base >= 4 && <= 5,+ contstuff >= 0.7.0,+ monads-tf >= 0.1.0+ GHC-Options: -W+ Extensions:+ FlexibleInstances+ TypeFamilies+ UndecidableInstances+ Exposed-modules:+ Control.ContStuff.MonadsTf