add isSome/isNone; fix more formatting; fix typoes

This commit is contained in:
Rowan 2025-03-31 20:49:12 -05:00
parent 8eaf2e5dcc
commit 19826ab203

View file

@ -46,7 +46,7 @@ const twelve = curriedAdd(4, 4, 4) // 12
```
### Option
> Option<T> = Some<T> | None
> Option\<T\> = Some\<T\> | None
Represents a value which may not exist.
@ -120,11 +120,26 @@ none.fold((acc, x) => x, 2) // 2
##### isSome :: Option f => () -> boolean
> Option\<T\>.isSome() -> boolean
Returns a boolean based on whether the Option is `Some<T>`
```js
Some(1).isSome() // true
None.isSome() // false
```
##### isNone :: Option f => () -> boolean
> Option\<T\>.isNone() -> boolean
Returns a boolean based on whether the Option is `None`
```js
Some(1).isNone() // false
None.isNone() // true
```
### Result
> Result<T, E> = Ok<T> | Err<E>
> Result<T, E> = Ok\<T\> | Err\<E\>
Represents a value which may fail.
@ -225,11 +240,11 @@ err.bimap(
##### isOk :: Result f => () -> boolean
> Result\<T, E\>.isOk() -> boolean
Returns a boolean based on whether the Result is `Some<T>`
Returns a boolean based on whether the Result is `Ok<T>`
```js
Ok(1).isSome() // true
Err(1).isSome() // false
Ok(1).isOk() // true
Err(1).isOk() // false
```
##### isErr :: Result f => () -> boolean