def read_line.unended
import bend-stdio-pipes@0.2.0.0/impl.bend as Implimport Base
47# The line of a piece that ends with its LF: the piece without the LF, and the CR before it, if any.
48def read_line.unended(+piece: String) -> String:
49 +line = String.take(piece, Nat.sub(String.length(piece), 1n))
50 Bool.pick(
51 String,
52 String.ends_with(line, "\r"),
53 String.take(line, Nat.sub(String.length(line), 1n)),
54 line
55 )