packages feed

distributed-process-monad-control (empty) → 0.4.2

raw patch · 5 files changed

+110/−0 lines, 5 filesdep +basedep +distributed-processdep +monad-controlsetup-changed

Dependencies added: base, distributed-process, monad-control, transformers, transformers-base

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2014, Jeremy Huffman++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 Jeremy Huffman 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.
+ README.md view
@@ -0,0 +1,21 @@+### distributed-process-monad-control++Orphan instances for MonadBase and MonadBaseControl.++This repository is part of Cloud Haskell.++See http://haskell-distributed.github.io for documentation, user guides,+tutorials and assistance.++### Getting Help / Raising Issues++Please visit our [bug tracker](http://cloud-haskell.atlassian.net) to submit+issues. Anyone can browse, although you'll need to provide an email address+and create an account in order to submit new issues.++If you'd like to talk to a human, please contact us at the parallel-haskell+mailing list in the first instance - parallel-haskell@googlegroups.com.++### License++distributed-process-monad-control is made available under a BSD-3 license.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ distributed-process-monad-control.cabal view
@@ -0,0 +1,29 @@+-- Initial distributed-process-monad-control.cabal generated by cabal init.+--   For further documentation, see http://haskell.org/cabal/users-guide/++name:                distributed-process-monad-control+version:             0.4.2+synopsis:            Orphan instances for MonadBase and MonadBaseControl.+-- description:         +homepage:            http://http://haskell-distributed.github.io+license:             BSD3+license-file:        LICENSE+author:              Jeremy Huffman+maintainer:          jeremy@jeremyhuffman.com+-- copyright:           +category:            Control+build-type:          Simple+extra-source-files:  README.md+cabal-version:       >=1.10++library+  exposed-modules:    Control.Distributed.Process.MonadBaseControl+  -- other-modules:       +  build-depends:      base >= 4.4 && <= 0.5+                    , distributed-process == 0.4.2+                    , monad-control >= 0.3 && <= 0.4+                    , transformers+                    , transformers-base >= 0.4.1 && <= 0.5.0 +  hs-source-dirs:     src+  default-language:   Haskell2010+  ghc-options:      -Wall
+ src/Control/Distributed/Process/MonadBaseControl.hs view
@@ -0,0 +1,28 @@+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TypeFamilies #-}++{-# OPTIONS_GHC -fno-warn-orphans #-}+-- | This module only exports instances for 'MonadBase' 'IO' and+-- 'MonadBaseControl' 'IO' for the 'Process' monad.+module Control.Distributed.Process.MonadBaseControl+  (+  ) where++import Control.Distributed.Process.Internal.Types+  ( Process(..)+  , LocalProcess+  )+++import Control.Monad.Base (MonadBase(..))+import Control.Monad.Trans.Control (MonadBaseControl(..))+import Control.Monad.Trans.Reader (ReaderT)++deriving instance MonadBase IO Process++instance MonadBaseControl IO Process where+  newtype StM Process a = StProcess {_unSTProcess :: StM (ReaderT LocalProcess IO) a}+  restoreM (StProcess m) = Process $ restoreM m+  liftBaseWith f = Process $ liftBaseWith $ \ rib -> f (fmap StProcess . rib . unProcess)