-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
785 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Applicative | ||
description: | | ||
Import with. | ||
```javascript | ||
import * as Applicative from "jabz/applicative"; | ||
``` | ||
functions: | ||
- name: of | ||
type: "<A, F extends Applicative>(d: ApplicativeDictionary, a: A): F<A>" | ||
description: | | ||
Wraps a value in an applicative. This function is also known as `pure` and `return`. | ||
```javascript | ||
of(Maybe, 12); //=> just(12) | ||
of(Array, 12); //=> [12] | ||
``` | ||
- name: ap | ||
type: "<A, B, F extends Applicative>(fa: F<(a: A) => B>, ba: F<A>): F<B>" | ||
description: | | ||
Takes two applicatives of the same type. The first must contain a | ||
function from `A` and the second an `A`. The function is then | ||
applied to the value and a new applicative is returned. | ||
- name: lift | ||
type: "<F extends Applicative>(f: (?) => R, ...args: F<?>[]): F<A>" | ||
description: | | ||
Takes a function from `n` arguments, `n` applicatives with values | ||
matching the function and applies the function inside the | ||
applicatives. | ||
```javascript | ||
lift((a, b, c) => a * b + c, just(4), just(2), just(3)); //=> just(11) | ||
lift((a, b, c) => a * b + c, just(4), nothing, just(3)); //=> nothing | ||
``` | ||
- name: seq | ||
type: "<A, B, F extends Applicative>(a: F<A>, b: F<B>): F<B>" | ||
description: | | ||
Sequences actions from left to right, i.e. `a` before `b`, | ||
discarding the value of `a`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Cons | ||
description: | | ||
A simple singly linked list. It can be useful in cases where a list | ||
is build by repeatedly prepending elements to the front of the this. | ||
`Cons` supports the `cons` operation in very low constant time. | ||
It implements semigroup, monoid, functor, applicative, monad, | ||
foldable and traversable. | ||
functions: | ||
|
||
- name: 'nil' | ||
type: 'Cons<any>' | ||
description: | | ||
The sentinel value at the end of the list indicating the end. | ||
Alternatively it can be though of as the empty list. | ||
- name: 'cons' | ||
type: '<A>(a: A, as: Cons<A>)' | ||
description: | | ||
Prepend the element `a` to the beginning of the list `as`. | ||
- name: 'fromArray' | ||
type: '<A>(as: A[]): Cons<A>' | ||
description: | | ||
Creates a `Cons`-list from an array |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.