diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-03-14 10:58:58 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-03-14 11:28:50 -0400 |
commit | 67345ccf51538acf2b6452c738ba641b119f5a5e (patch) | |
tree | 082ef2133971bf5755424d415d54b407103e56ab /driver/utils | |
parent | b335f506f1d3a766de849e015f6732ae130247a4 (diff) | |
download | haskell-67345ccf51538acf2b6452c738ba641b119f5a5e.tar.gz |
Allow associated types to pattern-match in non-class-bound variables
Summary:
After 8136a5cbfcd24647f897a2fae9fcbda0b1624035 (#11450), if you have
a class with an associated type:
```
class C a where
type T a b
```
And you try to create an instance of `C` like this:
```
instance C Int where
type T Int Char = Bool
```
Then it is rejected, since you're trying to instantiate the variable ``b`` with
something other than a type variable. But this restriction proves quite
onerous in practice, as it prevents you from doing things like this:
```
class C a where
type T a (b :: Identity c) :: c
instance C Int where
type T Int ('Identity x) = x
```
You have to resort to an auxiliary type family in order to define this now,
which becomes extremely tiring. This lifts this restriction and fixes #13398,
in which it was discovered that adding this restriction broke code in the wild.
Test Plan: ./validate
Reviewers: simonpj, bgamari, austin
Reviewed By: simonpj
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3302
Diffstat (limited to 'driver/utils')
0 files changed, 0 insertions, 0 deletions