# Proposal: remove `n+k`

patterns from the language

## Pros

`n+k`

patterns are a non-orthogonal feature:
- no other datatype has this special notation
- it requires excessive knowledge of library functions: the desugaring includes references to
`Integral`

, `-`

and `>=`

.
- the symbol
`+`

is being abused in the syntax. It doesn't really mean `+`

, and if `+`

happens to be bound to something else that doesn't change the meaning of an `n+k`

pattern.

- the side-condition that
`n >= 0`

is ugly, `n`

is really a natural number
- something like ViewPatterns might offer a more general solution
- The report already admits "Many people feel that n+k patterns should not be used. These patterns may be removed or changed in future versions of Haskell." (Section 3.17.2)

## Cons

- it is a concise, natural, and familiar notation for recursion over naturals
- it allows recursive functions over naturals to be defined using non-overlapping patterns
- it would make a lot more sense if we had a natural number type, and restricted
`n+k`

patterns appropriately
- some Haskell books use it (this was the main reason it was kept in Haskell 98)

### Download in other formats: