In GHCi:
- Prelude> (+3) 2
5- Prelude> (*3) 2
6- Prelude> (/3) 2
0.6666666666666666- Prelude> (-3) 2
No instance for (Num (t -> t1))
arising from the literal3' at <interactive>:1:2
it': it = (- 3) 2
Possible fix: add an instance declaration for (Num (t -> t1))
In the expression: 3
In the expression: (- 3) 2
In the definition of
How can I correct the last one to make it return -1?
Haskell's grammar doesn't allow you to use -
like that. Use the subtract
function instead:
(subtract 3) 2