[GHC] #11348: Local open type families instances ignored during type checking
GHC
ghc-devs at haskell.org
Fri Jan 8 01:09:01 UTC 2016
#11348: Local open type families instances ignored during type checking
-------------------------------------+-------------------------------------
Reporter: alexvieth | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by alexvieth):
> Yes, exactly. That is much simpler than "meta-nodes", and had the great
merit of being correct (see third bullet).
Agreed. My graph approach was all wrong, so I've ditched it.
I think it would be ideal if we didn't have to plumb the `FreeVars` past
`rnSrcDecls` and onto `tcTyAndClassDecls`, so I've come up with a solution
which does essentially what you've described but during dependency
analysis.
1. Compute the SCCs for `TyClDecl`s as we do now in HEAD.
2. For all of the `InstDecl`s (I includes class and data family instances.
Any harm in doing so?), associate it with its `FreeVars`, intersected with
the set of `Name`s of `TyClDecl`s that we just analysed.
3. Fold the list of SCCs, at each step extracting the set of `InstDecl`s
for which its `FreeVars` is empty, and then eliminating all of the `Name`s
found in that SCC. That set of `InstDecl`s, if non-empty, comes before the
current component in the output list.
Will upload the patch in a few seconds.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11348#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list