writer-cps-monads-tf (empty) → 0.1.0.0
raw patch · 5 files changed
+190/−0 lines, 5 filesdep +basedep +monads-tfdep +transformerssetup-changed
Dependencies added: base, monads-tf, transformers, writer-cps-transformers
Files
- Control/Monad/RWS/CPS.hs +69/−0
- Control/Monad/Writer/CPS.hs +51/−0
- LICENSE +30/−0
- Setup.hs +2/−0
- writer-cps-monads-tf.cabal +38/−0
+ Control/Monad/RWS/CPS.hs view
@@ -0,0 +1,69 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+-----------------------------------------------------------------------------+-- |+-- Module : Control.Monad.RWS.CPS+-- Copyright : (c) Daniel Mendler 2016,+-- (c) Andy Gill 2001,+-- (c) Oregon Graduate Institute of Science and Technology, 2001+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : mail@daniel-mendler.de+-- Stability : experimental+-- Portability : non-portable (type families)+--+-- Stricter RWS monad using continuation-passing-style for the+-- writer output.+--+-- Inspired by the paper+-- /Functional Programming with Overloading and Higher-Order Polymorphism/,+-- Mark P Jones (<http://web.cecs.pdx.edu/~mpj/>)+-- Advanced School of Functional Programming, 1995.+-----------------------------------------------------------------------------++module Control.Monad.RWS.CPS (+ -- * The RWS monad+ RWS,+ rws,+ runRWS,+ evalRWS,+ execRWS,+ mapRWS,+ withRWS,+ -- * The RWST monad transformer+ RWST,+ runRWST,+ evalRWST,+ execRWST,+ mapRWST,+ withRWST,+ -- * Strict Reader-writer-state monads+ module X+) where++import Control.Monad as X+import Control.Monad.Fix as X+import Control.Monad.RWS.Class as X+import Control.Monad.Trans as X+import Data.Monoid as X++import Control.Monad.Trans.RWS.CPS+import qualified Control.Monad.Trans.RWS.CPS as CPS++-- Orphan instance+instance (Monoid w, Monad m) => MonadWriter (RWST r w s m) where+ type WriterType (RWST r w s m) = w+ tell = CPS.tell+ listen = CPS.listen+ pass = CPS.pass++-- Orphan instance+instance Monad m => MonadReader (RWST r w s m) where+ type EnvType (RWST r w s m) = r+ ask = CPS.ask+ local = CPS.local++-- Orphan instance+instance Monad m => MonadState (RWST r w s m) where+ type StateType (RWST r w s m) = s+ get = CPS.get+ put = CPS.put
+ Control/Monad/Writer/CPS.hs view
@@ -0,0 +1,51 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+-----------------------------------------------------------------------------+-- |+-- Module : Control.Monad.Writer.CPS+-- Copyright : (c) Daniel Mendler 2016,+-- (c) Andy Gill 2001,+-- (c) Oregon Graduate Institute of Science and Technology, 2001+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : mail@daniel-mendler.de+-- Stability : experimental+-- Portability : non-portable (type families)+--+-- Stricter writer monad using continuation-passing-style for the+-- writer output.+--+-- Inspired by the paper+-- /Functional Programming with Overloading and Higher-Order Polymorphism/,+-- Mark P Jones (<http://web.cecs.pdx.edu/~mpj/pubs/springschool.html>)+-- Advanced School of Functional Programming, 1995.+-----------------------------------------------------------------------------++module Control.Monad.Writer.CPS (+ -- * The Writer monad+ Writer,+ runWriter,+ execWriter,+ mapWriter,+ -- * The WriterT monad transformer+ WriterT,+ runWriterT,+ execWriterT,+ mapWriterT,+ module X+) where++import Control.Monad as X+import Control.Monad.Fix as X+import Control.Monad.Trans as X+import Control.Monad.Writer.Class as X+import Data.Monoid as X++import Control.Monad.Trans.Writer.CPS+import qualified Control.Monad.Trans.Writer.CPS as CPS++-- Orphan instance+instance (Monoid w, Monad m) => MonadWriter (WriterT w m) where+ type WriterType (WriterT w m) = w+ tell = CPS.tell+ listen = CPS.listen+ pass = CPS.pass
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2016 Daniel Mendler, original work by Andy Gill and Ross Paterson++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 copyright holders 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.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ writer-cps-monads-tf.cabal view
@@ -0,0 +1,38 @@+-- This file has been generated from package.yaml by hpack version 0.14.1.+--+-- see: https://github.com/sol/hpack++name: writer-cps-monads-tf+version: 0.1.0.0+synopsis: MonadWriter orphan instances for writer-cps-transformers+description: The WriterT and RWST monad transformers provided by writer-cps-transformers are written in continuation passing style and avoid the space-leak problem of the traditional Control.Monad.Trans.Writer.Strict and Control.Monad.Trans.Writer.Lazy. See also (<http://hackage.haskell.org/package/writer-cps-transformers>).+category: Control+homepage: https://github.com/minad/writer-cps-monads-tf#readme+bug-reports: https://github.com/minad/writer-cps-monads-tf/issues+author: Andy Gill, Ross Paterson, Daniel Mendler+maintainer: mail@daniel-mendler.de+copyright: 2016 Daniel Mendler+license: BSD3+license-file: LICENSE+tested-with: GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1+build-type: Simple+cabal-version: >= 1.10++source-repository head+ type: git+ location: https://github.com/minad/writer-cps-monads-tf++library+ hs-source-dirs:+ .+ default-extensions: TypeFamilies+ ghc-options: -Wall+ build-depends:+ base < 6+ , transformers >= 0.4 && < 0.6+ , monads-tf >= 0.1 && < 0.3+ , writer-cps-transformers >= 0.1 && < 0.3+ exposed-modules:+ Control.Monad.RWS.CPS+ Control.Monad.Writer.CPS+ default-language: Haskell2010