File tree Expand file tree Collapse file tree 4 files changed +8
-11
lines changed
Expand file tree Collapse file tree 4 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ A function which handles input from the user.
3434#### ` setLineHandler `
3535
3636``` purescript
37- setLineHandler :: forall eff a. LineHandler eff a -> Interface -> Eff (console :: CONSOLE | eff) Interface
37+ setLineHandler :: forall eff a. Interface -> LineHandler eff a -> Eff (console :: CONSOLE | eff) Interface
3838```
3939
4040Set the current line handler function.
Original file line number Diff line number Diff line change 33
44// module Node.ReadLine
55
6- exports . setLineHandler = function ( callback ) {
7- return function ( readline ) {
6+ exports . setLineHandler = function ( readline ) {
7+ return function ( callback ) {
88 return function ( ) {
99 readline . removeAllListeners ( 'line' ) ;
1010 readline . on ( 'line' , function ( line ) {
@@ -45,4 +45,4 @@ exports.createInterface = function(completer) {
4545 }
4646 } ) ;
4747 } ;
48- } ;
48+ } ;
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ type Completer eff = String -> Eff (console :: CONSOLE | eff) { completions :: A
2222type LineHandler eff a = String -> Eff (console :: CONSOLE | eff ) a
2323
2424-- | Set the current line handler function.
25- foreign import setLineHandler :: forall eff a . LineHandler eff a -> Interface -> Eff (console :: CONSOLE | eff ) Interface
25+ foreign import setLineHandler :: forall eff a . Interface -> LineHandler eff a -> Eff (console :: CONSOLE | eff ) Interface
2626
2727-- | Prompt the user for input on the specified `Interface`.
2828foreign import prompt :: forall eff . Interface -> Eff (console :: CONSOLE | eff ) Interface
Original file line number Diff line number Diff line change @@ -10,11 +10,8 @@ import Node.ReadLine
1010main = do
1111 interface <- createInterface noCompletion
1212
13- let
14- lineHandler s = do
15- log $ " You typed: " ++ s
16- prompt interface
17-
1813 setPrompt " > " 2 interface
1914 prompt interface
20- setLineHandler lineHandler interface
15+ setLineHandler interface $ \s -> do
16+ log $ " You typed: " ++ s
17+ prompt interface
You can’t perform that action at this time.
0 commit comments