Neverending getContents

I’m trying to associate a list of words and a list of numbers in a ‘do’ block, and it works… almost. The list don’t finish (the last bracket is missing!). Someone knows what’s happening?

main = do
putStrLn “Write text:”
text <- getContents
let wordList = words text
let duplaList = zip wordList [n | n<-[1…10]]
print duplaList

Hello Javier,
getContents returns all user input lazily. Use Ctrl-d to send an ␄ character or switch to getLine.
Does that help?

2 Likes

It works with getLine. Thank you very much.