3 ms·
> there is no reason why a programmer should need to concern themselves Agreed, hence my one liner version. > ghc will optimize away Haskell's flip Can you s
by fooker 1y ago
> there is no reason why a programmer should need to concern themselves
Agreed, hence my one liner version.
> ghc will optimize away Haskell's flip
Can you show me how? I am seeing 5000 lines of assembly.
https://godbolt.org/z/KqTq5Ez5n https://godbolt.org/z/KqTq5Ez5n
- hackyhacky 1y agoThe assembly is hard to understand. I recommend looking at the C-- intermediate output, using the -ddump-cmm flag, with -O2. The results in most of the functions getting inlined and flip is removed entirely. You can see this clearly if you use conspicuous numbers. If, instead of (flip foo 2 3), you give (flip foo 2 99), you will code like this: R3 = GHC.Types.[]_closure+1; R2 = 97; Sp = Sp - 16; call GHC.Show.$fShow(,)_itos'_info(R3, R2) args: 24, res: 0, upd: 24; 97 is calculated at compile time.