Or-patterns as GHC extension
|Reported by:||BjornEdstrom||Owned by:|
|Keywords:||Cc:||vogt.adam@…, leon.p.smith@…, rwbarton, gershomb, sergv, zardoz|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
Or-patterns is a way of grouping together patterns that match to the same value. A construct like
fun 0 _ = E fun _ 0 = E
Could more concisely be written as, for example
fun 0 _ || _ 0 = E
As a concrete example why this is beautiful and how it could look, see Red-black trees in a functional setting, C. Okasaki .
I don't know enough about GHC internals to know the obvious way to implement this, but I would gladly give it a try given pointers in the right direction.