From 446d13a1e2d92308e84fc935e5666eea28f4b97a Mon Sep 17 00:00:00 2001 From: Gabe Johnson Date: Thu, 11 Jan 2018 10:08:18 -0600 Subject: [PATCH] Add Tuple specification --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 853e8b6..098fb9e 100644 --- a/README.md +++ b/README.md @@ -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