| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusTx.Blueprint.Definition.Internal
Description
This module provides a functionality to derive and reference schema definitions.
Synopsis
- data Definition t ts = MkDefinition DefinitionId (Schema ts)
- data Definitions ts where
- NoDefinitions :: Definitions ts
- AddDefinition :: Definition t ts -> Definitions ts -> Definitions ts
- addDefinition :: Definitions ts -> Definition t ts -> Definitions ts
- definitionsToMap :: Definitions ts -> (forall xs. Schema xs -> v) -> Map DefinitionId v
- type HasSchemaDefinition t ts = HasSchemaDefinition' t ts ts
- type family HasSchemaDefinition' n xs xs0 where ...
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
| Show (Definition t ts) # | |
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
| Show (Definitions ts) # | |
Defined in PlutusTx.Blueprint.Definition.Internal Methods showsPrec :: Int -> Definitions ts -> ShowS # show :: Definitions ts -> String # showList :: [Definitions ts] -> ShowS # | |
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) |