def read_line.peeked
import bend-stdio-pipes@0.2.0.0/impl.bend as Implimport Base
33# A line with no LF that ends the input is the last line; one that does not is too long.
34def read_line.peeked(
35 next: File & Result<&1, &1, U32 & String, String>,
36 text: String
37) -> File
38 & Result<&1, &1, U32 & String, Maybe<String>>:
39 match next:
40 case (file, Fail{error}):
41 (file, Fail{error})
42 case (file, Done{SNil{}}):
43 (file, Done{Some{text}})
44 case (file, Done{SCon{_, _}}):
45 (file, Fail{(7, "a line is longer than its cap")})