I suspect substImplication was removed simply because it was never called, but I’m not certain.
The entire cloning and substitution business is very heavyweight. Here’s an alternative idea:
Gather ‘fuvs’, the set of all free unification variables of the constraint you are about to solve.
Solve the constraint
For each variable in ‘fuvs’, set its IORef to Flexi; that is, simply undo any unification that has taken place.
That seems simple, very non-invasive, and robust.
From: Matthías Páll Gissurarson <[hidden email]>
Sent: 10 April 2018 00:57 To: Simon Peyton Jones <[hidden email]> Subject: Nested Implications
I've been working on implementing the valid substitutions for typed holes in terms of nested implications, and I think I've worked out how to do it. But one thing bothers me. To use the implications that are passed along with the ReportErrCtxt, I have to clone
the type variables within, to avoid having side-effects that could impact later searches. I clone the type variables and create a substitution from the old variables to the new, which I'd like to apply to the implication. When I was looking around for how
to do that, I came across this code in GHC 7.6.3
The `substImplication` function does precisely what I want, i.e. applies a substitution to an implication. However, that code is no longer present in GHC 8.5! The git history doesn't go far enough back for me to find an explanation, so I wanted to ask: why
was this function removed? Is there something I should be wary of if I re-implement it?
Please correct me if my approach is all wrong, I'd like to hear what you had in mind.