Draft: Make Reduction abstract and use it for newtype steppers
This patch makes the interface to the Reduction
datatype as abstract
as possible, so that all operations are done using the combinators
instead of matching on the Reduction
constructor.
This means that all logic pertaining to Reductions is confined to the
GHC.Core.Reduction
module, which gives us more flexibility in changing
the implementation without affecting other parts of the compiler.
One important change is to move instNewTyCon_maybe
to the
GHC.Core.Reduction
module, and making the normalisation functions use
Reduction
instead of a pair, by changing NormaliseStepResult
.
This patch was split off from work I was doing on directed coercions to make things more modular, and it seemed like a good thing to have regardless.