plutus-tx-1.36.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 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

data Definitions ts where Source #

A registry of schema definitions.

Constructors

NoDefinitions :: Definitions ts 
AddDefinition :: Definition t ts -> Definitions ts -> Definitions ts 

Instances

Instances details
Show (Definitions ts) Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Internal

addDefinition :: Definitions ts -> Definition t ts -> Definitions ts Source #

Add a schema definition to a registry.

definitionsToMap :: Definitions ts -> (forall xs. Schema xs -> v) -> Map DefinitionId v Source #

type HasSchemaDefinition t ts = HasSchemaDefinition' t ts ts 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.

type family HasSchemaDefinition' n xs xs0 where ... Source #

Equations

HasSchemaDefinition' x (x ': xs) _ = () 
HasSchemaDefinition' x (_ ': xs) xs0 = HasSchemaDefinition' x xs xs0 
HasSchemaDefinition' n xs xs0 = TypeError ((ShowType n :<>: Text " type was not found in the list of types having schema definitions: ") :<>: ShowType xs0)