Haskell like where
clause for f-script functions
#2032
siddhantk232
started this conversation in
Ideas & RFCs
Replies: 1 comment
-
From @amitu:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A haskell function that uses
where
clause:Things to note:
Haskell function body can only have a single expression
Haskell also has a
let ... in
construct. The above code usinglet ... in
would look like:This allows haskell programmers to organize their code that favors readability. If the function body derivation depends on something that should be important to the reader then
let ... in
is used. Otherwise,where
clause is used to grab the reader's attention immediately to the function body.We don't need
let ... in
syntax becausef-script
functions allow multiple expressions and one of which is variable definition:What about
where
? Let's try to fit it in:Where else can we use
where
?Beta Was this translation helpful? Give feedback.
All reactions