Interpreting the strictness annotations output by ghc --show-iface
Edward Z. Yang
ezyang at MIT.EDU
Thu Mar 8 05:35:30 CET 2012
This is the important bit of code in the file:
instance Outputable Demand where
ppr Top = char 'T'
ppr Abs = char 'A'
ppr Bot = char 'B'
ppr (Defer ds) = char 'D' <> ppr ds
ppr (Eval ds) = char 'U' <> ppr ds
ppr (Box (Eval ds)) = char 'S' <> ppr ds
ppr (Box Abs) = char 'L'
ppr (Box Bot) = char 'X'
ppr d@(Box _) = pprPanic "ppr: Bad boxed demand" (ppr d)
ppr (Call d) = char 'C' <> parens (ppr d)
instance Outputable Demands where
ppr (Poly Abs) = empty
ppr (Poly d) = parens (ppr d <> char '*')
ppr (Prod ds) = parens (hcat (map ppr ds))
You do need to be able to read the pretty printing combinators. Here's a quick
cheat sheet; check http://hackage.haskell.org/packages/archive/pretty/188.8.131.52/doc/html/Text-PrettyPrint-HughesPJ.html
the basic idea.
char ==> print a single character
<> ==> concatenate without adding a space
parens x ==> put parentheses around x
hcat ==> concatenate a list without adding a space
Excerpts from Johan Tibell's message of Wed Mar 07 18:41:42 -0500 2012:
> Edward, I have looked at that file before and it didn't make me much
> wiser, because I cannot map it to the output.
> I find it's the parenthesis that confuses me the most. What does this mean?
> what about this?
> -- Johan
More information about the Glasgow-haskell-users