plutarch
Safe HaskellNone
LanguageGHC2021

Plutarch.Repr.Tag

Synopsis

Documentation

newtype PTag (struct :: [S -> Type]) (s :: S) Source #

Since: 1.10.0

Constructors

PTag 

Fields

Instances

Instances details
PlutusType (PTag struct) Source # 
Instance details

Defined in Plutarch.Repr.Tag

Associated Types

type PInner (PTag struct)

Since: plutarch-1.10.0

Instance details

Defined in Plutarch.Repr.Tag

type PInner (PTag struct) = PInner (DeriveNewtypePlutusType (PTag struct))

Methods

pcon' :: forall (s :: S). PTag struct s -> Term s (PInner (PTag struct)) Source #

pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PTag struct)) -> (PTag struct s -> Term s b) -> Term s b Source #

Generic (PTag struct s) Source # 
Instance details

Defined in Plutarch.Repr.Tag

Associated Types

type Rep (PTag struct s) 
Instance details

Defined in Plutarch.Repr.Tag

type Rep (PTag struct s) = D1 ('MetaData "PTag" "Plutarch.Repr.Tag" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'True) (C1 ('MetaCons "PTag" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PInteger))))

Methods

from :: PTag struct s -> Rep (PTag struct s) x Source #

to :: Rep (PTag struct s) x -> PTag struct s Source #

Generic (PTag struct s) Source #

Since: 1.10.0

Instance details

Defined in Plutarch.Repr.Tag

Associated Types

type Code (PTag struct s) 
Instance details

Defined in Plutarch.Repr.Tag

type Code (PTag struct s) = GCode (PTag struct s)

Methods

from :: PTag struct s -> Rep (PTag struct s)

to :: Rep (PTag struct s) -> PTag struct s

type PInner (PTag struct) Source #

Since: 1.10.0

Instance details

Defined in Plutarch.Repr.Tag

type PInner (PTag struct) = PInner (DeriveNewtypePlutusType (PTag struct))
type Rep (PTag struct s) Source # 
Instance details

Defined in Plutarch.Repr.Tag

type Rep (PTag struct s) = D1 ('MetaData "PTag" "Plutarch.Repr.Tag" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'True) (C1 ('MetaCons "PTag" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PInteger))))
type Code (PTag struct s) Source # 
Instance details

Defined in Plutarch.Repr.Tag

type Code (PTag struct s) = GCode (PTag struct s)

newtype DeriveAsTag (a :: S -> Type) (s :: S) Source #

Since: 1.10.0

Constructors

DeriveAsTag 

Fields

Instances

Instances details
(PlutusType (DeriveAsTag a), Generic (a (Any :: S)), TagTypeConstraints (Any :: S) a struct) => PLiftable (DeriveAsTag a) Source # 
Instance details

Defined in Plutarch.Repr.Tag

Associated Types

type AsHaskell (DeriveAsTag a) 
Instance details

Defined in Plutarch.Repr.Tag

type AsHaskell (DeriveAsTag a) = a (Any :: S)
type PlutusRepr (DeriveAsTag a) 
Instance details

Defined in Plutarch.Repr.Tag

Generic (a (Any :: S)) => PValidateData (DeriveAsTag a) Source #

Checks that we have an I, and that it is in the range [0, n - 1], where n is the number of 'arms' in the encoded sum type.

Since: 1.12.0

Instance details

Defined in Plutarch.Internal.Parse

Methods

pwithValidated :: forall (s :: S). Term s PData -> forall (r :: S -> Type). Term s r -> Term s r Source #

(forall (s :: S). TagTypeConstraints s a struct) => PlutusType (DeriveAsTag a) Source #

This derives tag-only PlutusType automatically. Resulted instances will use PInteger as underlying type, making this much more efficient than using regular DataScottSOP based encoding. As name suggests, types with no-argument constructors can use this.

Example: @@ data PFoo s = A | B | C | D | E deriving stock (GHC.Generic, Show) deriving anyclass (PEq, PIsData) deriving (PlutusType, PLiftable) via DeriveAsTag PFoo

instance SOP.Generic (PFoo s) @@

Since: 1.10.0

Instance details

Defined in Plutarch.Repr.Tag

Associated Types

type PInner (DeriveAsTag a) 
Instance details

Defined in Plutarch.Repr.Tag

Methods

pcon' :: forall (s :: S). DeriveAsTag a s -> Term s (PInner (DeriveAsTag a)) Source #

pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsTag a)) -> (DeriveAsTag a s -> Term s b) -> Term s b Source #

type AsHaskell (DeriveAsTag a) Source # 
Instance details

Defined in Plutarch.Repr.Tag

type AsHaskell (DeriveAsTag a) = a (Any :: S)
type PlutusRepr (DeriveAsTag a) Source # 
Instance details

Defined in Plutarch.Repr.Tag

type PInner (DeriveAsTag a) Source # 
Instance details

Defined in Plutarch.Repr.Tag

newtype TagLiftHelper r (struct :: [[Type]]) Source #

Since: 1.10.0

Constructors

TagLiftHelper 

Fields