From 960e91a810d2a972716d9fb26e53622215f9bc4e Mon Sep 17 00:00:00 2001 From: Nate Young Date: Tue, 9 Jan 2024 11:27:18 -0600 Subject: [PATCH 1/3] call mkEffectFn1 on cb to question --- src/Node/ReadLine.purs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Node/ReadLine.purs b/src/Node/ReadLine.purs index d08b1c9..563a415 100644 --- a/src/Node/ReadLine.purs +++ b/src/Node/ReadLine.purs @@ -316,9 +316,9 @@ foreign import promptOptsImpl :: EffectFn2 (Boolean) (Interface) (Unit) -- | -- | The callback function passed to `rl.question()` does not follow the typical pattern of accepting an Error object or null as the first argument. The callback is called with the provided answer as the only argument. question :: String -> (String -> Effect Unit) -> Interface -> Effect Unit -question text cb iface = runEffectFn3 questionImpl iface text cb +question text cb iface = runEffectFn3 questionImpl iface text $ mkEffectFn1 cb -foreign import questionImpl :: EffectFn3 (Interface) (String) ((String -> Effect Unit)) Unit +foreign import questionImpl :: EffectFn3 (Interface) (String) (EffectFn1 String Unit) Unit -- | Writes a query to the output, waits -- | for user input to be provided on input, then invokes @@ -338,9 +338,9 @@ foreign import questionImpl :: EffectFn3 (Interface) (String) ((String -> Effect -- | -- | The callback function passed to `rl.question()` does not follow the typical pattern of accepting an Error object or null as the first argument. The callback is called with the provided answer as the only argument. question' :: String -> { signal :: AbortSignal } -> (String -> Effect Unit) -> Interface -> Effect Unit -question' text opts cb iface = runEffectFn4 questionOptsCbImpl iface text opts cb +question' text opts cb iface = runEffectFn4 questionOptsCbImpl iface text opts $ mkEffectFn1 cb -foreign import questionOptsCbImpl :: EffectFn4 (Interface) (String) { signal :: AbortSignal } ((String -> Effect Unit)) Unit +foreign import questionOptsCbImpl :: EffectFn4 (Interface) (String) { signal :: AbortSignal } (EffectFn1 String Unit) Unit -- | The rl.resume() method resumes the input stream if it has been paused. resume :: Interface -> Effect Unit From 184e254031967aeed4fe7b9349deec34d20e7ac5 Mon Sep 17 00:00:00 2001 From: Nate Young Date: Tue, 9 Jan 2024 11:28:08 -0600 Subject: [PATCH 2/3] typo --- src/Node/ReadLine.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Node/ReadLine.js b/src/Node/ReadLine.js index 722a1d9..347ba63 100644 --- a/src/Node/ReadLine.js +++ b/src/Node/ReadLine.js @@ -14,7 +14,7 @@ export const createInterfaceImpl = (options) => readline.createInterface({ historySize: options.historySize, removeHistoryDuplicates: options.removeHistoryDuplicates, prompt: options.prompt, - crlDelay: options.crlDelay, + crlfDelay: options.crlfDelay, escapeCodeTimeout: options.escapeCodeTimeout, tabSize: options.tabSize, signal: options.signal From d02c1da5f318f11936a9b6b325914b97d36102d8 Mon Sep 17 00:00:00 2001 From: Nate Young Date: Tue, 9 Jan 2024 11:37:29 -0600 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 739b64e..9881cd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ Breaking changes: New features: Bugfixes: +- Ensure that callbacks passed to `question` and `question'` are invoked +- Fixed typo in options passed to `readline.createInterface` Other improvements: