X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcGenDeriv.lhs;h=ea5ca8eb92ca1343b48cb2efde026a6eb461c97c;hp=4291c4b257288174250669751a126f2ca9602268;hb=17b297d97d327620ed6bfab942f8992b2446f1bf;hpb=ddf73bf71eeaf80bf41ea4054d161dda839b2573 diff --git a/compiler/typecheck/TcGenDeriv.lhs b/compiler/typecheck/TcGenDeriv.lhs index 4291c4b..ea5ca8e 100644 --- a/compiler/typecheck/TcGenDeriv.lhs +++ b/compiler/typecheck/TcGenDeriv.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TcGenDeriv]{Generating derived instance declarations} + +TcGenDeriv: Generating derived instance declarations This module is nominally ``subordinate'' to @TcDeriv@, which is the ``official'' interface to deriving-related things. @@ -9,6 +11,13 @@ This module is nominally ``subordinate'' to @TcDeriv@, which is the This is where we do all the grimy bindings' generation. \begin{code} +{-# OPTIONS_GHC -w #-} +-- 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/WorkingConventions#Warnings +-- for details + module TcGenDeriv ( gen_Bounded_binds, gen_Enum_binds, @@ -29,37 +38,28 @@ module TcGenDeriv ( #include "HsVersions.h" import HsSyn -import RdrName ( RdrName, mkVarUnqual, getRdrName, mkRdrUnqual, - mkDerivedRdrName ) -import BasicTypes ( Fixity(..), maxPrecedence, Boxity(..) ) -import DataCon ( isNullarySrcDataCon, dataConTag, - dataConOrigArgTys, dataConSourceArity, fIRST_TAG, - DataCon, dataConName, dataConIsInfix, - dataConFieldLabels ) -import Name ( getOccString, getSrcLoc, Name, NamedThing(..) ) - -import HscTypes ( FixityEnv, lookupFixity ) +import RdrName +import BasicTypes +import DataCon +import Name + +import HscTypes import PrelInfo import PrelNames -import MkId ( eRROR_ID ) -import PrimOp ( PrimOp(..) ) -import SrcLoc ( Located(..), noLoc, srcLocSpan ) -import TyCon ( TyCon, isNewTyCon, tyConDataCons, isEnumerationTyCon, tyConArity, - maybeTyConSingleCon, tyConFamilySize, tyConTyVars, tyConName - ) -import TcType ( isUnLiftedType, tcEqType, Type ) -import TysPrim ( charPrimTy, intPrimTy, wordPrimTy, addrPrimTy, floatPrimTy, doublePrimTy, - intPrimTyCon ) -import TysWiredIn ( charDataCon, intDataCon, floatDataCon, doubleDataCon, - intDataCon_RDR, true_RDR, false_RDR ) -import Util ( zipWithEqual, isSingleton, - zipWith3Equal, nOfThem, zipEqual ) -import Constants -import List ( partition, intersperse ) +import MkId +import PrimOp +import SrcLoc +import TyCon +import TcType +import TysPrim +import TysWiredIn +import Util import Outputable import FastString import OccName import Bag + +import Data.List ( partition, intersperse ) \end{code} %************************************************************************ @@ -1214,12 +1214,13 @@ gen_tag_n_con_monobind (rdr_name, tycon, GenCon2Tag) (nlHsApp (nlHsVar getTag_RDR) a_Expr))) (noLoc (mkExplicitHsForAllTy (map (noLoc.UserTyVar) tvs) (noLoc []) con2tag_ty)) - con2tag_ty = foldl nlHsAppTy (nlHsTyVar (getRdrName tycon)) - (map nlHsTyVar tvs) + con2tag_ty = nlHsTyConApp (getRdrName tycon) (map nlHsTyVar tvs) `nlHsFunTy` nlHsTyVar (getRdrName intPrimTyCon) - lots_of_constructors = tyConFamilySize tycon > mAX_FAMILY_SIZE_FOR_VEC_RETURNS + lots_of_constructors = tyConFamilySize tycon > 8 + -- was: mAX_FAMILY_SIZE_FOR_VEC_RETURNS + -- but we don't do vectored returns any more. mk_stuff :: DataCon -> ([LPat RdrName], LHsExpr RdrName) mk_stuff con = ([nlWildConPat con], @@ -1427,10 +1428,6 @@ genOpApp e1 op e2 = nlHsPar (nlHsOpApp e1 op e2) \end{code} \begin{code} -getSrcSpan = srcLocSpan . getSrcLoc -\end{code} - -\begin{code} a_RDR = mkVarUnqual FSLIT("a") b_RDR = mkVarUnqual FSLIT("b") c_RDR = mkVarUnqual FSLIT("c")