Hi Igor, my understanding is that `where` has not been implemented and will not be implemented to 1) keep the syntax lean and 2) ensure a consistent coding style. I don't think Elm should have a `where` clause. Coming from Haskell and physics, I instinctively liked the `where` syntax better, but as soon as I got some experience with Elm, using let..in became natural. More in general, in my experience this kind of aesthetic preference comes largely from habit.
On Sunday, June 18, 2017 at 8:00:42 PM UTC+10, Igor Bukanov wrote: > > 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.
