plutus-tx-1.60.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 #

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) # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Internal

Methods

showsPrec :: Int -> Definition t ts -> ShowS #

show :: Definition t ts -> String #

showList :: [Definition t ts] -> ShowS #

data Definitions ts where #

A registry of schema definitions.

Constructors

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

Instances

Instances details
Show (Definitions ts) # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Internal

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

Add a schema definition to a registry.

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

type HasSchemaDefinition t ts = HasSchemaDefinition' t ts ts #

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 ... #

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)