haskell parse error in pattern for n+k pattern

后端 未结 2 611
后悔当初
后悔当初 2021-02-07 07:11

I have started working my way through Erik Meijer\'s 13-part lectures (and Graham Hutton\'s slides) to learn Haskell.

On the slides for Chapter 4, on page 13, it intro

2条回答
  •  感情败类
    2021-02-07 07:49

    Am I not understanding how n+k patterns are intended to be used?

    Actually, nowadays n+k patterns are considered bad practice. The main reason for this is that the syntax doesn't really look like anything else in Haskell, the + part isn't really using the + that is in scope, unlike say how the do notation works. Also, the viewpatterns extension is kind of a generalization that is useful in many more settings.

    There is more info here on why it was removed.

提交回复
热议问题