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

PlutusTx.Blueprint.Definition.Unroll

Synopsis

Documentation

type family UnrollAll xs ∷ [Type] where ... Source #

Equations

UnrollAll '[] = '[] 
UnrollAll (x ': xs) = Concat (Unroll x) (UnrollAll xs) 

type family Unroll (p ∷ Type) ∷ [Type] where ... Source #

Unroll a type into a list of all nested types (including the type itself).

If a type doesn't have a generic representation, then this type family gets "stuck". The good news is that for the purpose of deriving schema definitions, we only need to consider types that are either end-user defined (and therefore have a generic representation) or built-in types that we explicitly list here as terminals in order not to get "stuck".

type family Break e (rep ∷ TypeType) ∷ TypeType where ... Source #

Equations

Break _ (M1 a b c) = M1 a b c 
Break _ (f :*: g) = f :*: g 
Break _ (f :+: g) = f :+: g 
Break _ (K1 a b) = K1 a b 
Break e U1 = U1 
Break e x = e 

type family NoGeneric t where ... Source #

Equations

NoGeneric x = TypeError (Text "No instance for " :<>: ShowType (Generic x)) 

type family GUnroll (t ∷ TypeType) ∷ [Type] where ... Source #

Unroll a generic representation of a type into a list of all nested types.

Equations

GUnroll (M1 _ _ f) = GUnroll f 
GUnroll (f :*: g) = GUnroll f ++ GUnroll g 
GUnroll (f :+: g) = GUnroll f ++ GUnroll g 
GUnroll (K1 _ c) = Unroll c 
GUnroll U1 = '[] 

type family Insert x xs where ... Source #

Insert x into xs unless it's already there.

Equations

Insert x '[] = '[x] 
Insert x (x : xs) = x ': xs 
Insert x (y : xs) = y ': Insert x xs 

type family Prepend x xs where ... Source #

Equations

Prepend x '[] = '[x] 
Prepend x (x : xs) = x ': xs 
Prepend x (y : xs) = x ': (y ': xs) 

type family Concat (as ∷ [k]) (bs ∷ [k]) ∷ [k] where ... Source #

Concatenates two type-level lists

Equations

Concat '[] bs = bs 
Concat as '[] = as 
Concat (a : as) bs = a ': Concat as bs 

type family (as ∷ [k]) ++ (bs ∷ [k]) ∷ [k] where ... infixr 5 Source #

Concatenates two type-level lists removing duplicates.

Equations

'[] ++ bs = bs 
as ++ '[] = as 
(a : as) ++ bs = Insert a (as ++ bs) 

class Unrollable ts where Source #

This class and its two instances are used internally to derive Definitions for a given list of types.

Methods

unrollDefinitions ts Source #

Instances

Instances details
Unrollable ('[] ∷ [Type]) Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Methods

unrollDefinitions '[] Source #

(Unrollable ts, AsDefinitionId t, HasSchema t ts) ⇒ Unrollable (t ': ts) Source # 
Instance details

Defined in PlutusTx.Blueprint.Definition.Unroll

Methods

unrollDefinitions (t ': ts) Source #