getLine package:text-rope

Get line with given 0-based index, O(1). The result does not contain \n characters.. Returns mempty if the line index is out of bounds.
>>> :set -XOverloadedStrings

>>> map (\l -> getLine l "fя𐀀\n☺bar\n\n") [0..3]
["fя𐀀","☺bar","",""]
Get a line by its 0-based index. Returns mempty if the index is out of bounds. The result doesn't contain \n characters.
>>> :set -XOverloadedStrings

>>> map (\l -> getLine l "foo\nbar\n😊😊\n\n") [0..3]
["foo","bar","😊😊",""]