[GHC] #14119: Refactor type patterns
GHC
ghc-devs at haskell.org
Sat Sep 9 20:37:28 UTC 2017
#14119: Refactor type patterns
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: goldfire
Type: task | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Resolution: | Keywords: TypeInType
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking: 12564, 13910,
| 13938, 14038
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by goldfire):
* owner: (none) => goldfire
Comment:
After a chat at ICFP, Simon and I agreed that this was worthwhile, but in
a very different way than originally proposed: create a new datatype
`TypePat`, which would be a ''Core'' type pattern, used in, e.g.,
`FamInst`. Such a type would have no casts, no type families, and no
foralls. Casts can be gotten rid of because the pure unifier (the client
of type patterns) never uses them, unless they wrap a variable. And in
that case, we can just use a variable with a new, corrected kind, and
substitute the new one in for the old one (casting appropriately in the,
e.g., type family equation's RHS). This transformation would happen after
kind-checking and desugaring.
Incidentally, it turns out that the underlying problem that this ticket
was originally opened for was fixed by a small fix in the unifier. (The
matching substitution must be applied to any cast found in the type
pattern.) But that fix might not catch every possible case, while the
proposal in this comment should.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14119#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list