[Haskell-cafe] MultiCase alternative
Richard A. O'Keefe
ok at cs.otago.ac.nz
Sun Jun 18 22:52:50 UTC 2017
> On 16/06/2017, at 10:15 PM, Brandon Allbery <allbery.b at gmail.com> wrote:
> On Fri, Jun 16, 2017 at 6:12 AM, Baa <aquagnu at gmail.com> wrote:
> Sure, but there is another point of view here. Alternative is to have
> flexible but elegant syntax embedded in language, instead of many-many
> extensions for any possibility - they "fragment" language. But of course
> this is controversial and ambiguous :-)
> The active patterns of F# that you mentioned can be seen as a counterargument
There's an interesting irony here.
I'm reading the paper "Extensible Pattern Matching via a Lightweight
Language Extension" by Syme, Neverov, and Margetson. The authors
propose active patterns as a way of allowing functional code to work
with objects using pattern matching.
The irony is that doing this clearly violates the Object-Oriented
Programming principle "Tell, Don't Ask". That is, according to
the OOP gurus, if you have some sort of if or case that classifies
an object in some way, you are doing it wrong. That variant-
dependent behaviour belongs in the object.
I'm agnostic about most OO dogma, so don't take this as my claim.
More information about the Haskell-Cafe