ianmackenzie / ianmackenzie/elm-script

Add stream support

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Elm
Stars
34
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Have `InputStream` and `OutputStream` types that allow streaming I/O on files, standard in, standard out etc.

Allow converting `File` values into corresponding streams:

```elm
File.toInputStream : File (Read p) -> InputStream
File.toOutputStream : File (Write p) -> OutputStream
```

Add `stdin` and `stdout` to `Context`:

```elm
type alias Context =
{ arguments : List String
, ...
, stdin : InputStream
, stdout : OutputStream
}
```

Have `Stream` module with various ways to read from/write to streams:

```elm
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...

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.