[GHC] #12088: Promote data family instance constructors
GHC
ghc-devs at haskell.org
Tue Aug 9 01:49:22 UTC 2016
#12088: Promote data family instance constructors
-------------------------------------+-------------------------------------
Reporter: alexvieth | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.1
checker) |
Resolution: | Keywords: TypeInType
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: #11348 | Differential Rev(s): Phab:D2272
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by alexvieth):
I'm still trying to grok the latest comments but in the meantime I want to
offer an idea similar to this one:
> Another idea: when we have a group of type instance decls, suppose we
kind check them, but do not yet solve the kind equalities that arise; but
add them to the instance environment anyway. Now solve all the kind
equalities. In our example, we'd add both instances for Open1 and Open2
before trying to solve their kind equalities. Seems a bit scary somehow.
This doesn't seem scary to me. What if we don't even kind check them
before adding their equalities to the environment? Just assume they're
well-kinded while checking the other declarations. This way, we don't have
to make sure the open type family instances come as early as possible in
the order.
1. Do SCC analysis on all declarations except for open type family
instances, to give ordered `TyClGroup`s and the set of those instances (in
source file order).
2. Before checking the `TyClGroup`s, put all equalities arising from the
open type family instances into the environment (assume for now that
they're well-kinded).
3. Check the `TyClGroup`s in order as usual.
4. Check the open type family instances (verifying or falsifying the
assumption in 2).
Maybe this is nonsense. Would it be possible to make and use a coercion
axiom without kind checking the lhs and rhs types?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12088#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list