X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FdeSugar%2FMatchCon.lhs;h=801944a642da79382cc753d19d3f7b612bb9dbd7;hb=cec9b62f2ccdd358aa1d99c4143794b541b87f7e;hp=ed9f2c12047264a35a9817b3bc2c528dd8905f3f;hpb=2eb04ca0f8d0ec72b417cddc60672c696b4a3daa;p=ghc-hetmet.git diff --git a/compiler/deSugar/MatchCon.lhs b/compiler/deSugar/MatchCon.lhs index ed9f2c1..801944a 100644 --- a/compiler/deSugar/MatchCon.lhs +++ b/compiler/deSugar/MatchCon.lhs @@ -6,6 +6,13 @@ Pattern-matching constructors \begin{code} +{-# OPTIONS -fno-warn-incomplete-patterns #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module MatchCon ( matchConFamily ) where #include "HsVersions.h" @@ -18,10 +25,12 @@ import DataCon import TcType import Type import CoreSyn +import MkCore import DsMonad import DsUtils import Util ( takeList ) import Id +import Var (TyVar) import SrcLoc import Outputable \end{code} @@ -86,6 +95,10 @@ matchConFamily (var:vars) ty groups = do { alts <- mapM (matchOneCon vars ty) groups ; return (mkCoAlgCaseMatchResult var ty alts) } +matchOneCon :: [Id] + -> Type + -> [EquationInfo] + -> DsM (DataCon, [TyVar], MatchResult) matchOneCon vars ty (eqn1 : eqns) -- All eqns for a single constructor = do { (wraps, eqns') <- mapAndUnzipM shift (eqn1:eqns) ; arg_vars <- selectMatchVars (take (dataConSourceArity con1) @@ -112,7 +125,7 @@ matchOneCon vars ty (eqn1 : eqns) -- All eqns for a single constructor = do { prs <- dsLHsBinds bind ; return (wrapBinds (tvs `zip` tvs1) . wrapBinds (ds `zip` dicts1) - . mkDsLet (Rec prs), + . mkCoreLet (Rec prs), eqn { eqn_pats = conArgPats con1 arg_tys args ++ pats }) } conArgPats :: DataCon @@ -121,9 +134,9 @@ conArgPats :: DataCon -- are probably never looked at anyway -> HsConDetails (LPat Id) (HsRecFields Id (LPat Id)) -> [Pat Id] -conArgPats data_con arg_tys (PrefixCon ps) = map unLoc ps -conArgPats data_con arg_tys (InfixCon p1 p2) = [unLoc p1, unLoc p2] -conArgPats data_con arg_tys (RecCon (HsRecFields rpats _)) +conArgPats _data_con _arg_tys (PrefixCon ps) = map unLoc ps +conArgPats _data_con _arg_tys (InfixCon p1 p2) = [unLoc p1, unLoc p2] +conArgPats data_con arg_tys (RecCon (HsRecFields rpats _)) | null rpats = -- Special case for C {}, which can be used for -- a constructor that isn't declared to have