Skip to content

Instantly share code, notes, and snippets.

@maoe
Created December 11, 2016 10:50
Show Gist options
  • Save maoe/ac2a4e387226fa96acb83e23a798257c to your computer and use it in GitHub Desktop.
Save maoe/ac2a4e387226fa96acb83e23a798257c to your computer and use it in GitHub Desktop.
{-# OPTIONS_GHC -O -fforce-recomp -dshow-passes -dverbose-core2core #-}
module BetaReduce where
e :: Int
e = (\x -> x + 2) 1
{-
-- RHS size: {terms: 6, types: 1, coercions: 0}
e :: Int
[LclIdX, Str=DmdType]
e = + @ Int GHC.Num.$fNumInt (GHC.Types.I# 1#) (GHC.Types.I# 2#)
==>
-- RHS size: {terms: 2, types: 0, coercions: 0}
lvl_sJ5 :: Int
[LclId, Str=DmdType]
lvl_sJ5 = GHC.Types.I# 1#
-- RHS size: {terms: 2, types: 0, coercions: 0}
lvl_sJ6 :: Int
[LclId, Str=DmdType]
lvl_sJ6 = GHC.Types.I# 2#
-- RHS size: {terms: 3, types: 0, coercions: 0}
e :: Int
[LclIdX, Str=DmdType]
e = GHC.Num.$fNumInt_$c+ lvl_sJ5 lvl_sJ6
==>
-- RHS size: {terms: 2, types: 0, coercions: 0}
e :: Int
[LclIdX,
Str=DmdType,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
e = GHC.Types.I# 3#
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment