So I'm really new to Haskell, but I was playing around with the point free notation and came across this issue. I'm in the console:
> let c = (.)negate
> :t c
> (a -> Integer) -> a -> Integer -> a
but negate takes a Number, so why is it being constrained to an Integer type?
This is another case of the extended defaulting rules in GHCi. Do :set -XNoMonomorphismRestriction
or just do
> :set +m -- multiline input in GHCi
> let c :: (Num a) => (b -> a) -> b -> a -> b
| c = (.) negate
|
> :t c
Num a => (b -> a) -> b -> a -> b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With