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
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
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)