Skip to content

Commit 605efe5

Browse files
committed
Null case for letForEach
1 parent 31f1ff8 commit 605efe5

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

plugins/hls-tactics-plugin/src/Wingman/CodeGen.hs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,20 @@ letForEach
283283
-> Hypothesis CType
284284
-> Judgement
285285
-> RuleM (Synthesized (LHsExpr GhcPs))
286-
letForEach rename solve hy jdg = do
287-
let g = jGoal jdg
288-
terms <- fmap sequenceA $ for (unHypothesis hy) $ \hi -> do
289-
let name = rename $ hi_name hi
290-
res <- tacticToRule jdg $ solve hi
291-
pure $ fmap (name,) res
292-
let hy' = fmap (g <$) $ syn_val terms
293-
g <- newSubgoal $ introduce (userHypothesis hy') jdg
294-
pure $ g
295-
& #syn_val %~ noLoc
296-
. let' (fmap (\(occ, expr) -> valBind (occNameToStr occ) $ unLoc expr)
297-
$ syn_val terms)
298-
. unLoc
286+
letForEach rename solve (unHypothesis -> hy) jdg = do
287+
case hy of
288+
[] -> newSubgoal jdg
289+
_ -> do
290+
let g = jGoal jdg
291+
terms <- fmap sequenceA $ for hy $ \hi -> do
292+
let name = rename $ hi_name hi
293+
res <- tacticToRule jdg $ solve hi
294+
pure $ fmap (name,) res
295+
let hy' = fmap (g <$) $ syn_val terms
296+
g <- newSubgoal $ introduce (userHypothesis hy') jdg
297+
pure $ g
298+
& #syn_val %~ noLoc
299+
. let' (fmap (\(occ, expr) -> valBind (occNameToStr occ) $ unLoc expr)
300+
$ syn_val terms)
301+
. unLoc
299302

0 commit comments

Comments
 (0)