0

I am trying to write a function that decrements by one -- something like what I would expect (-1) to do as a partially applied infix with specified subtrahend. However, written that way ghc appears to read the - not as a subtraction operator but as a negation.

> :t (-1)
(-1) :: Num a => a

How can I concisely write a decrement operator?

mherzl
  • 5,624
  • 6
  • 34
  • 75

1 Answers1

1

You'd use subtract, which exists specifically for this purpose:

subtract 1
melpomene
  • 84,125
  • 8
  • 85
  • 148