http://kurilka.livejournal.com/ ([identity profile] kurilka.livejournal.com) wrote in [personal profile] deniok 2015-10-03 11:35 am (UTC)

Интересно, что эту WHNF GHC тупо выкидывает (что логично т.к. мы её не используем):
qrilka@qdesktop ~ $ ghc -ddump-simpl seq.hs
[1 of 1] Compiling Main             ( seq.hs, seq.o )

==================== Tidy Core ====================
Result size of Tidy Core = {terms: 7, types: 6, coercions: 0}

main :: IO ()
[GblId, Str=DmdType]
main = print @ Integer GHC.Show.$fShowInteger (__integer 5)

:Main.main :: IO ()
[GblId, Str=DmdType]
:Main.main = GHC.TopHandler.runMainIO @ () main

Linking seq ...
qrilka@qdesktop ~ $ cat seq.hs
main = print $ (\True y -> ()) False `seq` 5

Или есть вариант, когда такая конструкция будет иметь смысл в реальной жизни?

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting