Created
January 8, 2015 17:17
-
-
Save seanparsons/2c8a7ecd3b84e3019bd3 to your computer and use it in GitHub Desktop.
Haskell partial application pondering.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- In this case it would be in theory be possible to create a single thunk for "ab" if pointless was partially applied as so: | |
-- pointless 1 2 | |
-- The resulting Int -> Int method would then only have to evaluate ab once because otherwise it never changes. | |
-- The obvious possibility this could cause would be caching very large intermediate representations that would otherwise be | |
-- garbage collected. | |
pointless :: Int -> Int -> Int -> Int | |
pointless a b c = | |
let ab = a + b | |
in ab + c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment