X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FbasicTypes%2FNewDemand.lhs;h=0ca93ea396e76c4b08f3d918c37df928bc6eaf68;hp=8e68fd87d23cd00495ee25ff460358cd903a8031;hb=17b297d97d327620ed6bfab942f8992b2446f1bf;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1 diff --git a/compiler/basicTypes/NewDemand.lhs b/compiler/basicTypes/NewDemand.lhs index 8e68fd8..0ca93ea 100644 --- a/compiler/basicTypes/NewDemand.lhs +++ b/compiler/basicTypes/NewDemand.lhs @@ -1,9 +1,17 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[Demand]{@Demand@: the amount of demand on a value} \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 NewDemand( Demand(..), topDmd, lazyDmd, seqDmd, evalDmd, errDmd, isStrictDmd, @@ -24,11 +32,11 @@ module NewDemand( #include "HsVersions.h" -import StaticFlags ( opt_CprOff ) -import BasicTypes ( Arity ) -import VarEnv ( VarEnv, emptyVarEnv, isEmptyVarEnv ) -import UniqFM ( ufmToList ) -import Util ( listLengthCmp, zipWithEqual ) +import StaticFlags +import BasicTypes +import VarEnv +import UniqFM +import Util import Outputable \end{code} @@ -79,7 +87,13 @@ zipWithDmds :: (Demand -> Demand -> Demand) zipWithDmds f (Poly d1) (Poly d2) = Poly (d1 `f` d2) zipWithDmds f (Prod ds1) (Poly d2) = Prod [d1 `f` d2 | d1 <- ds1] zipWithDmds f (Poly d1) (Prod ds2) = Prod [d1 `f` d2 | d2 <- ds2] -zipWithDmds f (Prod ds1) (Prod ds2) = Prod (zipWithEqual "zipWithDmds" f ds1 ds2) +zipWithDmds f (Prod ds1) (Prod ds2) + | length ds1 == length ds2 = Prod (zipWithEqual "zipWithDmds" f ds1 ds2) + | otherwise = Poly topDmd + -- This really can happen with polymorphism + -- \f. case f x of (a,b) -> ... + -- case f y of (a,b,c) -> ... + -- Here the two demands on f are C(LL) and C(LLL)! topDmd, lazyDmd, seqDmd :: Demand topDmd = Top -- The most uninformative demand