Skip to content

Commit

Permalink
You even liftM bro?
Browse files Browse the repository at this point in the history
  • Loading branch information
0scar committed Oct 9, 2023
1 parent afd3e44 commit 12b7d14
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/Futhark/Pass/CoalesceAccess.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,16 @@ transformMatch ::
MatchDec (BranchType GPU) ->
CoalesceM (Ctx, Stms GPU)
transformMatch (Let pat aux _) ctx s cases body m = do
undefined

-- let bodies = map caseBody cases
-- let (ctx', body') = transformBody ctx body
-- let (ctx'', cases') =
-- foldl
-- ( \(ctx_acc, cases_acc) case' -> do
-- let body'' = caseBody case'
-- let (new_ctx, new_body) = transformBody ctx_acc body''
-- let new_case = Case (casePat case') new_body
-- (new_ctx, cases_acc ++ [new_case])
-- )
-- (ctx', mempty)
-- cases
-- (ctx'', S.singleton $ Let pat aux (Match s cases' body' m))
let bodies = map caseBody cases
(ctx', body') <- transformBody ctx body
(ctx'', cases') <- foldM (handleCase) (ctx', mempty) cases
pure (ctx'', S.singleton $ Let pat aux (Match s cases' body' m))
where
handleCase (_ctx, _cases) _case = do
let body'' = caseBody _case
(new_ctx, new_body) <- transformBody _ctx body''
let new_case = Case (casePat _case) new_body
pure (new_ctx, _cases <> [new_case])

transformLoop ::
Stm GPU ->
Expand Down

0 comments on commit 12b7d14

Please sign in to comment.