| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
PlutusCore.StdLib.Meta.Data.Tuple
Description
tuples of various sizes and related functions.
Synopsis
- data Tuple (term :: Type -> Type) (uni :: Type -> Type) ann = Tuple {
- _tupleElementTypes :: [Type TyName uni ann]
- _tupleTerm :: term ann
- getTupleType :: forall m ann (term :: Type -> Type) (uni :: Type -> Type). MonadQuote m => ann -> Tuple term uni ann -> m (Type TyName uni ann)
- tupleTypeTermAt :: forall term (uni :: Type -> Type) fun m ann. (TermLike term TyName Name uni fun, MonadQuote m) => ann -> Int -> Tuple term uni ann -> m (Type TyName uni ann, term ann)
- tupleTermAt :: forall term (uni :: Type -> Type) fun m ann. (TermLike term TyName Name uni fun, MonadQuote m) => ann -> Int -> Tuple term uni ann -> m (term ann)
- tupleDefAt :: forall term (uni :: Type -> Type) fun m ann. (TermLike term TyName Name uni fun, MonadQuote m) => ann -> Int -> Name -> Tuple term uni ann -> m (TermDef term TyName Name uni ann)
- bindTuple :: forall term (uni :: Type -> Type) fun m ann. (TermLike term TyName Name uni fun, MonadQuote m) => ann -> [Name] -> Tuple term uni ann -> term ann -> m (term ann)
- prodN :: forall (uni :: Type -> Type). Int -> Type TyName uni ()
- prodNConstructor :: forall term (uni :: Type -> Type) fun. TermLike term TyName Name uni fun => Int -> term ()
- prodNAccessor :: forall term (uni :: Type -> Type) fun. TermLike term TyName Name uni fun => Int -> Int -> term ()
- getSpineToTuple :: forall term (uni :: Type -> Type) fun m ann. (TermLike term TyName Name uni fun, MonadQuote m) => ann -> [(Type TyName uni ann, term ann)] -> m (Tuple term uni ann)
Documentation
data Tuple (term :: Type -> Type) (uni :: Type -> Type) ann Source #
A Plutus Core (Scott-encoded) tuple.
Constructors
| Tuple | |
Fields
| |
getTupleType :: forall m ann (term :: Type -> Type) (uni :: Type -> Type). MonadQuote m => ann -> Tuple term uni ann -> m (Type TyName uni ann) Source #
Get the type of a Tuple.
getTupleType _ (Tuple [a1, ... , an] _) = all r. (a1 -> ... -> an -> r) -> r
tupleTypeTermAt :: forall term (uni :: Type -> Type) fun m ann. (TermLike term TyName Name uni fun, MonadQuote m) => ann -> Int -> Tuple term uni ann -> m (Type TyName uni ann, term ann) Source #
Get the type of the ith element of a Tuple along with the element itself.
tupleTypeTermAt _ i (Tuple [a0, ... , an] term) =
(ai, term {ai} (\(x0 : a0) ... (xn : an) -> xi)) tupleTermAt :: forall term (uni :: Type -> Type) fun m ann. (TermLike term TyName Name uni fun, MonadQuote m) => ann -> Int -> Tuple term uni ann -> m (term ann) Source #
Get the ith element of a Tuple.
tupleDefAt :: forall term (uni :: Type -> Type) fun m ann. (TermLike term TyName Name uni fun, MonadQuote m) => ann -> Int -> Name -> Tuple term uni ann -> m (TermDef term TyName Name uni ann) Source #
bindTuple :: forall term (uni :: Type -> Type) fun m ann. (TermLike term TyName Name uni fun, MonadQuote m) => ann -> [Name] -> Tuple term uni ann -> term ann -> m (term ann) Source #
prodN :: forall (uni :: Type -> Type). Int -> Type TyName uni () Source #
Given an arity n, create the n-ary product type.
(T_1 :: *) .. (T_n :: *) . all (R :: *) . (T_1 -> .. -> T_n -> R) -> R
prodNConstructor :: forall term (uni :: Type -> Type) fun. TermLike term TyName Name uni fun => Int -> term () Source #
Given an arity n, create the constructor for n-ary products.
/(T_1 :: *) .. (T_n :: *) .
(arg_1 : T_1) .. (arg_n : T_n) .
/(R :: *).
(case : T_1 -> .. -> T_n -> R) -> case arg_1 .. arg_n
prodNAccessor :: forall term (uni :: Type -> Type) fun. TermLike term TyName Name uni fun => Int -> Int -> term () Source #
Given an arity n and an index i, create a function for accessing the i'th component of a n-tuple.
/(T_1 :: *) .. (T_n :: *) .
(tuple : all (R :: *) . (T_1 -> .. -> T_n -> R) -> R)) .
tuple {T_i} ((arg_1 : T_1) .. (arg_n : T_n) . arg_i)