X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FdeSugar%2FCheck.lhs;h=359035f70524ca320258ad85156ddad3c2a24dc7;hb=90dc9026b091be5cca5da4c6cbd3713ecc493361;hp=85b8f9ddd9959da94b65f6cbf457b47164bb0754;hpb=171d4582f4b9a8e0f11f8738079accbb22bafdcb;p=ghc-hetmet.git diff --git a/compiler/deSugar/Check.lhs b/compiler/deSugar/Check.lhs index 85b8f9d..359035f 100644 --- a/compiler/deSugar/Check.lhs +++ b/compiler/deSugar/Check.lhs @@ -1,36 +1,31 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1997-1998 % % Author: Juan J. Quintela -\section{Module @Check@ in @deSugar@} \begin{code} - - module Check ( check , ExhaustivePat ) where +#include "HsVersions.h" import HsSyn -import TcHsSyn ( hsLPatType, mkVanillaTuplePat ) -import TcType ( tcTyConAppTyCon ) -import DsUtils ( EquationInfo(..), MatchResult(..), - CanItFail(..), firstPat ) -import MatchLit ( tidyLitPat, tidyNPat ) -import Id ( Id, idType ) -import DataCon ( DataCon, dataConTyCon, dataConOrigArgTys, dataConFieldLabels ) -import Name ( Name, mkInternalName, getOccName, isDataSymOcc, - getName, mkVarOccFS ) +import TcHsSyn +import TcType +import DsUtils +import MatchLit +import Id +import DataCon +import Name import TysWiredIn -import PrelNames ( unboundKey ) -import TyCon ( tyConDataCons, tupleTyConBoxity, isTupleTyCon ) -import BasicTypes ( Boxity(..) ) -import SrcLoc ( noSrcLoc, Located(..), unLoc, noLoc ) +import PrelNames +import TyCon +import BasicTypes +import SrcLoc import UniqSet -import Util ( takeList, splitAtList, notNull ) +import Util import Outputable import FastString - -#include "HsVersions.h" \end{code} This module performs checks about if one list of equations are: @@ -151,7 +146,7 @@ untidy b (L loc p) = L loc (untidy' b p) untidy_con (PrefixCon pats) = PrefixCon (map untidy_pars pats) untidy_con (InfixCon p1 p2) = InfixCon (untidy_pars p1) (untidy_pars p2) -untidy_con (RecCon bs) = RecCon [(f,untidy_pars p) | (f,p) <- bs] +untidy_con (RecCon bs) = RecCon [ HsRecField f (untidy_pars p) d | HsRecField f p d <- bs ] pars :: NeedPars -> WarningPat -> Pat Name pars True p = ParPat p @@ -429,6 +424,7 @@ get_lit :: Pat id -> Maybe HsLit get_lit (LitPat lit) = Just lit get_lit (NPat (HsIntegral i _) mb _ _) = Just (HsIntPrim (mb_neg mb i)) get_lit (NPat (HsFractional f _) mb _ _) = Just (HsFloatPrim (mb_neg mb f)) +get_lit (NPat (HsIsString s _) _ _ _) = Just (HsStringPrim s) get_lit other_pat = Nothing mb_neg :: Num a => Maybe b -> a -> a @@ -687,7 +683,7 @@ simplify_con con (RecCon fs) where -- pad out all the missing fields with WildPats. field_pats = map (\ f -> (f, nlWildPat)) (dataConFieldLabels con) - all_pats = foldr (\ (id,p) acc -> insertNm (getName (unLoc id)) p acc) + all_pats = foldr (\(HsRecField id p _) acc -> insertNm (getName (unLoc id)) p acc) field_pats fs insertNm nm p [] = [(nm,p)]