14 Mar 2013 21:05
Where's the case? or The difference between simpl and prep
Tom Ellis <tom-lists-haskell-cafe-2013 <at> jaguarpaw.co.uk>
2013-03-14 20:05:11 GMT
2013-03-14 20:05:11 GMT
The -ddump-simpl output below doesn't contain a case corresponding to the seq in sum', but the -ddump-prep does. Isn't the output from simpl the input to prep? If so, where does the case reappear from? If not, how are simpl and prep related? It seems to have something to do with "Str=DmdType SS" but I don't understand. This seems to come from the IdInfo on the Id which is the binder "Test.sum'" but [1] says that this information is optional so it seems strange that such crucial information would be encoded there. Thanks, Tom [1] http://www.haskell.org/ghc/docs/7.6.2/html/libraries/ghc-7.6.2/IdInfo.html#t:IdInfo % cat Test.hs module Test where sum' :: [Integer] -> Integer -> Integer sum' [] n = n sum' (x:xs) n = n `seq` sum' xs (n + x) % ghc -fforce-recomp -ddump-simpl -O2 Test.hs [1 of 1] Compiling Test ( Test.hs, Test.o ) ==================== Tidy Core ==================== Result size = 14 Rec { Test.sum' [Occ=LoopBreaker](Continue reading)
RSS Feed