That is an unnecessary use of unsafeInterleaveIO. The solution is actually quite simple: getLines n = replicateM n getLine