Skip to content

Commit

Permalink
Add experimental identity api
Browse files Browse the repository at this point in the history
Add docs to npmignore
  • Loading branch information
Ryan Stegmann committed Jan 29, 2017
1 parent 95d13a7 commit facce30
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
test
*.spec.js
docs

.travis.yml
.jshintignore
Expand Down
2 changes: 1 addition & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ crocks.js API
* Async
* Const
* Either
* Identity
* [Identity](crocks/Identity.md)
* IO
* List
* Maybe
Expand Down
63 changes: 63 additions & 0 deletions docs/crocks/Identity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Identity

`Identity : a -> a`

It's just a function which returns what you pass into it.

## What a crock!

It converts your `non-crock` into a `crock`

```js
const frozenPizza = Identity('pizza') //Identity pizza
const microwave = x => 'microwave ' + x
const dinner = frozenPizza.map(microwave) //Identity "microwave pizza"
dinner.value() // "microwave pizza"
```

| Constructor | Instance |
|:---|:---|
| [`of`](#of) | [`ap`](#ap), [`chain`](#chain), [`equals`](#equals), [`map`](#map), [`of`](#of), [`sequence`](#sequence), [`traverse`](#traverse), [`value`](#value) |

## Constructors

### of

```js
crocks.Identity.of([1,2,10])
crocks.Identity([1,2,10])
```

## Instances

### ap

`Function (a -> b) -> Function b`

### chain

`(a -> m b) -> m b`

### equals

`x -> Boolean`

### map

`(a -> b) -> Function b`

### of

`a -> Function a`

### sequence

`Type (m a) -> m (Type a)`

### traverse

`a -> Function b -> Function b`

### value

`a -> a`

0 comments on commit facce30

Please sign in to comment.