Ticket #2984: MinimalParTree.hs

File MinimalParTree.hs, 501 bytes (added by fre, 5 years ago)
Line 
1{-# LANGUAGE PArr, ParallelListComp #-}
2{-# OPTIONS -fvectorise #-}
3
4module MinimalParTree (sumTreeWrapper) where
5
6import qualified Prelude
7import Data.Array.Parallel.Prelude
8import Data.Array.Parallel.Prelude.Int
9
10
11data Tree a = Node a [: Tree a :]
12
13
14testTree :: Int -> Tree Int
15testTree elem = Node elem emptyP
16
17
18sumTree :: Tree Int -> Int
19sumTree (Node x ns) = x + sumP (mapP sumTree ns)
20
21{-# NOINLINE sumTreeWrapper #-}
22sumTreeWrapper :: Int -> Int
23sumTreeWrapper elem =
24  sumTree (testTree elem)