File tree Expand file tree Collapse file tree 2 files changed +2
-16
lines changed
Expand file tree Collapse file tree 2 files changed +2
-16
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,5 @@ const compoundExpression = map(
4949
5050const expression: Parser <number > = oneOf ([compoundExpression , number ])
5151
52- const evaluate = (input : string ) =>
53- either .flatMap (expression (input ), ({ remainingInput , output }) =>
54- remainingInput .length !== 0
55- ? either .makeLeft (' excess content followed valid input' )
56- : either .makeRight (output ),
57- )
58-
59- console .log (evaluate (' 2+2-1' ).value ) // logs "3"
52+ console .log (parse (expression , ' 2+2-1' ).value ) // logs "3"
6053```
Original file line number Diff line number Diff line change @@ -200,14 +200,7 @@ test('README example', _ => {
200200
201201 const expression : Parser < number > = oneOf ( [ compoundExpression , number ] )
202202
203- const evaluate = ( input : string ) =>
204- either . flatMap ( expression ( input ) , ( { remainingInput, output } ) =>
205- remainingInput . length !== 0
206- ? either . makeLeft ( 'excess content followed valid input' )
207- : either . makeRight ( output ) ,
208- )
209-
210- assertRight ( evaluate ( '2+2-1' ) , 3 )
203+ assertRight ( parse ( expression , '2+2-1' ) , 3 )
211204} )
212205
213206const longInputLength = 10000
You can’t perform that action at this time.
0 commit comments