plutus-tx
Safe HaskellNone
LanguageHaskell2010

PlutusTx.Blueprint.Definition.Internal

Description

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

Synopsis

Documentation

data Definition (t :: k) (ts :: [Type]) 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 :: [Type]) where Source #

A registry of schema definitions.

Constructors

NoDefinitions :: forall (ts :: [Type]). Definitions ts 
AddDefinition :: forall {k} (t :: k) (ts :: [Type]). Definition t ts -> Definitions ts -> Definitions ts 

Instances

Instances details
Show (Definitions ts) Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Internal

addDefinition :: forall {k} (ts :: [Type]) (t :: k). Definitions ts -> Definition t ts -> Definitions ts Source #

Add a schema definition to a registry.

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

type HasSchemaDefinition t (ts :: [Type]) = 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 :: [Type]) (xs0 :: [Type]) where ... Source #

Equations

HasSchemaDefinition' x (x ': xs) _1 = () 
HasSchemaDefinition' x (_1 ': 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) :: Constraint