| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusTx.Blueprint.Definition.Unroll
Synopsis
- class HasBlueprintDefinition (t ∷ Type) where
- type Unroll t ∷ [Type]
- definitionId ∷ DefinitionId
- type family UnrollIsStuckError x where ...
- type family RepIsStuckError x where ...
- type Unrolled t = Reverse (IfStuckUnroll (UnrollIsStuckError t) (Unroll t))
- type family UnrollAll xs ∷ [Type] where ...
- type family GUnroll (t ∷ Type → Type) ∷ [Type] where ...
Documentation
class HasBlueprintDefinition (t ∷ Type) 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 #
type Unroll t = Insert t (GUnroll (IfStuckRep (RepIsStuckError t) (Rep t)))
Methods
definitionId ∷ DefinitionId Source #
default definitionId ∷ Typeable t ⇒ DefinitionId Source #
Instances
type family UnrollIsStuckError x 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 = 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.") |
type family RepIsStuckError x where ... Source #
Compile-time error that happens when type's generic representation is not defined
(Rep TF is "stuck")
Equations
| RepIsStuckError x = 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.") |
type Unrolled t = Reverse (IfStuckUnroll (UnrollIsStuckError t) (Unroll t)) Source #
Same as Unroll but with a nicer error message