I am trying to figure out how to make haskell happy with the following equation:
f = either id (-1)
it complains:
No instance for (Num (Int -> Int))
arising from a use of syntactic negation
In the second argument of ‘either’, namely ‘(- 1)’
In the expression: either id (- 1)
In an equation for ‘f’: f = either id (- 1)
Do I have to resort to
f = either id (\x -> x-1)
or maybe there is a a type signature that will make it work?