I'd like to add another effect to basic-cli similar to https://doc.rust-lang.org/std/io/trait.Read.html#method.read_to_end
Basically, read all the bytes into a List U8 until we see an EOF. This is useful for AoC.
Stdin.readToEnd : Task (List U8) [StdinErr _]
# purity inference
Stdin.readToEnd : {} => Result (List U8) [StdinErr _]
Stdin.readToEnd : Task (List U8) [StdinErr _]
Are there other end conditions we'd want to support? I wonder if this could ergonomically support the Enter key, etc (eh maybe that duplicates Stdin.line)
Maybe Stdin.readToEnd : [EOF, EOL, TAB, IDK] => Result (List U8) [StdinErr _]
Or Stdin.readToEnd : [OfFile, OfLine, UntilTab, OfIdk] => Result (List U8) [StdinErr _]
Semi related: Do we want a File.readLines function? It seems intentionally non-existent, but I don't think of it as a footgun vs needing to walk File.readLine or split File.readBytes/File.readUtf8 on newlines or pipe the file to this new Stdin function.
Generally with stdin, you will only get granularity if 1 line at a time. So if you do something like UntilTab, it may feel very bugged. You press tab, but not get any data until an Eof, new line, or you type enough characters to force a buffer flush.
So line and file are really the only two safe methods that won't confuse users
Last updated: Jun 16 2026 at 16:19 UTC