[Haskell-beginners] foldr problem
Emanuel Koczwara
poczta at emanuelkoczwara.pl
Sun Mar 2 21:51:51 UTC 2014
Hi,
W dniu 02.03.2014 22:44, Roelof Wobben pisze:
> Hello,
>
> I now have to use foldr to find the max value in a list.
>
> So I do this:
>
> import Data.Char
>
> x = foldr max [5,10,2,8.1]
> -- Note that comments are preceded by two hyphens
> {- or enclosed
> in curly brace/hypens pairs. -}
> main = print x
>
> But now I see this error message:
> Active code from: 1: Haskell Basics
> main.hs at 7:8-7:13
> No instance for (Show ([[t0]] -> [t0])) arising from a use of
> `print' Possible fix: add an instance declaration for (Show ([[t0]] ->
> [t0])) In the expression: print x In an equation for `main': main =
> print x
>
> Active code from: 1: Haskell Basics Active code from: 1: Haskell Basics
Please look at foldr type and documentation. There is one argument
missing in your code.
Regards,
Emanuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140302/0c181039/attachment-0001.html>
More information about the Beginners
mailing list