HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleghc-prim-0.12.0Haskell2010

GHC.Tuple

The tuple data types

Users should not import this module. It is GHC internal only.

  • 67 types
  • 1 value
  • Packageghc-prim-0.12.0
  • Exports69
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTuple.hs
typetype Tuple0 = ()
#

A tuple of zero elements, a synonym for Unit.

datadata Unit
#

The unit datatype Unit has one non-undefined member, the nullary constructor ().

Constructors

Instances2Eq, Ord
  • Eq ()Defined in ghc-prim-0.12.0 · GHC.Classes
  • Ord ()Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Solo a
#

Solo is the canonical lifted 1-tuple, just like Tuple2 is the canonical lifted 2-tuple (pair) and Tuple3 is the canonical lifted 3-tuple (triple).

The most important feature of Solo is that it is possible to force its "outside" (usually by pattern matching) without forcing its "inside", because it is defined as a datatype rather than a newtype. One situation where this can be useful is when writing a function to extract a value from a data structure. Suppose you write an implementation of arrays and offer only this function to index into them:

index :: Array a -> Int -> a

Now imagine that someone wants to extract a value from an array and store it in a lazy-valued finite map/dictionary:

insert "hello" (arr index 12) m

This can actually lead to a space leak. The value is not actually extracted from the array until that value (now buried in a map) is forced. That means the entire array may be kept live by just that value! Often, the solution is to use a strict map, or to force the value before storing it, but for some purposes that's undesirable.

One common solution is to include an indexing function that can produce its result in an arbitrary Applicative context:

indexA :: Applicative f => Array a -> Int -> f a

When using indexA in a pure context, Solo serves as a handy Applicative functor to hold the result. You could write a non-leaky version of the above example thus:

case arr indexA 12 of
  Solo a -> insert "hello" a m

While such simple extraction functions are the most common uses for unary tuples, they can also be useful for fine-grained control of strict-spined data structure traversals, and for unifying the implementations of lazy and strict mapping functions.

Constructors

Instances2Eq, Ord
  • Eq a => Eq (a)Defined in ghc-prim-0.12.0 · GHC.Classes
  • Ord a => Ord (a)Defined in ghc-prim-0.12.0 · GHC.Classes
patternpattern Solo :: a -> (a)
#

Deprecated. The Solo constructor has been renamed to MkSolo to avoid punning.

valuegetSolo :: (a) -> a
#

Extract the value from a Solo. Very often, values should be extracted directly using pattern matching, to control just what gets evaluated when. getSolo is for convenience in situations where that is not the case:

When the result is passed to a strict function, it makes no difference whether the pattern matching is done on the "outside" or on the "inside":

Data.Set.insert (getSolo sol) set === case sol of Solo v -> Data.Set.insert v set

A traversal may be performed in Solo in order to control evaluation internally, while using getSolo to extract the final result. A strict mapping function, for example, could be defined

map' :: Traversable t => (a -> b) -> t a -> t b
map' f = getSolo . traverse ((Solo $!) . f)
datadata Tuple2 a b
#

A tuple of two elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b) => Eq (a, b)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b) => Ord (a, b)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple3 a b c
#

A tuple of three elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b, Eq c) => Eq (a, b, c)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b, Ord c) => Ord (a, b, c)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple4 a b c d
#

A tuple of four elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple5 a b c d e
#

A tuple of five elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple6 a b c d e f
#

A tuple of six elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple7 a b c d e f g
#

A tuple of seven elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple8 a b c d e f g h
#

A tuple of eight elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => Ord (a, b, c, d, e, f, g, h)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple9 a b c d e f g h i
#

A tuple of nine elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => Ord (a, b, c, d, e, f, g, h, i)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple10 a b c d e f g h i j
#

A tuple of ten elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j) => Ord (a, b, c, d, e, f, g, h, i, j)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple11 a b c d e f g h i j k
#

A tuple of eleven elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k) => Ord (a, b, c, d, e, f, g, h, i, j, k)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple12 a b c d e f g h i j k l
#

A tuple of twelve elements.

Constructors

Instances2Eq, Ord
  • (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l)Defined in ghc-prim-0.12.0 · GHC.Classes
  • (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l) => Ord (a, b, c, d, e, f, g, h, i, j, k, l)Defined in ghc-prim-0.12.0 · GHC.Classes
datadata Tuple13 a b c d e f g h i j k l m
#

A tuple of 13 elements.

Constructors

Instances2Eq, Ord
datadata Tuple14 a b c d e f g h i j k l m n
#

A tuple of 14 elements.

Constructors

Instances2Eq, Ord
datadata Tuple15 a b c d e f g h i j k l m n o
#

A tuple of 15 elements.

Constructors

Instances2Eq, Ord
datadata Tuple16 a b c d e f g h i j k l m n o p
#

A tuple of 16 elements.

Constructors

datadata Tuple17 a b c d e f g h i j k l m n o p q
#

A tuple of 17 elements.

Constructors

datadata Tuple18 a b c d e f g h i j k l m n o p q r
#

A tuple of 18 elements.

Constructors

datadata Tuple19 a b c d e f g h i j k l m n o p q r s
#

A tuple of 19 elements.

Constructors

datadata Tuple20 a b c d e f g h i j k l m n o p q r s t
#

A tuple of 20 elements.

Constructors

datadata Tuple21 a b c d e f g h i j k l m n o p q r s t u
#

A tuple of 21 elements.

Constructors

datadata Tuple22 a b c d e f g h i j k l m n o p q r s t u v
#

A tuple of 22 elements.

Constructors

datadata Tuple23 a b c d e f g h i j k l m n o p q r s t u v w
#

A tuple of 23 elements.

Constructors

datadata Tuple24 a b c d e f g h i j k l m n o p q r s t u v w x
#

A tuple of 24 elements.

Constructors

datadata Tuple25 a b c d e f g h i j k l m n o p q r s t u v w x y
#

A tuple of 25 elements.

Constructors

datadata Tuple26 a b c d e f g h i j k l m n o p q r s t u v w x y z
#

A tuple of 26 elements.

Constructors

datadata Tuple27 a b c d e f g h i j k l m n o p q r s t u v w x y z t26
#

A tuple of 27 elements.

Constructors

datadata Tuple28 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27
#

A tuple of 28 elements.

Constructors

datadata Tuple29 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28
#

A tuple of 29 elements.

Constructors

datadata Tuple30 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29
#

A tuple of 30 elements.

Constructors

datadata Tuple31 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30
#

A tuple of 31 elements.

Constructors

datadata Tuple32 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31
#

A tuple of 32 elements.

Constructors

datadata Tuple33 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32
#

A tuple of 33 elements.

Constructors

datadata Tuple34 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33
#

A tuple of 34 elements.

Constructors

datadata Tuple35 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34
#

A tuple of 35 elements.

Constructors

datadata Tuple36 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35
#

A tuple of 36 elements.

Constructors

datadata Tuple37 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36
#

A tuple of 37 elements.

Constructors

datadata Tuple38 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37
#

A tuple of 38 elements.

Constructors

datadata Tuple39 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38
#

A tuple of 39 elements.

Constructors

datadata Tuple40 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39
#

A tuple of 40 elements.

Constructors

datadata Tuple41 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40
#

A tuple of 41 elements.

Constructors

datadata Tuple42 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41
#

A tuple of 42 elements.

Constructors

datadata Tuple43 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42
#

A tuple of 43 elements.

Constructors

datadata Tuple44 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43
#

A tuple of 44 elements.

Constructors

datadata Tuple45 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44
#

A tuple of 45 elements.

Constructors

datadata Tuple46 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45
#

A tuple of 46 elements.

Constructors

datadata Tuple47 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46
#

A tuple of 47 elements.

Constructors

datadata Tuple48 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47
#

A tuple of 48 elements.

Constructors

datadata Tuple49 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48
#

A tuple of 49 elements.

Constructors

datadata Tuple50 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49
#

A tuple of 50 elements.

Constructors

datadata Tuple51 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50
#

A tuple of 51 elements.

Constructors

datadata Tuple52 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51
#

A tuple of 52 elements.

Constructors

datadata Tuple53 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52
#

A tuple of 53 elements.

Constructors

datadata Tuple54 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53
#

A tuple of 54 elements.

Constructors

datadata Tuple55 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54
#

A tuple of 55 elements.

Constructors

datadata Tuple56 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54 t55
#

A tuple of 56 elements.

Constructors

datadata Tuple57 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54 t55 t56
#

A tuple of 57 elements.

Constructors

datadata Tuple58 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54 t55 t56 t57
#

A tuple of 58 elements.

Constructors

datadata Tuple59 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54 t55 t56 t57 t58
#

A tuple of 59 elements.

Constructors

datadata Tuple60 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54 t55 t56 t57 t58 t59
#

A tuple of 60 elements.

Constructors

datadata Tuple61 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54 t55 t56 t57 t58 t59 t60
#

A tuple of 61 elements.

Constructors

datadata Tuple62 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54 t55 t56 t57 t58 t59 t60 t61
#

A tuple of 62 elements.

Constructors

datadata Tuple63 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54 t55 t56 t57 t58 t59 t60 t61 t62
#

A tuple of 63 elements.

Constructors

datadata Tuple64 a b c d e f g h i j k l m n o p q r s t u v w x y z t26 t27 t28 t29 t30 t31 t32 t33 t34 t35 t36 t37 t38 t39 t40 t41 t42 t43 t44 t45 t46 t47 t48 t49 t50 t51 t52 t53 t54 t55 t56 t57 t58 t59 t60 t61 t62 t63
#

A tuple of 64 elements.

Constructors