[Haskell-cafe] newbie help
tomasz.zielonka at gmail.com
Fri Nov 4 02:52:16 EST 2005
On 11/4/05, Abhijit Ray <avizit at gmail.com> wrote:
> I wrote the following program and it dint compile.
> what's wrong with it
> module Main
> import IO
> main = do
> hSetBuffering stdin LineBuffering
> let testList = makeList
> let sum = foldr (+) 0 testList
> putStrLn "Sum is " ++ show(sum)
testList <- makeList
sum <- liftM (foldr (+) 0) testList
You probably want the former form.
BTW, there is a sum function in Haskell prelude.
More information about the Haskell-Cafe