Open ianmackenzie opened 6 years ago
Have InputStream and OutputStream types that allow streaming I/O on files, standard in, standard out etc.
InputStream
OutputStream
Allow converting File values into corresponding streams:
File
File.toInputStream : File (Read p) -> InputStream File.toOutputStream : File (Write p) -> OutputStream
Add stdin and stdout to Context:
stdin
stdout
Context
type alias Context = { arguments : List String , ... , stdin : InputStream , stdout : OutputStream }
Have Stream module with various ways to read from/write to streams:
Stream
Stream.write : String -> OutputStream -> Script Stream.Error () Stream.read : InputStream -> Script Stream.Error String
Stream.read might need to be a bit more sophisticated to be able to cleanly detect when the end of the stream has been reached...
Stream.read
Perhaps simpler: expose stdin and stdout as File objects?
Have
InputStream
andOutputStream
types that allow streaming I/O on files, standard in, standard out etc.Allow converting
File
values into corresponding streams:Add
stdin
andstdout
toContext
:Have
Stream
module with various ways to read from/write to streams:Stream.read
might need to be a bit more sophisticated to be able to cleanly detect when the end of the stream has been reached...