@Janis, I suppose the `where` version of that formation would have to be:
f tree = work
where a = ...
work = case tree of
Leaf x -> -- using a and b
where b = ...
Node s t -> -- using a c
where c = ...
On Sunday, 1 January 2017 12:21:47 UTC-8, Janis Voigtländer 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.