File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -482,7 +482,7 @@ object.map(f).map(g)
482
482
The reference implementation of [ Option] ( #option ) is a functor as it satisfies the rules:
483
483
484
484
``` js
485
- some (1 ).map (x => x) // = some (1)
485
+ Some (1 ).map (x => x) // = Some (1)
486
486
```
487
487
488
488
and
491
491
const f = x => x + 1
492
492
const g = x => x * 2
493
493
494
- some (1 ).map (x => g (f (x))) // = some (4)
495
- some (1 ).map (f).map (g) // = some (4)
494
+ Some (1 ).map (x => g (f (x))) // = Some (4)
495
+ Some (1 ).map (f).map (g) // = Some (4)
496
496
```
497
497
498
498
## Pointed Functor
@@ -736,11 +736,11 @@ Using [Option](#option):
736
736
// safeParseNum :: String -> Option Number
737
737
const safeParseNum = (b ) => {
738
738
const n = parseNumber (b)
739
- return isNaN (n) ? none () : some (n)
739
+ return isNaN (n) ? None () : Some (n)
740
740
}
741
741
742
742
// validatePositive :: Number -> Option Number
743
- const validatePositive = (a ) => a > 0 ? some (a) : none ()
743
+ const validatePositive = (a ) => a > 0 ? Some (a) : None ()
744
744
745
745
// kleisliCompose :: Monad M => ((b -> M c), (a -> M b)) -> a -> M c
746
746
const kleisliCompose = (g , f ) => (x ) => f (x).chain (g)
You can’t perform that action at this time.
0 commit comments