File tree 1 file changed +9
-6
lines changed
clash-lib/src/CLaSH/Normalize 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -241,12 +241,15 @@ caseCon ctx e@(Case subj ty alts)
241
241
reduceConstant <- Lens. view evaluator
242
242
case reduceConstant tcm True subj of
243
243
Literal l -> caseCon ctx (Case (Literal l) ty alts)
244
- subj'@ (collectArgs -> (Data _,_)) -> caseCon ctx (Case subj' ty alts)
245
- subj' -> let msg = " Irreducible constant as case subject: " ++ showDoc subj ++ " \n Can be reduced to: " ++ showDoc subj'
246
- in traceIf (lvl > DebugNone ) msg $
247
- if lvl > DebugFinal
248
- then error msg
249
- else caseOneAlt e
244
+ subj' -> case collectArgs subj' of
245
+ (Data _,_) -> caseCon ctx (Case subj' ty alts)
246
+ (Prim nm ty',[_,msg])
247
+ | nm == " Control.Exception.Base.patError" ->
248
+ let e' = mkApps (Prim nm ty') [Right ty,msg]
249
+ in changed e'
250
+ _ -> traceIf (lvl > DebugNone )
251
+ (" Irreducible constant as case subject: " ++ showDoc subj ++ " \n Can be reduced to: " ++ showDoc subj')
252
+ (caseOneAlt e)
250
253
251
254
caseCon _ e = caseOneAlt e
252
255
You can’t perform that action at this time.
0 commit comments