Hi everybody,
There is something I do not understand in the way typeclass constraints are
inferred.
1/ Take the following function definition:
sum' [] = []
sum' (x:xs) = x + sum' xs
GHCI correctly gives:
:t sum'
sum' :: Num [a] = [[a]] - [a]
So it has inferred that the type list has to
Hi TP,
The difference is that in your second example, you have specified the
type signature
p :: a - ExpQ
so GHC checks whether p has this type, and correctly objects that it
doesn't. If you leave off the type signature, as you did for sum', the
right thing will be inferred.
Hope this helps,
On 23 August 2013 19:23, TP paratribulati...@free.fr wrote:
Hi everybody,
There is something I do not understand in the way typeclass constraints are
inferred.
1/ Take the following function definition:
sum' [] = []
sum' (x:xs) = x + sum' xs
You haven't specified a type signature here,
Adam Gundry wrote:
If you leave off the type signature, as you did for sum', the
right thing will be inferred.
Thanks Adam and Ivan. Very stupid question...
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org