Skip to content

Commit

Permalink
Merge pull request #244 from jsoref/fix-readme-jargon
Browse files Browse the repository at this point in the history
Fix case of Some and None
  • Loading branch information
hemanth authored Jul 17, 2023
2 parents ce4cc3e + cb44743 commit 08a48ff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ object.map(f).map(g)
The reference implementation of [Option](#option) is a functor as it satisfies the rules:

```js
some(1).map(x => x) // = some(1)
Some(1).map(x => x) // = Some(1)
```

and
Expand All @@ -491,8 +491,8 @@ and
const f = x => x + 1
const g = x => x * 2

some(1).map(x => g(f(x))) // = some(4)
some(1).map(f).map(g) // = some(4)
Some(1).map(x => g(f(x))) // = Some(4)
Some(1).map(f).map(g) // = Some(4)
```

## Pointed Functor
Expand Down Expand Up @@ -736,11 +736,11 @@ Using [Option](#option):
// safeParseNum :: String -> Option Number
const safeParseNum = (b) => {
const n = parseNumber(b)
return isNaN(n) ? none() : some(n)
return isNaN(n) ? None() : Some(n)
}

// validatePositive :: Number -> Option Number
const validatePositive = (a) => a > 0 ? some(a) : none()
const validatePositive = (a) => a > 0 ? Some(a) : None()

// kleisliCompose :: Monad M => ((b -> M c), (a -> M b)) -> a -> M c
const kleisliCompose = (g, f) => (x) => f(x).chain(g)
Expand Down

0 comments on commit 08a48ff

Please sign in to comment.