GHC Core simplifier question: turn off all passes?

Christopher Done chrisdone at
Fri Apr 7 12:55:22 UTC 2017

Hi all,

Just checking, if I want to see the Haskell code desugared to core
BEFORE any simplification passes, is this the way to do it?

bash-3.2$ cat > X.hs
module X where it = (\x -> x * 2) 123
bash-3.2$ stack exec -- ghc -ddump-simpl X.hs -fforce-recomp
-fmax-simplifier-iterations=0 -O0
[1 of 1] Compiling X                ( X.hs, X.o )

==================== Tidy Core ====================
Result size of Tidy Core = {terms: 11, types: 3, coercions: 0}

-- RHS size: {terms: 4, types: 1, coercions: 0}
it :: Integer
[GblId, Str=DmdType]
it = * @ Integer GHC.Num.$fNumInteger 123 2

I was a bit surprised that the lambda is collapsed already with
optimizations turned off and the simplifier iterations set to 0. I
changed this to (\x -> x * x) and it produced a let instead. Is this
just one of the things the HS->Core desugarer decides to do?


More information about the ghc-devs mailing list