purescript-deprecated/purescript-node-streams-aff

readLine

Closed this issue · 1 comments

readLine :: forall m r. MonadAff m => Readable r -> m { buffers :: Array Buffer, readagain :: Boolean }

Could we use https://nodejs.org/api/readline.html ?

Instances of the InterfaceConstructor class are constructed using the readlinePromises.createInterface() or readline.createInterface() method. Every instance is associated with a single input Readable stream and a single output Writable stream. The output stream is used to print prompts for user input that arrives on, and is read from, the input stream.

The problem with this is that it requires a Writable stream “used to print prompts”? That seems stupid and I don’t want to require a Writable stream in our API.

If the InterfaceConstructor was created with output set to null or undefined the prompt is not written.

Ok so maybe we just readline.createInterface with a null Writable every time the readLine function is called, handle the 'line' event, and then destroy the interface when the readLine function completes.

Closing as this repo is deprecated.