diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2015-08-18 18:07:18 +0200 |
---|---|---|
committer | Ben Gamari <bgamari.foss@gmail.com> | 2015-08-18 12:32:28 -0400 |
commit | 18a15679ad6727c36b799da7c3b2a38be2001c4a (patch) | |
tree | 7d936cabd631063f69f6bdda8e8a4474f78bc655 /compiler/deSugar/MatchCon.hs | |
parent | ebca3f80b9deb50bda1e3913b969785b27d92b4e (diff) | |
download | haskell-18a15679ad6727c36b799da7c3b2a38be2001c4a.tar.gz |
Add selectors for common fields (DataCon/PatSyn) to ConLike
When pattern synonyms were introduced a new sum type was used
in places where DataCon used to be used. PatSyn and DataCon share many
of the same fields, this patch adds selectors to ConLike for these
fields.
Reviewers: austin, goldfire, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1154
Diffstat (limited to 'compiler/deSugar/MatchCon.hs')
-rw-r--r-- | compiler/deSugar/MatchCon.hs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/compiler/deSugar/MatchCon.hs b/compiler/deSugar/MatchCon.hs index b42522c3c0..4ea523a0df 100644 --- a/compiler/deSugar/MatchCon.hs +++ b/compiler/deSugar/MatchCon.hs @@ -17,8 +17,6 @@ import {-# SOURCE #-} Match ( match ) import HsSyn import DsBinds import ConLike -import DataCon -import PatSyn import TcType import DsMonad import DsUtils @@ -139,21 +137,15 @@ matchOneConLike vars ty (eqn1 : eqns) -- All eqns for a single constructor ConPatOut { pat_con = L _ con1, pat_arg_tys = arg_tys, pat_wrap = wrapper1, pat_tvs = tvs1, pat_dicts = dicts1, pat_args = args1 } = firstPat eqn1 - fields1 = case con1 of - RealDataCon dcon1 -> dataConFieldLabels dcon1 - PatSynCon{} -> [] + fields1 = conLikeFieldLabels con1 - val_arg_tys = case con1 of - RealDataCon dcon1 -> dataConInstOrigArgTys dcon1 inst_tys - PatSynCon psyn1 -> patSynInstArgTys psyn1 inst_tys + val_arg_tys = conLikeInstOrigArgTys con1 inst_tys inst_tys = ASSERT( tvs1 `equalLength` ex_tvs ) arg_tys ++ mkTyVarTys tvs1 -- dataConInstOrigArgTys takes the univ and existential tyvars -- and returns the types of the *value* args, which is what we want - ex_tvs = case con1 of - RealDataCon dcon1 -> dataConExTyVars dcon1 - PatSynCon psyn1 -> patSynExTyVars psyn1 + ex_tvs = conLikeExTyVars con1 match_group :: [Id] -> [(ConArgPats, EquationInfo)] -> DsM MatchResult -- All members of the group have compatible ConArgPats |