More functions should be exported from GHC.Tc.Errors.Hole
Motivation
When writing hole-fit plugins, developers need to be able to access the underlying mechanism of the hole-fit checkers, so that they can write hole-fit checks from scratch instead of having to rely on the current implementation. Up until 8.10, this was possible, but in 9.0.1, the reorganization of the module meant that the underlying functions are not exported. This means that developers will either have to re-implement the functionality or copy-paste the code from the source, which is fragile.
I've hit this myself where I am writing a hole-fit checker which includes the checking of expressions, and am unable to write the plugin without having to re-implement the non-exported functions.
Proposal
The following functions should be added to be exported:
tcCheckHoleFit
, withoutUnification
, tcSubsumes
, isFlexiTyVar
, tcFilterHoleFits
, getLocalBindings
, pprHoleFit
, addDocs
, getSortingAlg
and getHoleFitDispConfig
and their associated data types as well.
Additionally, the relevantCts
, zonkSubs
, sortBySize
and sortByGraph
should be extracted from the local context of findValidHoleFits
and exported as well. This allows hole-fit plugin writers full access to the underlying functions of findValidHoleFits
, meaning that they can add additional functionality on top.