Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
PlutusTx.Blueprint.Definition.Internal
Description
This module provides a functionality to derive and reference schema definitions.
Synopsis
- data Definitions (ts ∷ [Type]) where
- NoDefinitions ∷ Definitions '[]
- AddDefinition ∷ Definition t ts → Definitions ts → Definitions (t ': ts)
- data Definition t ts = MkDefinition DefinitionId (Schema ts)
- definition ∷ ∀ t ts. (AsDefinitionId t, HasSchema t ts) ⇒ Definition t ts
- definitionRef ∷ ∀ t ts. (AsDefinitionId t, HasSchemaDefinition t ts) ⇒ Schema ts
- addDefinition ∷ Definitions ts → Definition t ts → Definitions (t ': ts)
- definitionsToMap ∷ Definitions ts → (∀ xs. Schema xs → v) → Map DefinitionId v
- type family HasSchemaDefinition n xs where ...
Documentation
data Definitions (ts ∷ [Type]) where Source #
A registry of schema definitions.
Constructors
NoDefinitions ∷ Definitions '[] | |
AddDefinition ∷ Definition t ts → Definitions ts → Definitions (t ': ts) |
Instances
Show (Definitions ts) Source # | |
Defined in PlutusTx.Blueprint.Definition.Internal |
data Definition t ts Source #
A schema definition of a type t
with a list of referenced types ts
.
Constructors
MkDefinition DefinitionId (Schema ts) |
Instances
Show (Definition t ts) Source # | |
Defined in PlutusTx.Blueprint.Definition.Internal |
definition ∷ ∀ t ts. (AsDefinitionId t, HasSchema t ts) ⇒ Definition t ts Source #
Construct a schema definition.
definitionRef ∷ ∀ t ts. (AsDefinitionId t, HasSchemaDefinition t ts) ⇒ Schema ts Source #
Construct a schema that is a reference to a schema definition.
addDefinition ∷ Definitions ts → Definition t ts → Definitions (t ': ts) Source #
Add a schema definition to a registry.
definitionsToMap ∷ Definitions ts → (∀ xs. Schema xs → v) → Map DefinitionId v Source #
type family HasSchemaDefinition n xs where ... Source #
A constraint that checks if a schema definition is present in a list of schema definitions. Gives a user-friendly error message if the schema definition is not found.
Equations
HasSchemaDefinition x (x ': xs) = () | |
HasSchemaDefinition x (_ ': xs) = HasSchemaDefinition x xs | |
HasSchemaDefinition n xs = TypeError (ShowType n :<>: Text " type was not found in the list of types having schema definitions.") |