- -- For the error message we don't use mkErrorAppDs to avoid
- -- duplicating the string literal each time
- newSysLocalDs stringTy `thenDs` \ msg_var ->
- getSrcLocDs `thenDs` \ src_loc ->
- let
- full_msg = showSDoc (hcat [ppr src_loc, text "|", ppr pat])
- in
- mkStringLit full_msg `thenDs` \ core_msg ->
- mapDs (mk_bind val_var msg_var) binders `thenDs` \ binds ->
+ -- For the error message we make one error-app, to avoid duplication.
+ -- But we need it at different types... so we use coerce for that
+ mkErrorAppDs iRREFUT_PAT_ERROR_ID
+ unitTy (showSDoc (ppr pat)) `thenDs` \ err_expr ->
+ newSysLocalDs unitTy `thenDs` \ err_var ->
+ mapDs (mk_bind val_var err_var) binders `thenDs` \ binds ->