File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,18 @@ exports.prompt = function (readline) {
3131 } ;
3232} ;
3333
34+ exports . question = function ( text ) {
35+ return function ( callback ) {
36+ return function ( readline ) {
37+ return function ( ) {
38+ readline . question ( text , function ( result ) {
39+ callback ( result ) ( ) ;
40+ } ) ;
41+ } ;
42+ } ;
43+ } ;
44+ } ;
45+
3446exports . setPrompt = function ( prompt ) {
3547 return function ( length ) {
3648 return function ( readline ) {
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ module Node.ReadLine
1717 , setPrompt
1818 , setLineHandler
1919 , close
20+ , question
2021 ) where
2122
2223import Prelude
@@ -100,6 +101,16 @@ foreign import prompt
100101 . Interface
101102 -> Eff (readline :: READLINE | eff ) Unit
102103
104+ -- | Writes a query to the output, waits
105+ -- | for user input to be provided on input, then invokes
106+ -- | the callback function
107+ foreign import question
108+ :: forall eff
109+ . String
110+ -> (String -> Eff (readline :: READLINE | eff ) Unit )
111+ -> Interface
112+ -> Eff (readline :: READLINE | eff ) Unit
113+
103114-- | Set the prompt.
104115foreign import setPrompt
105116 :: forall eff
You can’t perform that action at this time.
0 commit comments