D3316 status

Ben Gamari ben at smart-cactus.org
Wed Mar 29 18:31:13 UTC 2017


Hi Richard,

It took me a bit longer than expected to get back to D3316 but I think I
am now done. It wasn't quite as trivial as I thought it might be, so I
thought I would summarize what was needed,

 1. tcSplitTyConApp_maybe and tcRepSplitTyConApp_maybe have been moved
    from TcType to Type to avoid import loops. I'm not terribly happy
    with this change, but I spent a fair amount of time looking for
    alternatives and it seems this is the least evil. Moreover, there is
    precedent for this in tcRepSplitAppTy_maybe. It would be nice to
    refactor TcType and friends to avoid this loop.

 2. TypeMap now respects the Constraint/Type distinction. I believe this
    is safe for the TypeMap uses in the typechecker itself. The only
    other use AFAICT is Specialise.CallKeySet, which I believe should
    also be fine under this change.

 3. TcInteract.matchTypeable now handles Constraint explicitly.

With all of this the T11715 test passes. I've uploaded my changes
relative to your patch as D3396 for your review.

However, I am a bit concerned with (2) as it runs contrary to your
original implementation, which changed coreViewOneStarKind to coreView.
What was the reasoning behind this?

The motivation for moving to tcView here is the dictionary cache, which
uses a TypeMap. Namely, if we solve for `Typeable Type`, and later look
for `Typeable Constraint` in the dictionary cache, we will incorrectly
find the `Typeable Type` dictionary.

Thoughts?

Cheers,

- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170329/7d944c39/attachment.sig>


More information about the ghc-devs mailing list