From: simonpj Date: Tue, 24 Jul 2001 09:53:27 +0000 (+0000) Subject: [project @ 2001-07-24 09:53:27 by simonpj] X-Git-Tag: Approximately_9120_patches~1435 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=198ee273db2c8ff68874a7af139f0a2a56a812e8;p=ghc-hetmet.git [project @ 2001-07-24 09:53:27 by simonpj] Keep the printed stuff for Demand and DmdResult separate, else we can get confused when parsing a strictness signature. For example, previously LX could have been parsed as L -> X or as LX -> T Urk! I've taken the simple path of making DmdResults print in lower case. Thus Lx means L -> x LX means LX -> t --- diff --git a/ghc/compiler/basicTypes/NewDemand.lhs b/ghc/compiler/basicTypes/NewDemand.lhs index 94d4aa2..0dcb69a 100644 --- a/ghc/compiler/basicTypes/NewDemand.lhs +++ b/ghc/compiler/basicTypes/NewDemand.lhs @@ -71,9 +71,10 @@ instance Outputable DmdType where pp_elt (uniq, dmd) = ppr uniq <> text "->" <> ppr dmd instance Outputable DmdResult where - ppr TopRes = empty - ppr RetCPR = char 'M' - ppr BotRes = char 'X' + ppr TopRes = empty -- Keep these distinct from Demand letters + ppr RetCPR = char 'm' -- so that we can print strictness sigs as + ppr BotRes = char 'b' -- dddr + -- without ambiguity emptyDmdEnv = emptyVarEnv topDmdType = DmdType emptyDmdEnv [] TopRes diff --git a/ghc/compiler/parser/Lex.lhs b/ghc/compiler/parser/Lex.lhs index fba97ed..5e82b53 100644 --- a/ghc/compiler/parser/Lex.lhs +++ b/ghc/compiler/parser/Lex.lhs @@ -819,12 +819,11 @@ silly_escape_chars = [ lex_demand cont buf = case read_em [] buf of { (ls,buf') -> case currentChar# buf' of - 'X'# -> cont (ITstrict (StrictSig (mkTopDmdType ls BotRes))) (incLexeme buf') - 'M'# -> cont (ITstrict (StrictSig (mkTopDmdType ls RetCPR))) (incLexeme buf') + 'b'# -> cont (ITstrict (StrictSig (mkTopDmdType ls BotRes))) (incLexeme buf') + 'm'# -> cont (ITstrict (StrictSig (mkTopDmdType ls RetCPR))) (incLexeme buf') _ -> cont (ITstrict (StrictSig (mkTopDmdType ls TopRes))) buf' } where - -- code snatched from Demand.lhs read_em acc buf = case currentChar# buf of 'L'# -> read_em (Lazy : acc) (stepOn buf)