Skip to content

Commit

Permalink
Add error message when flattening of numbers fail
Browse files Browse the repository at this point in the history
  • Loading branch information
developedby committed Dec 2, 2024
1 parent 0272e67 commit 77a702a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Kind/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,8 @@ makeNumCase col mat bods depth num =
makeSucCase :: [Pattern] -> [[Pattern]] -> [Term] -> Int -> Word64 -> String -> Term
makeSucCase col mat bods depth suc var =
let (mat', bods') = foldr go ([], []) (zip3 col mat bods)
bod = (flattenRules mat' bods' (depth + 1))
bod = if null bods' then error $ "missing case for " ++ show suc ++ "+" ++ var
else (flattenRules mat' bods' (depth + 1))
in Lam var (\x -> bod)
where go ((PSuc _ _), pats, bod) (mat, bods) = (pats:mat, bod:bods)
go ((PVar "_"), pats, bod) (mat, bods) = (pats:mat, bod:bods)
Expand Down

0 comments on commit 77a702a

Please sign in to comment.