Hi Fernando,
> final [] = [] - I consider that the end of an empty list is the empty list
> final [a] = a
> final (_:t) = final t
>
> Suddenly, the function stoped working with a rather cryptic (for a newbie
> at least) error message:
>
> *Temp> final [4,5]
>
> :1:9:
> No instance for (Nu
2008/7/21 Fernando Rodriguez <[EMAIL PROTECTED]>:
> Suddenly, the function stoped working with a rather cryptic (for a newbie at
> least) error message:
>
> *Temp> final [4,5]
>
> :1:9:
> No instance for (Num [a])
> arising from the literal `5' at :1:9
> Possible fix: add an instance declar
Hi Fernando,
I hope you don't mind, but I've moved this over to the Haskell-beginners
mailing list, where I think this kind of question will be more
appropriate.
In Haskell, it helps to think of functions in terms of an input and an
output, that is, what is the thing that is going into the functi
Fernando Rodriguez wrote:
Hi,
I defiend the following function to get the last element of a list:
final [a] = a
final (_:t) = final t
and it works as expected. Since I didn't want to have a non exhaustive
pattern, I added the following case:
final [] = [] - I consider that the end of an
Hi,
I defiend the following function to get the last element of a list:
final [a] = a
final (_:t) = final t
and it works as expected. Since I didn't want to have a non exhaustive pattern,
I added the following case:
final [] = [] - I consider that the end of an empty list is the empty lis