LocalDependency.Data.Tuple.Nested
Tuples that are not restricted to two elements.
Here is an example of a 3-tuple:
> tuple = tuple3 1 "2" 3.0
> tuple
(Tuple 1 (Tuple "2" (Tuple 3.0 unit)))
Notice that a tuple is a nested structure not unlike a list. The type of tuple
is this:
> :t tuple
Tuple Int (Tuple String (Tuple Number Unit))
That, however, can be abbreviated with the Tuple3
type:
Tuple3 Int String Number
All tuple functions are numbered from 1 to 10. That is, there's
a get1
and a get10
.
The getN
functions accept tuples of length N or greater:
get1 tuple = 1
get3 tuple = 3
get4 tuple -- type error. `get4` requires a longer tuple.
The same is true of the overN
functions:
over2 negate (tuple3 1 2 3) = tuple3 1 (-2) 3
uncurryN
can be used to convert a function that takes N
arguments to one that takes an N-tuple:
uncurry2 (+) (tuple2 1 2) = 3
The reverse curryN
function converts functions that take
N-tuples (which are rare) to functions that take N
arguments.
In addition to types like Tuple3
, there are also types like
T3
. Whereas Tuple3
describes a tuple with exactly three
elements, T3
describes a tuple of length two or longer. More
specifically, T3
requires two element plus a "tail" that may be
unit
or more tuple elements. Use types like T3
when you want to
create a set of functions for arbitrary tuples. See the source for how that's done.
#(/\)
Operator alias for LocalDependency.Data.Tuple.Tuple (right-associative / precedence 6)
Shorthand for constructing n-tuples as nested pairs.
a /\ b /\ c /\ d /\ unit
becomes Tuple a (Tuple b (Tuple c (Tuple d unit)))
#type (/\)
Operator alias for LocalDependency.Data.Tuple.Tuple (right-associative / precedence 6)
Shorthand for constructing n-tuple types as nested pairs.
forall a b c d. a /\ b /\ c /\ d /\ Unit
becomes
forall a b c d. Tuple a (Tuple b (Tuple c (Tuple d Unit)))
#tuple3
#tuple4
#tuple5
#tuple6
#tuple7
#tuple8
#tuple9
#tuple10
#get5
#get6
#get7
#get8
#get9
#get10
#over1
#over2
#over3
#over4
#over5
#over6
#over7
#over8
#over9
#over10
#uncurry1
#uncurry2
#uncurry3
#uncurry4
#uncurry5
#uncurry6
#uncurry7
#uncurry8
#uncurry9
#uncurry10
#curry1
#curry2
#curry3
#curry4
#curry5
#curry6
#curry7
#curry8
#curry9
Modules
- Control.Applicative
- Control.Apply
- Control.Bind
- Control.Category
- Control.Monad
- Control.Semigroupoid
- Data.Boolean
- Data.BooleanAlgebra
- Data.Bounded
- Data.Bounded.Generic
- Data.CommutativeRing
- Data.DivisionRing
- Data.Eq
- Data.Eq.Generic
- Data.EuclideanRing
- Data.Field
- Data.Function
- Data.Functor
- Data.Generic.Rep
- Data.HeytingAlgebra
- Data.HeytingAlgebra.Generic
- Data.Monoid
- Data.Monoid.Additive
- Data.Monoid.Conj
- Data.Monoid.Disj
- Data.Monoid.Dual
- Data.Monoid.Endo
- Data.Monoid.Generic
- Data.Monoid.Multiplicative
- Data.NaturalTransformation
- Data.Newtype
- Data.Ord
- Data.Ord.Down
- Data.Ord.Generic
- Data.Ord.Max
- Data.Ord.Min
- Data.Ordering
- Data.Ring
- Data.Ring.Generic
- Data.Semigroup
- Data.Semigroup.First
- Data.Semigroup.Generic
- Data.Semigroup.Last
- Data.Semiring
- Data.Semiring.Generic
- Data.Show
- Data.Show.Generic
- Data.Symbol
- Data.Unit
- Data.Void
- Foreign
- LocalDependency.Control.Alt
- LocalDependency.Control.Alternative
- LocalDependency.Control.Biapplicative
- LocalDependency.Control.Biapply
- LocalDependency.Control.Comonad
- LocalDependency.Control.Extend
- LocalDependency.Control.Lazy
- LocalDependency.Control.MonadPlus
- LocalDependency.Control.MonadZero
- LocalDependency.Control.Plus
- LocalDependency.Data.Bifoldable
- LocalDependency.Data.Bifunctor
- LocalDependency.Data.Bifunctor.Join
- LocalDependency.Data.Bitraversable
- LocalDependency.Data.Comparison
- LocalDependency.Data.Const
- LocalDependency.Data.Decidable
- LocalDependency.Data.Decide
- LocalDependency.Data.Distributive
- LocalDependency.Data.Divide
- LocalDependency.Data.Divisible
- LocalDependency.Data.Either
- LocalDependency.Data.Either.Inject
- LocalDependency.Data.Either.Nested
- LocalDependency.Data.Equivalence
- LocalDependency.Data.Exists
- LocalDependency.Data.Foldable
- LocalDependency.Data.FoldableWithIndex
- LocalDependency.Data.Functor.App
- LocalDependency.Data.Functor.Clown
- LocalDependency.Data.Functor.Compose
- LocalDependency.Data.Functor.Contravariant
- LocalDependency.Data.Functor.Coproduct
- LocalDependency.Data.Functor.Coproduct.Inject
- LocalDependency.Data.Functor.Coproduct.Nested
- LocalDependency.Data.Functor.Costar
- LocalDependency.Data.Functor.Flip
- LocalDependency.Data.Functor.Invariant
- LocalDependency.Data.Functor.Joker
- LocalDependency.Data.Functor.Product
- LocalDependency.Data.Functor.Product.Nested
- LocalDependency.Data.Functor.Product2
- LocalDependency.Data.FunctorWithIndex
- LocalDependency.Data.Identity
- LocalDependency.Data.Maybe
- LocalDependency.Data.Maybe.First
- LocalDependency.Data.Maybe.Last
- LocalDependency.Data.Monoid.Alternate
- LocalDependency.Data.Op
- LocalDependency.Data.Predicate
- LocalDependency.Data.Profunctor
- LocalDependency.Data.Profunctor.Choice
- LocalDependency.Data.Profunctor.Closed
- LocalDependency.Data.Profunctor.Cochoice
- LocalDependency.Data.Profunctor.Costrong
- LocalDependency.Data.Profunctor.Join
- LocalDependency.Data.Profunctor.Split
- LocalDependency.Data.Profunctor.Star
- LocalDependency.Data.Profunctor.Strong
- LocalDependency.Data.Semigroup.Foldable
- LocalDependency.Data.Semigroup.Traversable
- LocalDependency.Data.Traversable
- LocalDependency.Data.Traversable.Accum
- LocalDependency.Data.Traversable.Accum.Internal
- LocalDependency.Data.TraversableWithIndex
- LocalDependency.Data.Tuple
- LocalDependency.Data.Tuple.Nested
- LocalDependency.Effect
- LocalDependency.Safe.Coerce
- LocalDependency.Type.Equality
- LocalDependency.Unsafe.Coerce
- Prelude
- Prim
- Prim.Boolean
- Prim.Coerce
- Prim.Ordering
- Prim.Row
- Prim.RowList
- Prim.Symbol
- Prim.TypeError
- Record.Unsafe
- Safe.Coerce
- Test.Foreign
- Test.Main
- Test.MiraculixLite
- Test.MiraculixLite.Assertion
- Test.MiraculixLite.FFI
- Test.MiraculixLite.Summary
- Test.MiraculixLite.TestTree
- Test.MiraculixLite.Typo
- Type.Data.Row
- Type.Data.RowList
- Type.Proxy
- Unsafe.Coerce