plutarch-1.9.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Plutarch.Maybe

Synopsis

Type

data PMaybe (a :: S -> Type) (s :: S) Source #

Plutus Maybe type, with Scott-encoded repr

Constructors

PJust (Term s a) 
PNothing 

Instances

Instances details
PEq a => PEq (PMaybe a) Source # 
Instance details

Defined in Plutarch.Maybe

Methods

(#==) :: forall (s :: S). Term s (PMaybe a) -> Term s (PMaybe a) -> Term s PBool Source #

PLiftable a => PLiftable (PMaybe a) Source #

@since WIP

Instance details

Defined in Plutarch.Maybe

Associated Types

type AsHaskell (PMaybe a) Source #

type PlutusRepr (PMaybe a) Source #

DerivePlutusType (PMaybe a) Source # 
Instance details

Defined in Plutarch.Maybe

Associated Types

type DPTStrat (PMaybe a) Source #

PlutusType (PMaybe a) Source # 
Instance details

Defined in Plutarch.Maybe

Associated Types

type PInner (PMaybe a) :: PType Source #

type PCovariant' (PMaybe a) Source #

type PContravariant' (PMaybe a) Source #

type PVariant' (PMaybe a) Source #

Methods

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

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

PShow a => PShow (PMaybe a) Source #

@since WIP

Instance details

Defined in Plutarch.Internal.Show

Methods

pshow' :: forall (s :: S). Bool -> Term s (PMaybe a) -> Term s PString Source #

Generic (PMaybe a s) Source # 
Instance details

Defined in Plutarch.Maybe

Associated Types

type Rep (PMaybe a s) :: Type -> Type Source #

Methods

from :: PMaybe a s -> Rep (PMaybe a s) x Source #

to :: Rep (PMaybe a s) x -> PMaybe a s Source #

type AsHaskell (PMaybe a) Source # 
Instance details

Defined in Plutarch.Maybe

type PlutusRepr (PMaybe a) Source # 
Instance details

Defined in Plutarch.Maybe

type DPTStrat (PMaybe a) Source # 
Instance details

Defined in Plutarch.Maybe

type PContravariant' (PMaybe a) Source # 
Instance details

Defined in Plutarch.Maybe

type PCovariant' (PMaybe a) Source # 
Instance details

Defined in Plutarch.Maybe

type PInner (PMaybe a) Source # 
Instance details

Defined in Plutarch.Maybe

type PVariant' (PMaybe a) Source # 
Instance details

Defined in Plutarch.Maybe

type PVariant' (PMaybe a) = All2 PVariant'' (PCode (PMaybe a))
type Rep (PMaybe a s) Source # 
Instance details

Defined in Plutarch.Maybe

type Rep (PMaybe a s) = D1 ('MetaData "PMaybe" "Plutarch.Maybe" "plutarch-1.9.0-FtN0mhIoM9oEvz7Q98pjWP" 'False) (C1 ('MetaCons "PJust" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s a))) :+: C1 ('MetaCons "PNothing" 'PrefixI 'False) (U1 :: Type -> Type))

data PMaybeSoP (a :: S -> Type) (s :: S) Source #

@since WIP

Constructors

PJustSoP (Term s a) 
PNothingSoP 

Instances

Instances details
PEq a => PEq (PMaybeSoP a) Source # 
Instance details

Defined in Plutarch.Maybe

Methods

(#==) :: forall (s :: S). Term s (PMaybeSoP a) -> Term s (PMaybeSoP a) -> Term s PBool Source #

PLiftable a => PLiftable (PMaybeSoP a) Source #

@since WIP

Instance details

Defined in Plutarch.Maybe

Associated Types

type AsHaskell (PMaybeSoP a) Source #

type PlutusRepr (PMaybeSoP a) Source #

PlutusType (PMaybeSoP a) Source # 
Instance details

Defined in Plutarch.Maybe

Methods

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

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

PShow a => PShow (PMaybeSoP a) Source #

@since WIP

Instance details

Defined in Plutarch.Internal.Show

Methods

pshow' :: forall (s :: S). Bool -> Term s (PMaybeSoP a) -> Term s PString Source #

Generic (PMaybeSoP a s) Source # 
Instance details

Defined in Plutarch.Maybe

Associated Types

type Rep (PMaybeSoP a s) :: Type -> Type Source #

Methods

from :: PMaybeSoP a s -> Rep (PMaybeSoP a s) x Source #

to :: Rep (PMaybeSoP a s) x -> PMaybeSoP a s Source #

Generic (PMaybeSoP a s) Source # 
Instance details

Defined in Plutarch.Maybe

Associated Types

type Code (PMaybeSoP a s) :: [[Type]]

Methods

from :: PMaybeSoP a s -> Rep (PMaybeSoP a s)

to :: Rep (PMaybeSoP a s) -> PMaybeSoP a s

type AsHaskell (PMaybeSoP a) Source # 
Instance details

Defined in Plutarch.Maybe

type PlutusRepr (PMaybeSoP a) Source # 
Instance details

Defined in Plutarch.Maybe

type PContravariant' (PMaybeSoP a) Source # 
Instance details

Defined in Plutarch.Maybe

type PCovariant' (PMaybeSoP a) Source # 
Instance details

Defined in Plutarch.Maybe

type PInner (PMaybeSoP a) Source #

@since WIP

Instance details

Defined in Plutarch.Maybe

type PVariant' (PMaybeSoP a) Source # 
Instance details

Defined in Plutarch.Maybe

type Rep (PMaybeSoP a s) Source # 
Instance details

Defined in Plutarch.Maybe

type Rep (PMaybeSoP a s) = D1 ('MetaData "PMaybeSoP" "Plutarch.Maybe" "plutarch-1.9.0-FtN0mhIoM9oEvz7Q98pjWP" 'False) (C1 ('MetaCons "PJustSoP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s a))) :+: C1 ('MetaCons "PNothingSoP" 'PrefixI 'False) (U1 :: Type -> Type))
type Code (PMaybeSoP a s) Source # 
Instance details

Defined in Plutarch.Maybe

type Code (PMaybeSoP a s) = GCode (PMaybeSoP a s)

Functions

Introduction

pjust :: forall (a :: S -> Type) (s :: S). Term s (a :--> PMaybe a) Source #

Construct a PJust value.

@since WIP

pnothing :: forall (a :: S -> Type) (s :: S). Term s (PMaybe a) Source #

Construct a PNothing value.

@since WIP

Predicates

pisJust :: forall (a :: S -> Type) (s :: S). Term s (PMaybe a :--> PBool) Source #

Yields true if the given PMaybe value is of form PJust _.

@since WIP

Eliminators

pfromJust :: forall (a :: S -> Type) (s :: S). Term s (PMaybe a :--> a) Source #

Extracts the element out of a PJust and throws an error if its argument is PNothing.

ptraceIfNothing Source #

Arguments

:: forall (a :: S -> Type) (s :: S). Term s PString

The custom error message.

-> Term s (PMaybe a) 
-> Term s a 

Extracts the element out of a PJust and throws a custom error if it's given a PNothing.

@since WIP

pfromMaybe :: forall (a :: S -> Type) (s :: S). Term s (a :--> (PMaybe a :--> a)) Source #

Extract a PMaybe by providing a default value in case of PJust.

@since WIP

pmaybe :: forall (b :: S -> Type) (a :: S -> Type) (s :: S). Term s (b :--> ((a :--> b) :--> (PMaybe a :--> b))) Source #

Given a default value, a function and a PMaybe value, yields the default value if the PMaybe value is PNothing and applies the function to the value stored in the PJust otherwise.

@since WIP

passertPJust :: forall (a :: S -> Type) (s :: S). Term s (PString :--> (PMaybe a :--> a)) Source #

Extract the value stored in a PMaybe container. If there's no value, throw an error with the given message.

@since WIP

pmapMaybe :: Term s ((a :--> b) :--> (PMaybe a :--> PMaybe b)) Source #

Map underlying value if PMaybe is PJust, do nothing if it is PNothing

@since WIP

Conversions