Skip to content

Instantly share code, notes, and snippets.

@spockz
Created March 24, 2010 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spockz/342178 to your computer and use it in GitHub Desktop.
Save spockz/342178 to your computer and use it in GitHub Desktop.
$> cat > foo.hs
{-# RULES "foo/Integer" foo = intFoo #-}
foo :: Num a => a -> a -> a
foo = (+)
intFoo = (-)
main = (putStrLn . show) ((foo (1::Integer) (1::Integer))::Integer)
$> ghc --make -O -ddump-rules -ddump-simpl-stats foo.hs
[1 of 1] Compiling Main ( foo.hs, foo.o )
==================== Transformation rules ====================
Local rules
"foo/Integer" ALWAYS
forall {$dNum :: Num Integer} foo @ Integer $dNum = intFoo
Imported rules
==================== Top-level specialisations ====================
==================== FloatOut stats: ====================
0 Lets floated to top level; 0 Lets floated elsewhere; from 0 Lambda groups
==================== FloatOut stats: ====================
1 Lets floated to top level; 0 Lets floated elsewhere; from 1 Lambda groups
==================== Grand total simplifier statistics ====================
Total ticks: 75
19 PreInlineUnconditionally
22 PostInlineUnconditionally
11 UnfoldingDone
2 LetFloatFromLet
16 BetaReduction
5 KnownBranch
10 SimplifierDone
Linking foo ...
.
$> ./foo
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment