No instance for (Num [a])
arising from the literal `3' at <interactive>:1:9
Possible fix: add an instance declaration for (Num [a])
In the expression: 3
In the first argument of `car', namely `[1, 2, 3]'
In the expression: car [1, 2, 3]
> car (x:_) = x
> car  = 
> and try to apply them to some list, such as
> car [1,2,3]
> I get this odd error:
> No instance for (Num [a])
> arising from the literal `3' ...
The error is really a bit cryptic (who cares, Nums or whatever...)
but the error is here. Your 'car' picks the first element, or the empty
LIST. So, the first element of the argument also must be a list, not
a number, otherwise the type-checker yells.
On Jan 13, 2008 2:07 PM, Tom Phoenix <[hidden email]> wrote:
> On Jan 13, 2008 7:55 AM, Fernando Rodriguez <[hidden email]> wrote:
> > If I define the follwoing functions:
> > car (x:_) = x
> > car  = 
> What's the type signature for that function?