-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Functions defined in let bindings #61
Comments
I don't agree that this is an absolute. We have a few instances where there is a generic top level function and some othe functions calls this multiple times with only one differing argument. We then create a local alias that encapsulates the call along with the common arguments used in that function. |
But I can always switch that check off. |
I think there should be a distinction between curried function that become new functions and actually defining new functions.
|
I believe both are OK as that might make sense for code readability or if the function "alias" is used more than once.
… Am 19. Mäz. 2017 um 15:01 schrieb Mats Stijlaart ***@***.***>:
I think there should be a distinction between curried function that become new functions and actually defining new functions.
In the following example I believe you do not want bar but foo is ok even though they are semantically equivalent.
foo x =
let
listModifier = List.map ((+) 1)
in
listModifier x
bar x =
let
incrementList y = List.map ((+) 1) y
in
incrementList x
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This check will be disabled by default for now. |
let
are commonly used to hold intermediate values that are used (multiple times) in other expressions in thelet
binding.There is no reason to have functions in there, extracting these to top-levels would be a better choice. Encapsulation can be achieved by not exposing that extracted function or by creating a whole new module.
The text was updated successfully, but these errors were encountered: