Safe Haskell | Safe |
---|---|

Language | Haskell98 |

This small library defines data types `Tup1`

, `Tup2`

... `Tup9`

for homogeneous tuples of small size (both strict and lazy),
and various instances for them, most notably `Functor`

and `Applicative`

. We also have a `Tup`

type class:

class Tup f where tupSize :: f a -> Int tupToList :: f a -> [a] tupFromList :: [a] -> f a tupProxy :: f a -> Proxy a ...

Also included is a very simple preprocesszor `tuplepp`

which translates
the syntax `{{a,b,c}}`

into `(Tup3 a b c)`

.

A different implementation is also given in the module Data.Tup.Vec; this basically implements
lists which encode their length in their types. For this, just replace `Tup`

by `Vec`

everywhere.
The same instances and functions are provided.

A third implementation is in Data.Tup.Newtype; here the tuples are newtypes of Haskell tuples.
Just replace `Tup`

by `NTup`

.

# Documentation

module Data.Tup.Tup