Sortie Entier stdout en Haskell

J'ai une fonction simple comme:

nth :: Integer -> Integer

Et j'essaie d'imprimer le résultat comme suit:

main = do
    n <- getLine
    result <- nth (read n :: Integer)
    print result

L'erreur suivante est générée:

Couldn't match expected type `IO t0' with actual type `Integer'
In the return type of a call of `nth'
In a stmt of a 'do' expression:
    result <- nth (read n :: Integer)

Aussi essayé avec putStrLn et beaucoup d'autres combinaisons avec pas de chance.

Je ne peux pas la comprendre, et j'aurais besoin d'un peu d'aide, parce que je ne pas bien comprendre comment ça marche autour de ces IOs.

one-liner: main = print . nth . read =<< getLine

OriginalL'auteur Iulius Curt | 2012-04-21