plutus-core-1.30.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.RandomAccessList.Class

Synopsis

Documentation

class RandomAccessList e where Source #

Typeclass for various types implementing the "signature" of a random-access list.

A true random-access list should have good asymptotic behaviour for these methods also, but for convenience we also provide implementations for e.g. '[a]', which has bad lookup performance.

Minimal complete definition

empty, cons, uncons, length

Associated Types

type Element e ∷ Type Source #

The type of elements in the list.

Methods

empty ∷ e Source #

The empty list.

consElement e → e → e Source #

Prepend an element to the list.

uncons ∷ e → Maybe (Element e, e) Source #

Un-prepend an element to the list.

length ∷ e → Word64 Source #

Get the length of the list. May have linear complexity, but useful.

consSlab ∷ NonEmptyVector (Element e) → e → e Source #

Prepend many elements to the list. Has a default implementation, but implementations can provide more efficient ones.

indexZero ∷ e → Word64Maybe (Element e) Source #

Lookup an element in the list. 0-based index.

indexOne ∷ e → Word64Maybe (Element e) Source #

Lookup an element in the list. 1-based index.

unsafeIndexZero ∷ e → Word64Element e Source #

Lookup an element in the list, partially.

unsafeIndexOne ∷ e → Word64Element e Source #

Lookup an element in the list, partially.

Instances

Instances details
RandomAccessList (RelativizedMap a) Source # 
Instance details

Defined in Data.RandomAccessList.RelativizedMap

Associated Types

type Element (RelativizedMap a) Source #

RandomAccessList (RAList a) Source # 
Instance details

Defined in Data.RandomAccessList.SkewBinary

Associated Types

type Element (RAList a) Source #

RandomAccessList (RAList a) Source # 
Instance details

Defined in Data.RandomAccessList.SkewBinarySlab

Associated Types

type Element (RAList a) Source #

RandomAccessList (RAList a) Source # 
Instance details

Defined in Data.RandomAccessList.Class

Associated Types

type Element (RAList a) Source #

Methods

empty ∷ RAList a Source #

consElement (RAList a) → RAList a → RAList a Source #

uncons ∷ RAList a → Maybe (Element (RAList a), RAList a) Source #

length ∷ RAList a → Word64 Source #

consSlab ∷ NonEmptyVector (Element (RAList a)) → RAList a → RAList a Source #

indexZero ∷ RAList a → Word64Maybe (Element (RAList a)) Source #

indexOne ∷ RAList a → Word64Maybe (Element (RAList a)) Source #

unsafeIndexZero ∷ RAList a → Word64Element (RAList a) Source #

unsafeIndexOne ∷ RAList a → Word64Element (RAList a) Source #

RandomAccessList [a] Source # 
Instance details

Defined in Data.RandomAccessList.Class

Associated Types

type Element [a] Source #

Methods

empty ∷ [a] Source #

consElement [a] → [a] → [a] Source #

uncons ∷ [a] → Maybe (Element [a], [a]) Source #

length ∷ [a] → Word64 Source #

consSlab ∷ NonEmptyVector (Element [a]) → [a] → [a] Source #

indexZero ∷ [a] → Word64Maybe (Element [a]) Source #

indexOne ∷ [a] → Word64Maybe (Element [a]) Source #

unsafeIndexZero ∷ [a] → Word64Element [a] Source #

unsafeIndexOne ∷ [a] → Word64Element [a] Source #

head ∷ (RandomAccessList e, a ~ Element e) ⇒ e → a Source #

tailRandomAccessList e ⇒ e → e Source #

newtype AsRAL a Source #

Constructors

AsRAL a 

Instances

Instances details
RandomAccessList e ⇒ IsList (AsRAL e) Source # 
Instance details

Defined in Data.RandomAccessList.Class

Associated Types

type Item (AsRAL e) Source #

Methods

fromList ∷ [Item (AsRAL e)] → AsRAL e Source #

fromListNInt → [Item (AsRAL e)] → AsRAL e Source #

toListAsRAL e → [Item (AsRAL e)] Source #

type Item (AsRAL e) Source # 
Instance details

Defined in Data.RandomAccessList.Class

type Item (AsRAL e) = Element e