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@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
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
![]() |
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus actief is. |