[Proposal] add view function for NPlusKPatterns

David Luposchainsky dluposchainsky at googlemail.com
Mon Sep 30 14:56:27 UTC 2013

On 2013-09-30 16:37, Stijn van Drongelen wrote:
> I'm working on a desugaring library for Haskell. Desugaring
> NPlusKPatterns currently takes up the most code, since a proper
> translation involves generating two guards. Meanwhile, most other
> pattern-related language extensions are defined in terms of
> ViewPatterns, which are trivial to desugar.
> In my laziness to fix this otherwise, I propose that the following
> function is added to the Prelude: [...]

1. Adding things to the Prelude is not something you can or should do
easily. Adding means it has to become part of the Haskell report (i.e.
Haskell the language), and removing it takes great effort because many
modules may depend on it.

2. If things *are* added to the current Prelude, they should be widely
used, universally accepted, and very useful. I don't think your
functionality matches any of these.

3. n+k-patterns are not part of the Haskell 2010 standard; if you really
need them for compatibility reasons or so, there's a legacy language
extension. Using these patterns is universally (?) disencouraged.

4. "My laziness" and golfing are not very good bases for a proposal.


More information about the Libraries mailing list