File tree 4 files changed +8
-11
lines changed
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.
34
34
#### ` setLineHandler `
35
35
36
36
``` 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
38
38
```
39
39
40
40
Set the current line handler function.
Original file line number Diff line number Diff line change 3
3
4
4
// module Node.ReadLine
5
5
6
- exports . setLineHandler = function ( callback ) {
7
- return function ( readline ) {
6
+ exports . setLineHandler = function ( readline ) {
7
+ return function ( callback ) {
8
8
return function ( ) {
9
9
readline . removeAllListeners ( 'line' ) ;
10
10
readline . on ( 'line' , function ( line ) {
@@ -45,4 +45,4 @@ exports.createInterface = function(completer) {
45
45
}
46
46
} ) ;
47
47
} ;
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
22
22
type LineHandler eff a = String -> Eff (console :: CONSOLE | eff ) a
23
23
24
24
-- | 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
26
26
27
27
-- | Prompt the user for input on the specified `Interface`.
28
28
foreign 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
10
10
main = do
11
11
interface <- createInterface noCompletion
12
12
13
- let
14
- lineHandler s = do
15
- log $ " You typed: " ++ s
16
- prompt interface
17
-
18
13
setPrompt " > " 2 interface
19
14
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