plutus-tx-1.43.0.0: Libraries for Plutus Tx and its prelude
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusTx.Data.List

Synopsis

Documentation

data List a Source #

A list type backed directly by Data. It is meant to be used whenever fast encodingdecoding tofrom Data is needed.

Instances

Instances details
Lift DefaultUni (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

Methods

liftList a → RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ()) Source #

Monoid (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

Methods

memptyList a Source #

mappendList a → List a → List a Source #

mconcat ∷ [List a] → List a Source #

Semigroup (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

Methods

(<>)List a → List a → List a Source #

sconcatNonEmpty (List a) → List a Source #

stimesIntegral b ⇒ b → List a → List a Source #

Show (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

Methods

showsPrecIntList a → ShowS Source #

showList a → String Source #

showList ∷ [List a] → ShowS Source #

Eq (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

Methods

(==)List a → List a → Bool Source #

(/=)List a → List a → Bool Source #

Eq (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

Methods

(==)List a → List a → Bool Source #

FromData (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

ToData (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

UnsafeFromData (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

Monoid (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

Methods

memptyList a Source #

Semigroup (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

Methods

(<>)List a → List a → List a Source #

(UnsafeFromData a, Pretty a) ⇒ Pretty (List a) Source # 
Instance details

Defined in PlutusTx.Data.List

Methods

prettyList a → Doc ann Source #

prettyList ∷ [List a] → Doc ann Source #

Typeable DefaultUni List Source # 
Instance details

Defined in PlutusTx.Data.List

toSOPUnsafeFromData a ⇒ List a → [a] Source #

Convert a data-backed list to a sums of products list. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

fromSOPToData a ⇒ [a] → List a Source #

Convert a sums of products list to a data-backed list. Warning: this function can be very inefficient if the list contains elements that are expensive to encode to BuiltinData.

nullList a → Bool Source #

appendList a → List a → List a Source #

findUnsafeFromData a ⇒ (a → Bool) → List a → Maybe a Source #

Find the first element that satisfies a predicate. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

findIndicesUnsafeFromData a ⇒ (a → Bool) → List a → List Integer Source #

Find the indices of all elements that satisfy a predicate. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

filter ∷ (UnsafeFromData a, ToData a) ⇒ (a → Bool) → List a → List a Source #

Filter a list using a predicate. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

mapMaybe ∷ (UnsafeFromData a, ToData b) ⇒ (a → Maybe b) → List a → List b Source #

Map a function over a list and discard the results that are Nothing. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData, or if the result of applying f is expensive to encode to BuiltinData.

anyUnsafeFromData a ⇒ (a → Bool) → List a → Bool Source #

Check if any element in the list satisfies a predicate. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

allUnsafeFromData a ⇒ (a → Bool) → List a → Bool Source #

Check if all elements in the list satisfy a predicate. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

foldMap ∷ (UnsafeFromData a, Monoid m) ⇒ (a → m) → List a → m Source #

Fold a list using a monoid. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

map ∷ (UnsafeFromData a, ToData b) ⇒ (a → b) → List a → List b Source #

Map a function over a list. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData, or if the result of applying f is expensive to encode to BuiltinData.

lengthList a → Integer Source #

Get the length of a list.

mconcat ∷ (Monoid a, UnsafeFromData a) ⇒ List a → a Source #

Concatenate a list of monoids. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

consToData a ⇒ a → List a → List a Source #

unconsUnsafeFromData a ⇒ List a → Maybe (a, List a) Source #

Get the first element of a list and the rest of the list.

andList BoolBool Source #

Check if all elements in the list are True. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

orList BoolBool Source #

Check if any element in the list is True. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

elemToData a ⇒ a → List a → Bool Source #

Check if an element is in the list. Note: this function can leverage the better performance of equality checks for BuiltinData.

notElemToData a ⇒ a → List a → Bool Source #

Check if an element is not in the list.

foldrUnsafeFromData a ⇒ (a → b → b) → b → List a → b Source #

Fold a list from the right. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

foldlUnsafeFromData a ⇒ (b → a → b) → b → List a → b Source #

Fold a list from the left. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

concatList (List a) → List a Source #

Flatten a list of lists into a single list.

concatMapUnsafeFromData a ⇒ (a → List b) → List a → List b Source #

Map a function over a list and concatenate the results.

listToMaybeUnsafeFromData a ⇒ List a → Maybe a Source #

Get the first element of a list if it is not empty.

uniqueElementUnsafeFromData a ⇒ List a → Maybe a Source #

Get the element of a list if it has exactly one element.

(!!)UnsafeFromData a ⇒ List a → Integer → a infixl 9 Source #

Get the element at a given index. Warning: this is a partial function and will fail if the index is negative or greater than the length of the list. Note: this function has the same precedence as (!!) from List.

revAppendList a → List a → List a Source #

Append two lists in reverse order.

reverseList a → List a Source #

Reverse a list.

replicateToData a ⇒ Integer → a → List a Source #

Replicate a value n times.

findIndexUnsafeFromData a ⇒ (a → Bool) → List a → Maybe Integer Source #

Find the index of the first element that satisfies a predicate. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

unzip ∷ ∀ a b. List (a, b) → (List a, List b) Source #

Split a list of pairs into a pair of lists.

zipWith ∷ (UnsafeFromData a, UnsafeFromData b, ToData c) ⇒ (a → b → c) → List a → List b → List c Source #

Zip two lists together using a function. Warning: this function can be very inefficient if the lists contain elements that are expensive to decode from BuiltinData, or if the result of applying f is expensive to encode to BuiltinData.

head ∷ ∀ a. UnsafeFromData a ⇒ List a → a Source #

Return the head of a list. Warning: this is a partial function and will fail if the list is empty.

last ∷ ∀ a. UnsafeFromData a ⇒ List a → a Source #

Return the last element of a list. Warning: this is a partial function and will fail if the list is empty.

tail ∷ ∀ a. List a → List a Source #

Return the tail of a list. Warning: this is a partial function and will fail if the list is empty.

take ∷ ∀ a. IntegerList a → List a Source #

Take the first n elements from the list.

drop ∷ ∀ a. IntegerList a → List a Source #

Drop the first n elements from the list.

dropWhile ∷ ∀ a. UnsafeFromData a ⇒ (a → Bool) → List a → List a Source #

Drop elements from the list while the predicate holds. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

splitAt ∷ ∀ a. IntegerList a → (List a, List a) Source #

Split a list at a given index.

elemByUnsafeFromData a ⇒ (a → a → Bool) → a → List a → Bool Source #

Check if an element satisfying a binary predicate is in the list. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

nubBy ∷ ∀ a. UnsafeFromData a ⇒ (a → a → Bool) → List a → List a Source #

Removes elements from the list that satisfy a binary predicate. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

nub ∷ (Eq a, UnsafeFromData a) ⇒ List a → List a Source #

Removes duplicate elements from the list. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.

partitionUnsafeFromData a ⇒ (a → Bool) → List a → (List a, List a) Source #

Partition a list into two lists based on a predicate. Warning: this function can be very inefficient if the list contains elements that are expensive to decode from BuiltinData.