Simple IO Monad problem

kuq32tr02 at sneakemail.com kuq32tr02 at sneakemail.com
Fri Sep 12 23:08:30 EDT 2003


Hello,

I'm starting to use Haskell for writing actual programs using monads and I'm already lost.

I have the following script:

#!/usr/bin/runhugs
                                                                                
> module Main where
> import System(getArgs)
> main = do putStr "Hello, World\n"
>           strs <- getArgs
>           map putStrLn strs


Which gives the following error:

runhugs: Error occurred
Reading file "./mailalias.lhs":
Reading file "/usr/lib/hugs/lib/System.hs":
Reading file "./mailalias.lhs":
Type checking
ERROR "./mailalias.lhs":5 - Type error in final generator
*** Term           : map putStrLn strs
*** Type           : [IO ()]
*** Does not match : IO a

Can someone please explain what I'm doing wrong?

Thanks!


More information about the Haskell-Cafe mailing list