Почему не работает `putStrLn getLine`?

Я новичок в Haskell. Мой сценарий Haskell с GHCi ,

Prelude> let a = putStrLn getLine

выдает такую ​​ошибку.

<interactive>:1:17:
    Couldn't match expected type `String'
           against inferred type `IO String'
    In the first argument of `putStrLn', namely `getLine'
    In the expression: putStrLn getLine
    In the definition of `a': a = putStrLn getLine
Prelude> 

Почему не работает и как я могу напечатать что-то, введенное из stdin ?

7
задан Eonil 13 August 2013 в 14:12
поделиться