- fail_expr = HsApp (TyApp (HsVar fail_id) [b_ty])
- (HsLit (HsString (mkFastString msg)))
- msg = "Pattern match failure in do expression, " ++ showSDoc (ppr locn)
- main_match = mkSimpleMatch [pat]
- (HsDo do_or_lc stmts ids result_ty locn)
- result_ty locn
- the_matches
- | failureFreePat pat = [main_match]
- | otherwise =
- [ main_match
- , mkSimpleMatch [WildPat a_ty] fail_expr result_ty locn
- ]