Hello,

past discussions about adding the where clause to Elm typically suggested to 
use it as syntax sugar for the let. 

As far understand, this is how things are done in Haskell. Moreover, using the 
where is very natural there as syntax order follows the lazy evaluation 
strategy making it easier to reason about things.

This does not work for Elm as the language is strict. Yet strictness is only 
relevant for expressions, not function definitions. So perhaps restricting the 
where only for local function definitions similarly to Idris (strict language) 
may work for Elm?

Compare:

let triple x = x * x * x
in
    List.map triple listOfInts

versus

List.map triple listOfInts
where
    triple x = x * x * x

For me the let version looks uglier as the syntax order is reverse of the 
evaluation.

For this reason I have noticed that I do not like to move complex lambdas into 
local functions. Rather I wait until they become even more complex. Then I make 
them top-level functions defined *after* the function that uses them.
    
    

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to