Last active
August 29, 2015 14:19
-
-
Save philderbeast/fbf5279bc24d79534728 to your computer and use it in GitHub Desktop.
F# function arguments and parens style.
This file contains hidden or 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
// A difference of F# to C# is tupled versus curried function arguments. | |
// I suggest this F# function application style; | |
// * Separate functions from their arguments with a space. | |
// * Only use parens with tuples or when adding type annotations to curried args. | |
let f x = x | |
let add x y = x + y | |
let add' (x, y) = x + y | |
let y = f 1 // not f(1) | |
let five = add 2 3 // or with a redundant type annotation add (2 : int) 3 | |
let five' = add' (2, 3) // not add'(2, 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment