A common practice in the C world to compare two fragmets of C is to see what assembly they generate. I wanted to know what code GHC would generate in the case of:
afmap :: Functor f => (a -> b -> c) -> f b -> a -> f c
afmap fn fb a' = (fn a') <$> fb
and
afmap = flip . (((.).(.)) fmap ($))
So I tried:
$ ghc -S test.hs -o test.S
Which (unsurprisingly) yielded more or less unreadable code.
What is the correct way (if any) to evaluate how ghc optimizes code?