Improve the reporting of an ambiguous ErrorMessage
When there is an ambiguous error message, e.g.
-- Example using TypeError
type family F msg where { F msg = TypeError msg }
foo :: F msg => ()
foo = ()
bar = foo
--------------------
-- Example using Unsatisfiable
baz :: ()
baz = unsatisfiable
We get an error message that looks like
error: [GHC-22250]
- msg0
with the ambiguous metavariable msg0
appearing in the message.
We might instead want to default this metavariable to get a more sensible error message. cc @adamgundry who observed this.
This wouldn't handle all situations, e.g.
type family F ty where { F ty = TypeError ( Text "Message header" :$$: ShowType ty ) }
foo' :: F ty => ()
foo' = ()
bar' = foo'
error:
* Message header
ty0
and now ty0 :: Type
which we don't really have a good way of defaulting. But perhaps that's OK.
Another alternative would be to avoid reporting it using the usual mechanism entirely, as @monoidal suggests in #23817 (comment 520095).