Skip to content

Commit

Permalink
Merge pull request purescript#11 from brainrape/update-docs
Browse files Browse the repository at this point in the history
add/update docs
  • Loading branch information
paf31 committed Mar 18, 2015
2 parents 37bf379 + 64137dd commit e9cd38c
Show file tree
Hide file tree
Showing 2 changed files with 252 additions and 40 deletions.
267 changes: 228 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,84 +2,273 @@

## Module Data.Tuple

### Types

data Tuple a b where
Tuple :: a -> b -> Tuple a b
A data type and functions for working with ordered pairs and sequences of values.

#### `Tuple`

### Type Class Instances
``` purescript
data Tuple a b
= Tuple a b
```

instance applicativeTuple :: (Monoid a) => Applicative (Tuple a)
A simple product type for wrapping pairs of values.

instance applyTuple :: (Semigroup a) => Apply (Tuple a)
#### `showTuple`

instance bindTuple :: (Semigroup a) => Bind (Tuple a)
``` purescript
instance showTuple :: (Show a, Show b) => Show (Tuple a b)
```

instance comonadTuple :: Comonad (Tuple a)

instance eqTuple :: (Eq a, Eq b) => Eq (Tuple a b)
#### `eqTuple`

instance extendTuple :: Extend (Tuple a)
``` purescript
instance eqTuple :: (Eq a, Eq b) => Eq (Tuple a b)
```

instance functorTuple :: Functor (Tuple a)

instance lazyLazy1Tuple :: (Lazy1 l1, Lazy1 l2) => Lazy (Tuple (l1 a) (l2 b))
#### `ordTuple`

instance lazyLazy2Tuple :: (Lazy2 l1, Lazy2 l2) => Lazy (Tuple (l1 a b) (l2 c d))
``` purescript
instance ordTuple :: (Ord a, Ord b) => Ord (Tuple a b)
```

instance lazyTuple :: (Lazy a, Lazy b) => Lazy (Tuple a b)

instance monadTuple :: (Monoid a) => Monad (Tuple a)
#### `semigroupoidTuple`

instance monoidTuple :: (Monoid a, Monoid b) => Monoid (Tuple a b)
``` purescript
instance semigroupoidTuple :: Semigroupoid Tuple
```

instance ordTuple :: (Ord a, Ord b) => Ord (Tuple a b)

instance semigroupTuple :: (Semigroup a, Semigroup b) => Semigroup (Tuple a b)
#### `semigroupTuple`

instance semigroupoidTuple :: Semigroupoid Tuple
``` purescript
instance semigroupTuple :: (Semigroup a, Semigroup b) => Semigroup (Tuple a b)
```

instance showTuple :: (Show a, Show b) => Show (Tuple a b)

#### `monoidTuple`

### Values
``` purescript
instance monoidTuple :: (Monoid a, Monoid b) => Monoid (Tuple a b)
```

curry :: forall a b c. (Tuple a b -> c) -> a -> b -> c

fst :: forall a b. Tuple a b -> a
#### `functorTuple`

snd :: forall a b. Tuple a b -> b
``` purescript
instance functorTuple :: Functor (Tuple a)
```

swap :: forall a b. Tuple a b -> Tuple b a

uncurry :: forall a b c. (a -> b -> c) -> Tuple a b -> c
#### `applyTuple`

unzip :: forall a b. [Tuple a b] -> Tuple [a] [b]
``` purescript
instance applyTuple :: (Semigroup a) => Apply (Tuple a)
```

zip :: forall a b. [a] -> [b] -> [Tuple a b]

#### `applicativeTuple`

``` purescript
instance applicativeTuple :: (Monoid a) => Applicative (Tuple a)
```


#### `bindTuple`

``` purescript
instance bindTuple :: (Semigroup a) => Bind (Tuple a)
```


#### `monadTuple`

``` purescript
instance monadTuple :: (Monoid a) => Monad (Tuple a)
```


#### `extendTuple`

``` purescript
instance extendTuple :: Extend (Tuple a)
```


#### `comonadTuple`

``` purescript
instance comonadTuple :: Comonad (Tuple a)
```


#### `lazyTuple`

``` purescript
instance lazyTuple :: (Lazy a, Lazy b) => Lazy (Tuple a b)
```


#### `lazyLazy1Tuple`

``` purescript
instance lazyLazy1Tuple :: (Lazy1 l1, Lazy1 l2) => Lazy (Tuple (l1 a) (l2 b))
```


#### `lazyLazy2Tuple`

``` purescript
instance lazyLazy2Tuple :: (Lazy2 l1, Lazy2 l2) => Lazy (Tuple (l1 a b) (l2 c d))
```


#### `fst`

``` purescript
fst :: forall a b. Tuple a b -> a
```

Returns the first component of a tuple.

#### `snd`

``` purescript
snd :: forall a b. Tuple a b -> b
```

Returns the second component of a tuple.

#### `curry`

``` purescript
curry :: forall a b c. (Tuple a b -> c) -> a -> b -> c
```

Turn a function that expects a tuple into a function of two arguments.

#### `uncurry`

``` purescript
uncurry :: forall a b c. (a -> b -> c) -> Tuple a b -> c
```

Turn a function of two arguments into a function that expects a tuple.

#### `zip`

``` purescript
zip :: forall a b. [a] -> [b] -> [Tuple a b]
```

Rakes two lists and returns a list of corresponding pairs.
If one input list is short, excess components of the longer list are discarded.

#### `unzip`

``` purescript
unzip :: forall a b. [Tuple a b] -> Tuple [a] [b]
```

Transforms a list of pairs into a list of first components and a list of second components.

#### `swap`

``` purescript
swap :: forall a b. Tuple a b -> Tuple b a
```

Exchange the first and second components of a tuple.


## Module Data.Tuple.Nested

### Values

(/\) :: forall a b. a -> b -> Tuple a b
Utilities for n-tuples: sequences longer than two components built from nested pairs.

#### `con2`

``` purescript
con2 :: forall a b z. (a -> b -> z) -> Tuple a b -> z
```

Given a function of 2 arguments, return a function that accepts a 2-tuple.

#### `con3`

``` purescript
con3 :: forall a b c z. (a -> b -> c -> z) -> Tuple a (Tuple b c) -> z
```

Given a function of 3 arguments, return a function that accepts a 3-tuple.

#### `con4`

``` purescript
con4 :: forall a b c d z. (a -> b -> c -> d -> z) -> Tuple a (Tuple b (Tuple c d)) -> z
```

Given a function of 4 arguments, return a function that accepts a 4-tuple.

#### `con5`

``` purescript
con5 :: forall a b c d e z. (a -> b -> c -> d -> e -> z) -> Tuple a (Tuple b (Tuple c (Tuple d e))) -> z
```

Given a function of 5 arguments, return a function that accepts a 5-tuple.

#### `con6`

``` purescript
con6 :: forall a b c d e f z. (a -> b -> c -> d -> e -> f -> z) -> Tuple a (Tuple b (Tuple c (Tuple d (Tuple e f)))) -> z
```

Given a function of 6 arguments, return a function that accepts a 6-tuple.

#### `con7`

``` purescript
con7 :: forall a b c d e f g z. (a -> b -> c -> d -> e -> f -> g -> z) -> Tuple a (Tuple b (Tuple c (Tuple d (Tuple e (Tuple f g))))) -> z
```

Given a function of 7 arguments, return a function that accepts a 7-tuple.

#### `con8`

``` purescript
con8 :: forall a b c d e f g h z. (a -> b -> c -> d -> e -> f -> g -> h -> z) -> Tuple a (Tuple b (Tuple c (Tuple d (Tuple e (Tuple f (Tuple g h)))))) -> z
```

Given a function of 8 arguments, return a function that accepts a 8-tuple.

#### `con9`

``` purescript
con9 :: forall a b c d e f g h i z. (a -> b -> c -> d -> e -> f -> g -> h -> i -> z) -> Tuple a (Tuple b (Tuple c (Tuple d (Tuple e (Tuple f (Tuple g (Tuple h i))))))) -> z
```

Given a function of 9 arguments, return a function that accepts a 9-tuple.

con10 :: forall a b c d e f g h i j z. (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> z) -> Tuple a (Tuple b (Tuple c (Tuple d (Tuple e (Tuple f (Tuple g (Tuple h (Tuple i j)))))))) -> z
#### `con10`

con2 :: forall a b z. (a -> b -> z) -> Tuple a b -> z
``` purescript
con10 :: forall a b c d e f g h i j z. (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> z) -> Tuple a (Tuple b (Tuple c (Tuple d (Tuple e (Tuple f (Tuple g (Tuple h (Tuple i j)))))))) -> z
```

con3 :: forall a b c z. (a -> b -> c -> z) -> Tuple a (Tuple b c) -> z
Given a function of 10 arguments, return a function that accepts a 10-tuple.

con4 :: forall a b c d z. (a -> b -> c -> d -> z) -> Tuple a (Tuple b (Tuple c d)) -> z
#### `(/\)`

con5 :: forall a b c d e z. (a -> b -> c -> d -> e -> z) -> Tuple a (Tuple b (Tuple c (Tuple d e))) -> z
``` purescript
(/\) :: forall a b. a -> b -> Tuple a b
```

con6 :: forall a b c d e f z. (a -> b -> c -> d -> e -> f -> z) -> Tuple a (Tuple b (Tuple c (Tuple d (Tuple e f)))) -> z
Shorthand for constructing nested tuples.
`a /\ b /\ c /\ d` becomes `Tuple a (Tuple b (Tuple c d))`

con7 :: forall a b c d e f g z. (a -> b -> c -> d -> e -> f -> g -> z) -> Tuple a (Tuple b (Tuple c (Tuple d (Tuple e (Tuple f g))))) -> z

con8 :: forall a b c d e f g h z. (a -> b -> c -> d -> e -> f -> g -> h -> z) -> Tuple a (Tuple b (Tuple c (Tuple d (Tuple e (Tuple f (Tuple g h)))))) -> z

con9 :: forall a b c d e f g h i z. (a -> b -> c -> d -> e -> f -> g -> h -> i -> z) -> Tuple a (Tuple b (Tuple c (Tuple d (Tuple e (Tuple f (Tuple g (Tuple h i))))))) -> z
Loading

0 comments on commit e9cd38c

Please sign in to comment.