[commit: packages/dph] master: Fix some Applicative-Monad stuff (c0ad10f)
git at git.haskell.org
git at git.haskell.org
Mon Aug 4 10:23:19 UTC 2014
Repository : ssh://git@git.haskell.org/dph
On branch : master
Link : http://git.haskell.org/packages/dph.git/commitdiff/c0ad10fc1a70d7fe32f4d679c44d1df0e761620b
>---------------------------------------------------------------
commit c0ad10fc1a70d7fe32f4d679c44d1df0e761620b
Author: Austin Seipp <austin at well-typed.com>
Date: Mon Aug 4 05:17:23 2014 -0500
Fix some Applicative-Monad stuff
Signed-off-by: Austin Seipp <austin at well-typed.com>
>---------------------------------------------------------------
c0ad10fc1a70d7fe32f4d679c44d1df0e761620b
dph-lifted-base/Data/Array/Parallel/PArray/Reference.hs | 2 +-
dph-lifted-boxed/Data/Array/Parallel/PArray.hs | 2 +-
.../Data/Array/Parallel/Unlifted/Distributed/Primitive/DistST.hs | 9 ++++++++-
dph-prim-seq/Data/Array/Parallel/Unlifted/Sequential/Vector.hs | 2 +-
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dph-lifted-base/Data/Array/Parallel/PArray/Reference.hs b/dph-lifted-base/Data/Array/Parallel/PArray/Reference.hs
index 3bcf736..a98ffdc 100644
--- a/dph-lifted-base/Data/Array/Parallel/PArray/Reference.hs
+++ b/dph-lifted-base/Data/Array/Parallel/PArray/Reference.hs
@@ -55,7 +55,7 @@ import Data.Array.Parallel.Base (Tag)
import Data.Vector (Vector)
import qualified Data.Array.Parallel.Unlifted as U
import qualified Data.Vector as V
-import Control.Monad
+import Control.Monad hiding ( empty )
import Prelude hiding
( replicate, length, concat
, enumFromTo
diff --git a/dph-lifted-boxed/Data/Array/Parallel/PArray.hs b/dph-lifted-boxed/Data/Array/Parallel/PArray.hs
index d19b795..3b6b6f1 100644
--- a/dph-lifted-boxed/Data/Array/Parallel/PArray.hs
+++ b/dph-lifted-boxed/Data/Array/Parallel/PArray.hs
@@ -59,7 +59,7 @@ import Data.Vector (Vector)
import qualified Data.Array.Parallel.Unlifted as U
import qualified Data.Array.Parallel.Array as A
import qualified Data.Vector as V
-import Control.Monad
+import Control.Monad hiding (empty)
import GHC.Exts (Int(I#), (+#))
import qualified Prelude as P
import Prelude hiding
diff --git a/dph-prim-par/Data/Array/Parallel/Unlifted/Distributed/Primitive/DistST.hs b/dph-prim-par/Data/Array/Parallel/Unlifted/Distributed/Primitive/DistST.hs
index a41ad5b..cdabbda 100644
--- a/dph-prim-par/Data/Array/Parallel/Unlifted/Distributed/Primitive/DistST.hs
+++ b/dph-prim-par/Data/Array/Parallel/Unlifted/Distributed/Primitive/DistST.hs
@@ -31,7 +31,7 @@ import Data.Array.Parallel.Unlifted.Distributed.Primitive.DT
import Data.Array.Parallel.Unlifted.Distributed.Primitive.Gang
import Data.Array.Parallel.Unlifted.Distributed.Data.Tuple
import Data.Array.Parallel.Base (ST, runST)
-import Control.Monad (liftM)
+import Control.Monad (liftM, ap)
-- | Data-parallel computations.
@@ -40,6 +40,13 @@ import Control.Monad (liftM)
-- then we can make a regular ST computation.
newtype DistST s a = DistST { unDistST :: Int -> ST s a }
+instance Functor (DistST s) where
+ fmap = liftM
+
+instance Applicative (DistST s) where
+ pure = return
+ (<*>) = ap
+
instance Monad (DistST s) where
{-# INLINE return #-}
return = DistST . const . return
diff --git a/dph-prim-seq/Data/Array/Parallel/Unlifted/Sequential/Vector.hs b/dph-prim-seq/Data/Array/Parallel/Unlifted/Sequential/Vector.hs
index e7d45b2..20b6170 100644
--- a/dph-prim-seq/Data/Array/Parallel/Unlifted/Sequential/Vector.hs
+++ b/dph-prim-seq/Data/Array/Parallel/Unlifted/Sequential/Vector.hs
@@ -133,7 +133,7 @@ import qualified Prelude
import qualified System.Random as R
import Foreign hiding ( new )
import System.IO
-import Control.Monad
+import Control.Monad hiding (empty)
here s = "Data.Array.Parallel.Unlifted.Sequential.Flat." Prelude.++ s
More information about the ghc-commits
mailing list