{-
launchUn :: (Scalar a, Scalar b) 
            => Int                  
            -> Int                  
            -> (Exp Word32 -> Exp Word32)  -- Maybe should be something else ? (bid tid etc ?) 
            -> (Array (Exp a) -> Kernel (Array (Exp b))) 
            -> (Exp Word32 -> Exp Word32)  
            -> KC (GlobalArray (Exp a)) 
            -> KC (GlobalArray (Exp b)) 
launchUn blocks threads inf kern outf input =                
  LaunchUn blocks threads id (pure inf ->- kern ->- pure outf) id input

test2 :: GlobalArray (Exp Int) -> KC ()
test2 arr = let arr' = Input arr 
                imm  = launchUn 10 256 stdIn myKern id arr'
                imm2 = launchUn 10 256 revblocks myKern id imm
             in WriteResult 10 256 imm2
-}                        
               
               
               
               
----------------------------------------------------------------------------               
-- ReductionTest


-- general reductions
reduce :: Syncable Array a => (a -> a -> a) -> Array a -> Kernel (Array a)
reduce op arr | len arr == 1 = return arr
              | otherwise    = 
                (pure ((uncurry (zipWith op)) . halve)
                 ->- sync
                 ->- reduce op) arr
reduce :: Syncable Array a => (a -> a -> a) -> Array a -> Kernel (Array a)
reduce op arr | len arr == 1 = return arr
              | otherwise    = 
                (pure ((uncurry (zipWith op)) . halve)
                 ->- sync
                 ->- reduce op) arr
reduce op arr | len arr == 1 = return arr
              | otherwise    = 
                (pure ((uncurry (zipWith op)) . halve)
                 ->- sync
                 ->- reduce op) arr