
1 Jul
2021
1 Jul
'21
4:24 a.m.
You could set `-fdefer-type-errors` on the file, possibly using `dynflagsPlugin`. This will give your `typeCheckResultAction` an AST with all nodes containing type errors wrapped in an `evDelayedError` term. See Note [Deferring coercion errors to runtime] for more details. You can walk through the AST and replace these wrappers with `liftIO` (with the correct type and dictionary arguments) and things should work as you want. Of course, this will defer all type errors in the program, not just the ones that your plugin can solve. You could work around this by setting `log_action` to "upgrade" any type error warnings you didn't handle and arose as a result of `Reason Opt_DeferTypeErrors :: WarnReason` back to proper errors.