Output Integer to stdout in Haskell

haskell, io

Solution

`nth` is a function, not an `IO` action:

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

Problem

I have a simple function like: ``` nth :: Integer -> Integer ``` And I try to print it's result as follows: ``` main = do n <- getLine result <- nth (read n :: Integer) print result ``` The following error is generated: ``` 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) ``` Also tried with `putStrLn` and a lot of other combinations with no luck. I can't figure it out and I would need some help, being that I don't fully understand how stuff works around these `IO`s.

Original source