Skip to content

Commit

Permalink
published to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
jonlaing committed Nov 19, 2017
1 parent aae98dd commit cd0a83e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Note that not all of Ramda was ported over, as many of Ramda's utilities are mak
Features
--------------------------------------------------------------------------------

### Exception-free List oprations
### Exception-free List operations

In the OCaml/ReasonML standard library, many of the common List operations throw exceptions if there's a problem. Rationale's utilities do not throw exceptions, and instead return `options`.

Expand Down Expand Up @@ -122,7 +122,6 @@ swapLast([], [4,5,6]); /* [4,5,6] */
/* Or, with infix operators */
open Option.Infix;
open Option.Infix;
let swapLast = (xs, ys) =>
RList.last(xs) >>= ((x) => RList.init(ys) <$> RList.append(x)) |> Option.default(ys);
Expand All @@ -145,13 +144,15 @@ lastEqual([], [4,5,6]); /* false */
lastEqual([1,2,3], []); /* false */
/* Or, with infix operators */
open Option.Infix;
let lastEqual = (xs, ys) =>
Some(Util.eq) <*> RList.last(xs) <*> RList.last(ys) |> Option.default(false);
```

### Translating JS Idioms

### Or chains
#### Or chains

Take the following example in Javascript:

Expand All @@ -177,7 +178,7 @@ Reference

- `>>=`: Monadic Bind
- `<$>`: Functor Fmap
- `<*>`: Applicative Ap
- `<*>`: Applicative Apply
- `<||`: Point-free Function Compose
- `||>`: Point-free Function Pipe
- `-<<`: Lens Compose
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "rationale",
"version": "0.1.0",
"version": "0.1.1",
"description": "Rationale is a collection of helper utility functions that are absent in the OCaml/ReasonML standard library.",
"scripts": {
"build": "bsb -clean-world -make-world",
"watch": "bsb -clean-world -make-world -w",
Expand Down

0 comments on commit cd0a83e

Please sign in to comment.