plutus-tx
Safe HaskellNone
LanguageHaskell2010

PlutusTx.Blueprint.Definition.Unroll

Synopsis

Documentation

class HasBlueprintDefinition t where Source #

Designates a class of types that could be used as a Blueprint Definition. Each such type: - could be unrolled to a list of all nested types (including the type itself). - has a unique DefinitionId.

Minimal complete definition

Nothing

Associated Types

type Unroll t :: [Type] Source #

Methods

definitionId :: DefinitionId Source #

default definitionId :: Typeable t => DefinitionId Source #

Derive a DefinitionId for a type.

Instances

Instances details
HasBlueprintDefinition Void Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll Void 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

type Unroll Void = '[Void]
HasBlueprintDefinition BuiltinByteString Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

HasBlueprintDefinition BuiltinData Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll BuiltinData 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

HasBlueprintDefinition BuiltinString Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll BuiltinString 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

HasBlueprintDefinition BuiltinUnit Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll BuiltinUnit 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

HasBlueprintDefinition Rational Source # 
Instance details

Defined in PlutusTx.Ratio

Associated Types

type Unroll Rational 
Instance details

Defined in PlutusTx.Ratio

HasBlueprintDefinition Integer Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll Integer 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

HasBlueprintDefinition () Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll () 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

type Unroll () = '[()]
HasBlueprintDefinition Bool Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll Bool 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

type Unroll Bool = '[Bool]
HasBlueprintDefinition Int Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll Int 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

type Unroll Int = '[Int]
HasBlueprintDefinition a => HasBlueprintDefinition (BuiltinList a) Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll (BuiltinList a) 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

HasBlueprintDefinition a => HasBlueprintDefinition (Maybe a) Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll (Maybe a) 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

type Unroll (Maybe a) = Insert (Maybe a) (Unrolled a)
HasBlueprintDefinition a => HasBlueprintDefinition [a] Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll [a] 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

type Unroll [a] = Insert [a] (Unrolled a)
(HasBlueprintDefinition k, HasBlueprintDefinition v) => HasBlueprintDefinition (Map k v) Source # 
Instance details

Defined in PlutusTx.AssocMap

Associated Types

type Unroll (Map k v) 
Instance details

Defined in PlutusTx.AssocMap

type Unroll (Map k v) = '[Map k v, k, v]
(HasBlueprintDefinition a, HasBlueprintDefinition b) => HasBlueprintDefinition (BuiltinPair a b) Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll (BuiltinPair a b) 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

(Typeable a, Typeable b) => HasBlueprintDefinition (These a b) Source # 
Instance details

Defined in PlutusTx.These

Associated Types

type Unroll (These a b) 
Instance details

Defined in PlutusTx.These

type Unroll (These a b) = Insert (These a b) (GUnroll (IfStuckRep (RepIsStuckError (These a b) :: Type -> Type) (Rep (These a b))))
(HasBlueprintDefinition a, HasBlueprintDefinition b) => HasBlueprintDefinition (a, b) Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll (a, b) 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

type Unroll (a, b) = Insert (a, b) (Unrolled a ++ Unrolled b)
(HasBlueprintDefinition a, HasBlueprintDefinition b, HasBlueprintDefinition c) => HasBlueprintDefinition (a, b, c) Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Associated Types

type Unroll (a, b, c) 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

type Unroll (a, b, c) = Insert (a, b, c) (Unrolled a ++ (Unrolled b ++ Unrolled c))

type family UnrollIsStuckError (x :: t) :: k where ... Source #

Compile-time error that happens when a type couldn't be unrolled (Unroll TF is "stuck").

Note: This error commonly occurs when using 'DefinitionsFor (UnrollAll '[a])' with an abstract type variable a. Type families like UnrollAll must be fully evaluated at compile time, which is not possible when the type is not yet known.

Equations

UnrollIsStuckError (x :: t) = TypeError ((((((((((('Text "Cannot unroll type '" ':<>: 'ShowType x) ':<>: 'Text "'.") ':$$: 'Text "The 'Unroll' type family is stuck because:") ':$$: 'Text " - The type may be abstract (a type variable), or") ':$$: 'Text " - It lacks a 'HasBlueprintDefinition' instance, or") ':$$: 'Text " - It lacks a 'Generic' instance for default unrolling.") ':$$: 'Text "") ':$$: 'Text "Tip: 'DefinitionsFor (UnrollAll ts)' requires all types in 'ts'") ':$$: 'Text "to be concrete at compile time. Polymorphic constraints like") ':$$: 'Text "'DefinitionsFor (UnrollAll '[a])' cannot be used as superclass") ':$$: 'Text "constraints because 'a' is not known when the class is defined.") :: k 

type family RepIsStuckError (x :: t) :: k where ... Source #

Compile-time error that happens when type's generic representation is not defined (Rep TF is "stuck")

Equations

RepIsStuckError (x :: t) = TypeError ((((('Text "Cannot derive generic representation for type '" ':<>: 'ShowType x) ':<>: 'Text "'.") ':$$: 'Text "Add 'deriving Generic' to enable automatic blueprint unrolling,") ':$$: 'Text "or provide a manual 'HasBlueprintDefinition' instance with") ':$$: 'Text "an explicit 'Unroll' type instance.") :: k 

type Unrolled t = Reverse (IfStuckUnroll (UnrollIsStuckError t :: [Type]) (Unroll t)) Source #

Same as Unroll but with a nicer error message

type family UnrollAll (xs :: [Type]) :: [Type] where ... Source #

Unrolls all types in the list xs

Equations

UnrollAll ('[] :: [Type]) = '[] :: [Type] 
UnrollAll (x ': xs) = Nub (Concat (Unrolled x) (UnrollAll xs)) 

type family GUnroll (t :: Type -> Type) :: [Type] where ... Source #

Unroll a generic representation of a type into a list of all nested types.

Equations

GUnroll (M1 _1 _2 f) = GUnroll f 
GUnroll (f :*: g) = GUnroll f ++ GUnroll g 
GUnroll (f :+: g) = GUnroll f ++ GUnroll g 
GUnroll (K1 _1 c :: Type -> Type) = Unrolled c 
GUnroll (U1 :: Type -> Type) = '[] :: [Type]