packages feed

Parallel-Arrows-ParMonad (empty) → 0.1.1.0

raw patch · 9 files changed

+331/−0 lines, 9 filesdep +Parallel-Arrows-BaseSpecdep +Parallel-Arrows-Definitiondep +Parallel-Arrows-ParMonadsetup-changed

Dependencies added: Parallel-Arrows-BaseSpec, Parallel-Arrows-Definition, Parallel-Arrows-ParMonad, base, deepseq, hspec, monad-par, split

Files

+ LICENSE.md view
@@ -0,0 +1,23 @@+[The MIT License (MIT)][]++Copyright (c) 2017 Martin Braun++Permission is hereby granted, free of charge, to any person obtaining a copy of+this software and associated documentation files (the "Software"), to deal in+the Software without restriction, including without limitation the rights to+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies+of the Software, and to permit persons to whom the Software is furnished to do+so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.++[The MIT License (MIT)]: https://opensource.org/licenses/MIT
+ Parallel-Arrows-ParMonad.cabal view
@@ -0,0 +1,63 @@+-- This file has been generated from package.yaml by hpack version 0.20.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: 4b21a2a6bc5ef1e9c1a808a01640729079b28535021a60ed15386380a8eebdda++name:           Parallel-Arrows-ParMonad+version:        0.1.1.0+synopsis:       Par Monad (@monad-par@) based backend for @Parallel-Arrows-Definition@.+description:    Par Monad (@monad-par@) based backend for @Parallel-Arrows-Definition@. Use this backend for shared-memory programs.+category:       Parallelism,Arrows+homepage:       https://github.com/s4ke/Parrows#readme+bug-reports:    https://github.com/s4ke/Parrows/issues+maintainer:     Martin Braun+license:        MIT+license-file:   LICENSE.md+build-type:     Simple+cabal-version:  >= 1.10++extra-source-files:+    package.yaml+    stack.yaml++source-repository head+  type: git+  location: https://github.com/s4ke/Parrows++library+  hs-source-dirs:+      src/main+  ghc-options: -Wall+  build-depends:+      Parallel-Arrows-Definition ==0.1.1.0+    , base >=4.7 && <5.0+    , deepseq+    , monad-par+    , split+  exposed-modules:+      Parrows.ParMonad+      Parrows.ParMonad.Simple+  other-modules:+      Paths_Parallel_Arrows_ParMonad+  default-language: Haskell2010++test-suite spec+  type: exitcode-stdio-1.0+  main-is: Spec.hs+  hs-source-dirs:+      src/test+  ghc-options: -Wall+  build-depends:+      Parallel-Arrows-BaseSpec ==0.1.1.0+    , Parallel-Arrows-Definition ==0.1.1.0+    , Parallel-Arrows-ParMonad+    , base+    , deepseq+    , hspec ==2.*+    , monad-par+    , split+  other-modules:+      ParMonadSpec+      Paths_Parallel_Arrows_ParMonad+  default-language: Haskell2010
+ Setup.hs view
@@ -0,0 +1,7 @@+-- This script is used to build and install your package. Typically you don't+-- need to change it. The Cabal documentation has more information about this+-- file: <https://www.haskell.org/cabal/users-guide/installing-packages.html>.+import qualified Distribution.Simple++main :: IO ()+main = Distribution.Simple.defaultMain
+ package.yaml view
@@ -0,0 +1,39 @@+# This YAML file describes your package. Stack will automatically generate a+# Cabal file when you run `stack build`. See the hpack website for help with+# this file: <https://github.com/sol/hpack>.+category: Parallelism,Arrows+description: Par Monad (@monad-par@) based backend for @Parallel-Arrows-Definition@.+  Use this backend for shared-memory programs.+extra-source-files:+- package.yaml+- stack.yaml+ghc-options: -Wall+github: s4ke/Parrows+library:+  dependencies:+  - base >= 4.7 && < 5.0+  - deepseq+  - monad-par+  - split+  - Parallel-Arrows-Definition == 0.1.1.0+  source-dirs: src/main+tests:+  spec:+    source-dirs:+      - src/test+    main: Spec.hs+    dependencies:+      - hspec == 2.*+      - base+      - deepseq+      - monad-par+      - split+      - Parallel-Arrows-Definition == 0.1.1.0+      - Parallel-Arrows-BaseSpec == 0.1.1.0+      - Parallel-Arrows-ParMonad+license: MIT+license-file: LICENSE.md+maintainer: Martin Braun+name: Parallel-Arrows-ParMonad+synopsis: Par Monad (@monad-par@) based backend for @Parallel-Arrows-Definition@.+version: '0.1.1.0'
+ src/main/Parrows/ParMonad.hs view
@@ -0,0 +1,76 @@+{-+The MIT License (MIT)++Copyright (c) 2016-2017 Martin Braun++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+-}+{-# LANGUAGE FlexibleInstances     #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE UndecidableInstances  #-}+module Parrows.ParMonad(+  Strategy,+  Conf(..),+  defaultConf,+  stratToConf,+  strict,+  headStrict,+  module Parrows.Definition,+  module Parrows.Future,+  module Control.DeepSeq+) where++import           Parrows.Definition+import           Parrows.Future+import           Parrows.Util++import           Control.Arrow+import           Control.DeepSeq+import           Control.Monad.Par++type Strategy a = a -> Par (IVar a)++strict :: (NFData a) => Strategy a+strict = spawn . return++headStrict :: Strategy a+headStrict = spawn_ . return++data Conf a = Conf (Strategy a)++defaultConf :: (NFData b) => [arr a b] -> Conf b+defaultConf fs = stratToConf fs strict++stratToConf :: [arr a b] -> Strategy b -> Conf b+stratToConf _ strat = Conf strat++instance (ArrowChoice arr) => ArrowParallel arr a b (Conf b) where+    parEvalN (Conf strat) fs = evalN (map (>>> arr strat) fs) >>>+                    arr sequence >>>+                    arr (>>= mapM Control.Monad.Par.get) >>>+                    arr runPar++instance (ArrowChoice arr, ArrowParallel arr a b (Conf b)) => ArrowLoopParallel arr a b (Conf b) where+    loopParEvalN _ = evalN+    postLoopParEvalN = parEvalN++instance Future BasicFuture a (Conf a) where+    put _ = put'+    get _ = get'
+ src/main/Parrows/ParMonad/Simple.hs view
@@ -0,0 +1,43 @@+{-+The MIT License (MIT)++Copyright (c) 2016-2017 Martin Braun++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+-}+{-# LANGUAGE FlexibleContexts      #-}+{-# LANGUAGE UndecidableInstances  #-}+{-# LANGUAGE FlexibleInstances     #-}+{-# LANGUAGE MultiParamTypeClasses #-}+module Parrows.ParMonad.Simple where++import Parrows.ParMonad+import Control.Arrow++instance (NFData b, ArrowChoice arr, ArrowParallel arr a b (Conf b)) => ArrowParallel arr a b () where+    parEvalN _ fs = parEvalN (defaultConf fs) fs++instance (NFData b, ArrowChoice arr, ArrowParallel arr a b (), ArrowLoopParallel arr a b (Conf b)) => ArrowLoopParallel arr a b () where+    loopParEvalN _ fs = loopParEvalN (defaultConf fs) fs+    postLoopParEvalN _  fs = postLoopParEvalN (defaultConf fs) fs++instance Future BasicFuture b () where+    put _ = put'+    get _ = get'
+ src/test/ParMonadSpec.hs view
@@ -0,0 +1,11 @@+module ParMonadSpec(spec) where++import Parrows.ParMonad.Simple()++import BaseSpec.CompleteSpecBase++import Test.Hspec++spec :: Spec+spec = describe "Par Monad PArrows Check" $ do+    specBase
+ src/test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
+ stack.yaml view
@@ -0,0 +1,68 @@+# This file was automatically generated by 'stack init'+#+# Some commonly used options have been documented as comments in this file.+# For advanced use and comprehensive documentation of the format, please see:+# http://docs.haskellstack.org/en/stable/yaml_configuration/++# Resolver to choose a 'specific' stackage snapshot or a compiler version.+# A snapshot resolver dictates the compiler version and the set of packages+# to be used for project dependencies. For example:+#+# resolver: lts-3.5+# resolver: nightly-2015-09-21+# resolver: ghc-7.10.2+# resolver: ghcjs-0.1.0_ghc-7.10.2+# resolver:+#  name: custom-snapshot+#  location: "./custom-snapshot.yaml"+resolver: lts-7.1++# User packages to be built.+# Various formats can be used as shown in the example below.+#+# packages:+# - some-directory+# - https://example.com/foo/bar/baz-0.0.2.tar.gz+# - location:+#    git: https://github.com/commercialhaskell/stack.git+#    commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a+# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a+#   extra-dep: true+#  subdirs:+#  - auto-update+#  - wai+#+# A package marked 'extra-dep: true' will only be built if demanded by a+# non-dependency (i.e. a user package), and its test suites and benchmarks+# will not be run. This is useful for tweaking upstream packages.+packages:+- ../Definition+- ../BaseSpec+- '.'+# Dependency packages to be pulled from upstream that are not in the resolver+# (e.g., acme-missiles-0.3)+extra-deps: []++# Override default flag values for local packages and extra-deps+flags: {}++# Extra package databases containing global packages+extra-package-dbs: []++# Control whether we use the GHC we find on the path+# system-ghc: true+#+# Require a specific version of stack, using version ranges+# require-stack-version: -any # Default+# require-stack-version: ">=1.1"+#+# Override the architecture used by stack, especially useful on Windows+# arch: i386+# arch: x86_64+#+# Extra directories used by stack for building+# extra-include-dirs: [/path/to/dir]+# extra-lib-dirs: [/path/to/dir]+#+# Allow a newer minor version of GHC than the snapshot specifies+# compiler-check: newer-minor