Skip to content

Commit

Permalink
Fixed problem in code-gen monad (definitions and parameters resulted …
Browse files Browse the repository at this point in the history
…in wrong order)
  • Loading branch information
dybber committed Sep 2, 2011
1 parent 26a2b18 commit fbad2a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Data/Array/Accelerate/OpenCL/CodeGen/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit fbad2a1

Please sign in to comment.