diff options
author | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2015-11-11 10:49:22 +0100 |
---|---|---|
committer | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2015-12-21 20:47:16 +0100 |
commit | eeecb8647585ad9eea0554b2f97a3645d2c59f88 (patch) | |
tree | d2294dd80400f495deab260e4e810b7dcbefb096 /compiler/hsSyn/HsPat.hs | |
parent | a61e717fcff9108337b1d35783ea3afbf591d3c6 (diff) | |
download | haskell-eeecb8647585ad9eea0554b2f97a3645d2c59f88.tar.gz |
Add proper GADTs support to Template Haskell
Until now GADTs were supported in Template Haskell by encoding them using
normal data types. This patch adds proper support for representing GADTs
in TH.
Test Plan: T10828
Reviewers: goldfire, austin, bgamari
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D1465
GHC Trac Issues: #10828
Diffstat (limited to 'compiler/hsSyn/HsPat.hs')
-rw-r--r-- | compiler/hsSyn/HsPat.hs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/compiler/hsSyn/HsPat.hs b/compiler/hsSyn/HsPat.hs index 38f06264a2..1751b96fd5 100644 --- a/compiler/hsSyn/HsPat.hs +++ b/compiler/hsSyn/HsPat.hs @@ -17,7 +17,6 @@ module HsPat ( Pat(..), InPat, OutPat, LPat, - HsConDetails(..), HsConPatDetails, hsConPatArgs, HsRecFields(..), HsRecField'(..), LHsRecField', HsRecField, LHsRecField, @@ -224,14 +223,6 @@ data Pat id deriving (Typeable) deriving instance (DataId id) => Data (Pat id) --- HsConDetails is use for patterns/expressions *and* for data type declarations - -data HsConDetails arg rec - = PrefixCon [arg] -- C p1 p2 p3 - | RecCon rec -- C { x = p1, y = p2 } - | InfixCon arg arg -- p1 `C` p2 - deriving (Data, Typeable) - type HsConPatDetails id = HsConDetails (LPat id) (HsRecFields id (LPat id)) hsConPatArgs :: HsConPatDetails id -> [LPat id] @@ -239,16 +230,8 @@ hsConPatArgs (PrefixCon ps) = ps hsConPatArgs (RecCon fs) = map (hsRecFieldArg . unLoc) (rec_flds fs) hsConPatArgs (InfixCon p1 p2) = [p1,p2] -instance (Outputable arg, Outputable rec) - => Outputable (HsConDetails arg rec) where - ppr (PrefixCon args) = text "PrefixCon" <+> ppr args - ppr (RecCon rec) = text "RecCon:" <+> ppr rec - ppr (InfixCon l r) = text "InfixCon:" <+> ppr [l, r] - -{- -However HsRecFields is used only for patterns and expressions -(not data type declarations) --} +-- HsRecFields is used only for patterns and expressions (not data type +-- declarations) data HsRecFields id arg -- A bunch of record fields -- { x = 3, y = True } |