diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index de15f1cf2f8203a67fbf6413bd951f38db6c14d5..c07714d0a1b1dc281e4275e32cc24ad46f926ba9 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -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 '#-}' diff --git a/docs/users_guide/profiling.xml b/docs/users_guide/profiling.xml index 0cf2e0e59f0b89a98404add3d702bf61c7f00149..a5a1d4911c82b7a081b5960c22dbd59c399c41b6 100644 --- a/docs/users_guide/profiling.xml +++ b/docs/users_guide/profiling.xml @@ -287,7 +287,12 @@ MAIN MAIN 102 0 0.0 0.0 100.0 100.0 <literal><expression></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 #-} <expression> +</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>