4

Why is this definition affected by the monomorphism restriction?

z = \n -> n  + 1 

and this isn't:

z n = n + 1
Will Ness
  • 69,019
  • 8
  • 93
  • 175
softshipper
  • 29,621
  • 43
  • 158
  • 325
  • you can find the answer in the canonical duplicate, under **"When does it happen?"**. Specifically, it says "When a pattern binding consists of only a variable name it's called a simple pattern binding.. **The monomorphism restriction applies to simple pattern bindings!**". As defined by the Haskell Report, referenced in that answer as well. – Will Ness Feb 21 '19 at 10:07
  • @WillNess Let's continue in the chat. How to provide a it? – softshipper Feb 21 '19 at 10:09
  • @WillNess anyway, thanks a lot for your help. – softshipper Feb 21 '19 at 10:10
  • 1
    @WillNess This sentence *The monomorphism restriction applies to simple pattern bindings!* makes it clear. – softshipper Feb 21 '19 at 10:14

0 Answers0