Data.Tuple.OneTuple

OneTuple-0.2.1: Singleton Tuple

Safe Haskell | Safe
Language | Haskell98

Data.Tuple.OneTuple

Description

OneTuple fills the tuple gap with a singleton tuple.

OneTuple does not support the usual parenthesized tuple syntax.

OneTuple

- has the expected laziness properties
- can be pattern-matched
- ships with instances for several standard type classes, including all those supported by H98-standard tuples
- requires no language extensions, except for hierarchical modules

Synopsis

- data OneTuple a = OneTuple a
- only :: OneTuple a -> a

# Documentation

data OneTuple a

OneTuple is the singleton tuple data type.

Constructors

OneTuple a | singleton tuple constructor

Instances

Monad OneTuple |
Functor OneTuple |
MonadFix OneTuple |
Applicative OneTuple |
Foldable OneTuple |
Traversable OneTuple |
Bounded a => Bounded (OneTuple a) |
Enum a => Enum (OneTuple a) |
Eq a => Eq (OneTuple a) |
Ord a => Ord (OneTuple a) |
Read a => Read (OneTuple a) |
Show a => Show (OneTuple a) |
Ix a => Ix (OneTuple a) |
Monoid a => Monoid (OneTuple a) |

only

Arguments

:: OneTuple a | takes a singleton tuple argument
-> a | returns the only element in the tuple

The `only` function extracts the OneTuple's only member. (Compare to `fst` and `snd`.)