On Friday, March 10, 2017 at 8:05:47 PM UTC, Jon Zeppieri wrote:
>
> This topic must have come up in the past, but I promise that I did look 
> before posting and only found limited information.
>
> Pattern-matching on records is limited to punning on the field name. That 
> is, you can have a pattern like `{a, b}`, which will bind `a` to the value 
> corresponding to the record's `a` label and `b` to the value... &c, &c. But 
> you can't write a more general pattern like `{a = <pat1>, b = <pat2>}`.
>
> Is there some aspect of the language that makes it impossible (or 
> difficult) to support these patterns? Or are they just not implemented, for 
> whatever reason?
>

They would not be impossible for the compile to implement.

func { a = SomeType field } = ...

Can expand to

func { a } = 
   let
     (SomeType field) = a
   in
     ...

demonstrating that is just syntax sugar.

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