Permalink
Browse files

Fixed problem in code-gen monad (definitions and parameters resulted …

…in wrong order)
  • Loading branch information...
1 parent 26a2b18 commit fbad2a191ee2a585944726ce3e1bfed4f3a6a001 @dybber dybber committed Sep 2, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 Data/Array/Accelerate/OpenCL/CodeGen/Monad.hs
@@ -18,7 +18,7 @@ emptySkelState = SkelState [] []
type CGM = State SkelState
runCGM :: CGM () -> CUTranslSkel
-runCGM st = CUTranslSkel . _definitions $ execState st emptySkelState
+runCGM st = CUTranslSkel . reverse . _definitions $ execState st emptySkelState
-- Setters
@@ -28,7 +28,7 @@ addDefinition def =
addParam :: Param -> CGM ()
addParam param =
- modify $ \s -> s {_params = param : (_params s)}
+ modify $ \s -> s {_params = (_params s) ++ [param]}
addDefinitions :: [Definition] -> CGM ()
addDefinitions = mapM_ addDefinition

0 comments on commit fbad2a1

Please sign in to comment.