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

PlutusTx.Blueprint.Definition.Internal

Description

This module provides a functionality to derive and reference schema definitions.

Synopsis

Documentation

data Definitions (ts ∷ [Type]) where Source #

A registry of schema definitions.

Constructors

NoDefinitionsDefinitions '[] 
AddDefinitionDefinition t ts → Definitions ts → Definitions (t ': ts) 

Instances

Instances details
Show (Definitions ts) Source # 
Instance details

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

Instances details
Show (Definition t ts) Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Internal

Methods

showsPrecIntDefinition t ts → ShowS Source #

showDefinition t ts → String Source #

showList ∷ [Definition t ts] → ShowS Source #

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.

addDefinitionDefinitions ts → Definition t ts → Definitions (t ': ts) Source #

Add a schema definition to a registry.

definitionsToMapDefinitions 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.")