hextra-1.1.0.1: Generic and niche utility functions and more for Haskell.

Hextra.Tuple

Description

For something like tBothmap and its cousins, consider importing Hextra.Bifunctor instead To solely import dupe, write import Hextra.Tuple (dupe)

Synopsis
• tSort :: forall a. Ord a => (a, a) -> (a, a)
• tSort' :: forall a. Ord a => (a, a) -> (a, a)
• tReverse :: forall a b. (a, b) -> (b, a)
• dupe :: forall a. a -> (a, a)
• dupe' :: forall b c. (forall a. a) -> (b, c)
• dupeC :: forall (f :: Type -> Constraint) b c. (f b, f c) => (forall a. f a => a) -> (b, c)
• tBothmap :: forall a b. (a -> b) -> (a, a) -> (b, b)
• tBothmap' :: forall b x y. (forall a. a -> b) -> (x, y) -> (b, b)
• tBothmapC :: forall b (f :: Type -> Constraint) x y. (f x, f y) => (forall a. f a => a -> b) -> (x, y) -> (b, b)
• tBothmapB :: forall (f :: Type -> Type -> Constraint) x y z w. (f x z, f y w) => (forall a b. f a b => a -> b) -> (x, y) -> (z, w)

# Documentation

tSort :: forall a. Ord a => (a, a) -> (a, a) Source #

Sorts a tuple

tSort' :: forall a. Ord a => (a, a) -> (a, a) Source #

Sorts a tuple, reversed

tReverse :: forall a b. (a, b) -> (b, a) Source #

dupe :: forall a. a -> (a, a) Source #

Creates a tuple with identical elements. Duplicates the value.

dupe' :: forall b c. (forall a. a) -> (b, c) Source #

Creates a tuple from a universally polymorphic value. Like dupe, but for universally polymorphic values universally polymorphic = exists for any type

dupeC :: forall (f :: Type -> Constraint) b c. (f b, f c) => (forall a. f a => a) -> (b, c) Source #

Like dupe and dupe', but for constrainedly polymorphic values, results in a constrainedly polymorphic tuple constrained = instance of a given class, or here, in the case of a tuple, containing them

tBothmap :: forall a b. (a -> b) -> (a, a) -> (b, b) Source #

Maps a function onto a homogenous tuple. homogenous = same type in both slots

tBothmap' :: forall b x y. (forall a. a -> b) -> (x, y) -> (b, b) Source #

Maps a universally polymorphic over any (even heterogenous) tuple. universally polymorphic = works for any type

tBothmapC :: forall b (f :: Type -> Constraint) x y. (f x, f y) => (forall a. f a => a -> b) -> (x, y) -> (b, b) Source #

Maps a constrainedly polymorphic over a constrained tuple. constrained = instance of a given class, or here, in the case of a tuple, containing them

tBothmapB :: forall (f :: Type -> Type -> Constraint) x y z w. (f x z, f y w) => (forall a b. f a b => a -> b) -> (x, y) -> (z, w) Source #

Maps a coercion function over a tuple of coercibles. coercion = function from something to something else