diff options
author | RyanGlScott <ryan.gl.scott@gmail.com> | 2016-01-08 11:46:10 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-01-08 12:26:33 +0100 |
commit | 0163427761c0e72a3acf09f854b3447f2e553f1b (patch) | |
tree | 15e6280c8b8b44c845be010c558223f8c02b7115 /compiler/deSugar/DsMeta.hs | |
parent | 6f2e722973b39b7ef423f6a6b96725395d561836 (diff) | |
download | haskell-0163427761c0e72a3acf09f854b3447f2e553f1b.tar.gz |
Fix Template Haskell's handling of infix GADT constructors
This is the second (and hopefully last) fix needed to make TH handle
GADTs properly (after D1465). This Diff addresses some issues with infix
GADT constructors, specifically:
* Before, you could not determine if a GADT constructor was declared
infix because TH did not give you the ability to determine if there is
a //user-specified// fixity declaration for that constructor. The
return type of `reifyFixity` was changed to `Maybe Fixity` so that it
yields `Just` the fixity is there is a fixity declaration, and
`Nothing` otherwise (indicating it has `defaultFixity`).
* `DsMeta`/`Convert` were changed so that infix GADT constructors are
turned into `GadtC`, not `InfixC` (which should be reserved for
Haskell98 datatype declarations).
* Some minor fixes to the TH pretty-printer so that infix GADT
constructors will be parenthesized in GADT signatures.
Fixes #11345.
Test Plan: ./validate
Reviewers: goldfire, austin, bgamari, jstolarek
Reviewed By: jstolarek
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1744
GHC Trac Issues: #11345
Diffstat (limited to 'compiler/deSugar/DsMeta.hs')
-rw-r--r-- | compiler/deSugar/DsMeta.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index 0d8df6f29b..f0f5f1b44d 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -1992,8 +1992,10 @@ repConstr (InfixCon st1 st2) Nothing [con] arg2 <- repBangTy st2 rep2 infixCName [unC arg1, unC con, unC arg2] -repConstr (InfixCon {}) (Just _) _ = panic "repConstr: infix GADT constructor?" -repConstr _ _ _ = panic "repConstr: invariant violated" +repConstr (InfixCon {}) (Just _) _ = + panic "repConstr: infix GADT constructor should be in a PrefixCon" +repConstr _ _ _ = + panic "repConstr: invariant violated" ------------ Types ------------------- |