projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
The breakpoint primitive
[ghc-hetmet.git]
/
compiler
/
deSugar
/
MatchCon.lhs
diff --git
a/compiler/deSugar/MatchCon.lhs
b/compiler/deSugar/MatchCon.lhs
index
2612b50
..
5233d59
100644
(file)
--- a/
compiler/deSugar/MatchCon.lhs
+++ b/
compiler/deSugar/MatchCon.lhs
@@
-1,7
+1,9
@@
-
+%
+% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
-\section[MatchCon]{Pattern-matching constructors}
+
+Pattern-matching constructors
\begin{code}
module MatchCon ( matchConFamily ) where
\begin{code}
module MatchCon ( matchConFamily ) where
@@
-10,19
+12,17
@@
module MatchCon ( matchConFamily ) where
import {-# SOURCE #-} Match ( match )
import {-# SOURCE #-} Match ( match )
-import HsSyn ( Pat(..), LPat, HsConDetails(..) )
-import DsBinds ( dsLHsBinds )
-import DataCon ( DataCon, dataConInstOrigArgTys,
- dataConFieldLabels, dataConSourceArity )
-import TcType ( tcTyConAppArgs )
-import Type ( mkTyVarTys )
+import HsSyn
+import DsBinds
+import DataCon
+import TcType
+import Type
import CoreSyn
import DsMonad
import DsUtils
import CoreSyn
import DsMonad
import DsUtils
-import Id ( Id, idName )
-import Type ( Type )
-import SrcLoc ( unLoc, Located(..) )
+import Id
+import SrcLoc
import Outputable
\end{code}
import Outputable
\end{code}
@@
-100,7
+100,8
@@
matchOneCon vars ty (eqn1 : eqns) -- All eqns for a single constructor
pat_tvs = tvs1, pat_dicts = dicts1 } = firstPat eqn1
arg_tys = dataConInstOrigArgTys con inst_tys
pat_tvs = tvs1, pat_dicts = dicts1 } = firstPat eqn1
arg_tys = dataConInstOrigArgTys con inst_tys
- inst_tys = tcTyConAppArgs pat_ty1 ++ mkTyVarTys tvs1
+ n_co_args = length (dataConEqSpec con)
+ inst_tys = tcTyConAppArgs pat_ty1 ++ (drop n_co_args $ mkTyVarTys tvs1)
-- Newtypes opaque, hence tcTyConAppArgs
shift eqn@(EqnInfo { eqn_pats = ConPatOut{ pat_tvs = tvs, pat_dicts = ds,
-- Newtypes opaque, hence tcTyConAppArgs
shift eqn@(EqnInfo { eqn_pats = ConPatOut{ pat_tvs = tvs, pat_dicts = ds,
@@
-131,7
+132,7
@@
conArgPats data_con arg_tys (RecCon rpats)
-- mk_pat picks a WildPat of the appropriate type for absent fields,
-- and the specified pattern for present fields
mk_pat lbl arg_ty
-- mk_pat picks a WildPat of the appropriate type for absent fields,
-- and the specified pattern for present fields
mk_pat lbl arg_ty
- = case [ pat | (sel_id,pat) <- rpats, idName (unLoc sel_id) == lbl] of
+ = case [ pat | HsRecField sel_id pat _ <- rpats, idName (unLoc sel_id) == lbl ] of
(pat:pats) -> ASSERT( null pats ) unLoc pat
[] -> WildPat arg_ty
\end{code}
(pat:pats) -> ASSERT( null pats ) unLoc pat
[] -> WildPat arg_ty
\end{code}