[Haskell-cafe] Prolog-style patterns
Yuras Shumovich
shumovichy at gmail.com
Tue Apr 9 02:07:46 CEST 2013
Hi,
On Mon, 2013-04-08 at 07:06 -0700, Conal Elliott wrote:
> What you're suggesting is called "non-linear patterns", and it's a
> perfectly sensible, well-defined feature in a language with
> pattern-matching. As you point out, non-linearity allows for more direct &
> succinct programming. I've often wished for this feature when writing
> optimizations on data types, especially for syntactic types (languages).
AFAIK pattern-match overlap checking is well defined for linear
patterns, but it is not fully implemented and buggy in ghc (I found ~10
open tickets, most of them are pretty old).
Will not it be a nightmare to implement and maintain checker for
overlapping/unused clauses for non-linear patterns?
We already have a number of language extensions without good warnings
(and even worse -- with incorrect warnings): view patterns, overloaded
literals, GADTs, etc.
Thanks,
Yuras
More information about the Haskell-Cafe
mailing list