It’s how they are implemented in Haskell, and people asking for where in
Elm typically do so by saying “we want where like in Haskell”. One could
probably come up with new parsing rules that allow where to be used
anywhere in an expression, thus also for example for local bindings inside
a lambda-abstraction. But that would require new design work to make sure
everything fits together and the syntax remains unambigous and usable. That
probably presents an even bigger hurdle for acceptance into Elm than “just”
wanting to get Haskell-style where in.
​

2017-01-02 5:57 GMT+01:00 David Andrews <[email protected]>:

> Is there something fundamental about `where` clauses which would prevent
> them from parsing as expressions, or is this an artifact of how they are
> implemented in Haskell?
>
> On Sun, Jan 1, 2017 at 9:21 PM Janis Voigtländer <
> [email protected]> wrote:
>
>>
>>
>> Janis, the following compiles for me: …
>>
>>
>>
>> Right, where does not work for expressions, but for right-hand sides, of
>> which pattern match branches are an instance.
>>
>>
>> The next question would be, still under the assumption that a choice has
>> to be made between where and let because both won’t be made available at
>> the same time, how well “where-only” would work if in addition one wants
>> to have a local binding that spans all pattern match branches, i.e.,
>> something one would currently write in Elm like so:
>>
>>
>> f tree =
>>
>>   let
>>
>>     a = ... something ...
>>
>>   in
>>
>>     case tree of
>>
>>       Leaf x -> let b = ... in ... using a and b ...
>>
>>       Node s t -> let c = ... in ... using a and c ...
>>
>>
>>
>> ​
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>
>> 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.
>>
>>
>> --
> 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.
>

-- 
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