Safe Haskell | None |
---|---|
Language | Haskell2010 |
Control.IndexT.TypeLevel.Tuple
Description
Type family and class definitions for dealing with tuples.
Control.IndexT.Tuple but with tuples raised to the type level and polykinded.
- type family TupleConstraint (n :: Nat) (a :: k) :: Constraint
- type family HomoTupleConstraint (n :: Nat) a :: Constraint
- class TupleConstraint n a => IsTuple n a
- class HomoTupleConstraint n a => IsHomoTuple n a
Documentation
type family TupleConstraint (n :: Nat) (a :: k) :: Constraint Source #
Type level version of TupleConstraint
Instances
type TupleConstraint k 15 a Source # | |
type TupleConstraint k 14 a Source # | |
type TupleConstraint k 13 a Source # | |
type TupleConstraint k 12 a Source # | |
type TupleConstraint k 11 a Source # | |
type TupleConstraint k 10 a Source # | |
type TupleConstraint k 9 a Source # | |
type TupleConstraint k 8 a Source # | |
type TupleConstraint k 7 a Source # | |
type TupleConstraint k 6 a Source # | |
type TupleConstraint k 5 a Source # | |
type TupleConstraint k 4 a Source # | |
type TupleConstraint k 3 a Source # | |
type TupleConstraint k 2 a Source # | |
type TupleConstraint j 0 a Source # | |
type family HomoTupleConstraint (n :: Nat) a :: Constraint Source #
HomoTupleConstraint
simply further constrains TupleConstraint
so that all the elements are the same.
So HomoTupleConstraint 3 t
basically says t ~ (u,u,u)
for some u
,
("Homo" is short for "Homogeneous". As in, all the same. Or like milk.)
Instances
type HomoTupleConstraint 0 a Source # | |
type HomoTupleConstraint 1 a Source # | |
type HomoTupleConstraint 2 a Source # | |
type HomoTupleConstraint 3 a Source # | |
type HomoTupleConstraint 4 a Source # | |
type HomoTupleConstraint 5 a Source # | |
type HomoTupleConstraint 6 a Source # | |
type HomoTupleConstraint 7 a Source # | |
type HomoTupleConstraint 8 a Source # | |
type HomoTupleConstraint 9 a Source # | |
type HomoTupleConstraint 10 a Source # | |
type HomoTupleConstraint 11 a Source # | |
type HomoTupleConstraint 12 a Source # | |
type HomoTupleConstraint 13 a Source # | |
type HomoTupleConstraint 14 a Source # | |
type HomoTupleConstraint 15 a Source # | |
class TupleConstraint n a => IsTuple n a Source #
GHC does not allow you to partially apply type families (or any type declaration for that matter).
So if you have a type of * -> Constraint
you can't pass TupleConstraint 2
, because TupleConstraint
is partially
applied and this is not allowed.
But you can partially apply classes.
So IsTuple
is basically the same as TupleConstraint
except that it's a class, not a type family.
Instances
TupleConstraint k n a => IsTuple k n a Source # | |
class HomoTupleConstraint n a => IsHomoTuple n a Source #
The version of IsTuple
for homogenous tuples (i.e. all the same type).
Instances
HomoTupleConstraint n a => IsHomoTuple n a Source # | |