Commit 57d657a8 authored by Simon Marlow's avatar Simon Marlow

Allow the quotes to be omitted in {-# SCC "<varid>" #-}

parent df43fcd5
......@@ -1394,6 +1394,7 @@ scc_annot :: { Located FastString }
: '_scc_' STRING {% (addWarning Opt_WarnWarningsDeprecations (getLoc $1) (text "_scc_ is deprecated; use an SCC pragma instead")) >>= \_ ->
( do scc <- getSCC $2; return $ LL scc ) }
| '{-# SCC' STRING '#-}' {% do scc <- getSCC $2; return $ LL scc }
| '{-# SCC' VARID '#-}' { LL (getVARID $2) }
hpc_annot :: { Located (FastString,(Int,Int),(Int,Int)) }
: '{-# GENERATED' STRING INTEGER ':' INTEGER '-' INTEGER ':' INTEGER '#-}'
......
......@@ -287,7 +287,12 @@ MAIN MAIN 102 0 0.0 0.0 100.0 100.0
<literal>&lt;expression&gt;</literal> is any Haskell
expression. An <literal>SCC</literal> annotation extends as
far to the right as possible when parsing. (SCC stands for "Set
Cost Centre").</para>
Cost Centre"). The double quotes can be omitted
if <literal>name</literal> is a Haskell identifier, for example:</para>
<programlisting>
{-# SCC my_function #-} &lt;expression&gt;
</programlisting>
<para>Here is an example of a program with a couple of SCCs:</para>
......@@ -295,10 +300,10 @@ MAIN MAIN 102 0 0.0 0.0 100.0 100.0
main :: IO ()
main = do let xs = [1..1000000]
let ys = [1..2000000]
print $ {-# SCC "last_xs" #-} last xs
print $ {-# SCC "last_init_xs" #-} last $ init xs
print $ {-# SCC "last_ys" #-} last ys
print $ {-# SCC "last_init_ys" #-}last $ init ys
print $ {-# SCC last_xs #-} last xs
print $ {-# SCC last_init_xs #-} last $ init xs
print $ {-# SCC last_ys #-} last ys
print $ {-# SCC last_init_ys #-}last $ init ys
</programlisting>
<para>which gives this profile when run:</para>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment