Skip to content

Commit

Permalink
Add Tuple specification
Browse files Browse the repository at this point in the history
  • Loading branch information
gabejohnson committed Jan 11, 2018
1 parent 935f203 commit 446d13a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,27 @@ The `cata` method takes two arguments:
1. If `g` is not a function, the behaviour of `cata` is unspecified.
2. No parts of `g`'s return value should be checked.

### Tuple

`Tuple` is the canonical product type and represents a structure containing two
values (Tuple a b).

```hs
Tuple a b = { cata :: (a -> b -> c) -> c }
tuple :: (a, b) -> Tuple a b
```

A value which conforms to the Tuple specification must provide an `cata` method.

The `cata` method takes a single argument:

t.cata(f)

1. `f` must be a function of two arguments which returns a value

1. If `f` is not a function, the behaviour of `cata` is unspecified.
2. No parts of `f`'s return value should be checked.

## Derivations

When creating data types which satisfy multiple algebras, authors may choose
Expand Down

0 comments on commit 446d13a

Please sign in to comment.