Permalink
Browse files

do the evalList/parList split

  • Loading branch information...
1 parent fa9d4e5 commit dd1892037da040df287ea4a0faea62ecf6e872f4 @simonmar committed Mar 6, 2013
Showing with 11 additions and 6 deletions.
  1. +11 −6 parlist.hs
View
17 parlist.hs
@@ -1,12 +1,17 @@
module ParList where
-import Control.Parallel.Strategies hiding (parList)
+import Control.Parallel.Strategies hiding (parList, evalList)
+
+-- <<evalList
+evalList :: Strategy a -> Strategy [a]
+evalList strat [] = return []
+evalList strat (x:xs) = do
+ x' <- strat x
+ xs' <- evalList strat xs
+ return (x':xs')
+-- >>
-- <<parList
parList :: Strategy a -> Strategy [a]
-parList strat [] = return []
-parList strat (x:xs) = do
- x' <- rparWith strat x -- <1>
- xs' <- parList strat xs
- return (x':xs')
+parList strat = evalList (rparWith strat)
-- >>

0 comments on commit dd18920

Please sign in to comment.