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

PlutusTx.Maybe

Synopsis

Documentation

data Maybe a Source #

The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as Just a), or it is empty (represented as Nothing). Using Maybe is a good way to deal with errors or exceptional cases without resorting to drastic measures such as error.

The Maybe type is also a monad. It is a simple kind of error monad, where all errors are represented by Nothing. A richer error monad can be built using the Either type.

Constructors

Nothing 
Just a 

Instances

Instances details
FromJSON1 Maybe 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSONMaybe a → (Value → Parser a) → (Value → Parser [a]) → Value → Parser (Maybe a)

liftParseJSONListMaybe a → (Value → Parser a) → (Value → Parser [a]) → Value → Parser [Maybe a]

liftOmittedFieldMaybe a → Maybe (Maybe a)

ToJSON1 Maybe 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON ∷ (a → Bool) → (a → Value) → ([a] → Value) → Maybe a → Value

liftToJSONList ∷ (a → Bool) → (a → Value) → ([a] → Value) → [Maybe a] → Value

liftToEncoding ∷ (a → Bool) → (a → Encoding) → ([a] → Encoding) → Maybe a → Encoding

liftToEncodingList ∷ (a → Bool) → (a → Encoding) → ([a] → Encoding) → [Maybe a] → Encoding

liftOmitField ∷ (a → Bool) → Maybe a → Bool

MonadFail Maybe

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Fail

Methods

failStringMaybe a Source #

Foldable Maybe

Since: base-2.1

Instance details

Defined in Data.Foldable

Methods

foldMonoid m ⇒ Maybe m → m Source #

foldMapMonoid m ⇒ (a → m) → Maybe a → m Source #

foldMap'Monoid m ⇒ (a → m) → Maybe a → m Source #

foldr ∷ (a → b → b) → b → Maybe a → b Source #

foldr' ∷ (a → b → b) → b → Maybe a → b Source #

foldl ∷ (b → a → b) → b → Maybe a → b Source #

foldl' ∷ (b → a → b) → b → Maybe a → b Source #

foldr1 ∷ (a → a → a) → Maybe a → a Source #

foldl1 ∷ (a → a → a) → Maybe a → a Source #

toListMaybe a → [a] Source #

nullMaybe a → Bool Source #

lengthMaybe a → Int Source #

elemEq a ⇒ a → Maybe a → Bool Source #

maximumOrd a ⇒ Maybe a → a Source #

minimumOrd a ⇒ Maybe a → a Source #

sumNum a ⇒ Maybe a → a Source #

productNum a ⇒ Maybe a → a Source #

Traversable Maybe

Since: base-2.1

Instance details

Defined in Data.Traversable

Methods

traverseApplicative f ⇒ (a → f b) → Maybe a → f (Maybe b) Source #

sequenceAApplicative f ⇒ Maybe (f a) → f (Maybe a) Source #

mapMMonad m ⇒ (a → m b) → Maybe a → m (Maybe b) Source #

sequenceMonad m ⇒ Maybe (m a) → m (Maybe a) Source #

Alternative Maybe

Picks the leftmost Just value, or, alternatively, Nothing.

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

emptyMaybe a Source #

(<|>)Maybe a → Maybe a → Maybe a Source #

someMaybe a → Maybe [a] Source #

manyMaybe a → Maybe [a] Source #

Applicative Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

pure ∷ a → Maybe a Source #

(<*>)Maybe (a → b) → Maybe a → Maybe b Source #

liftA2 ∷ (a → b → c) → Maybe a → Maybe b → Maybe c Source #

(*>)Maybe a → Maybe b → Maybe b Source #

(<*)Maybe a → Maybe b → Maybe a Source #

Functor Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

fmap ∷ (a → b) → Maybe a → Maybe b Source #

(<$) ∷ a → Maybe b → Maybe a Source #

Monad Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

(>>=)Maybe a → (a → Maybe b) → Maybe b Source #

(>>)Maybe a → Maybe b → Maybe b Source #

return ∷ a → Maybe a Source #

MonadPlus Maybe

Picks the leftmost Just value, or, alternatively, Nothing.

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

mzeroMaybe a Source #

mplusMaybe a → Maybe a → Maybe a Source #

MonadFailure Maybe 
Instance details

Defined in Basement.Monad

Associated Types

type Failure Maybe

Methods

mFail ∷ Failure MaybeMaybe ()

NFData1 Maybe

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf ∷ (a → ()) → Maybe a → () Source #

Hashable1 Maybe 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt ∷ (Int → a → Int) → IntMaybe a → Int

Applicative Maybe Source # 
Instance details

Defined in PlutusTx.Applicative

Methods

pure ∷ a → Maybe a Source #

(<*>)Maybe (a → b) → Maybe a → Maybe b Source #

Foldable Maybe Source # 
Instance details

Defined in PlutusTx.Foldable

Methods

foldr ∷ (a → b → b) → b → Maybe a → b Source #

Functor Maybe Source # 
Instance details

Defined in PlutusTx.Functor

Methods

fmap ∷ (a → b) → Maybe a → Maybe b Source #

Traversable Maybe Source # 
Instance details

Defined in PlutusTx.Traversable

Methods

traverseApplicative f ⇒ (a → f b) → Maybe a → f (Maybe b) Source #

Generic1 Maybe 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 Maybe ∷ k → Type Source #

Methods

from1 ∷ ∀ (a ∷ k). Maybe a → Rep1 Maybe a Source #

to1 ∷ ∀ (a ∷ k). Rep1 Maybe a → Maybe a Source #

FoldableWithIndex () Maybe 
Instance details

Defined in WithIndex

Methods

ifoldMapMonoid m ⇒ (() → a → m) → Maybe a → m

ifoldMap'Monoid m ⇒ (() → a → m) → Maybe a → m

ifoldr ∷ (() → a → b → b) → b → Maybe a → b

ifoldl ∷ (() → b → a → b) → b → Maybe a → b

ifoldr' ∷ (() → a → b → b) → b → Maybe a → b

ifoldl' ∷ (() → b → a → b) → b → Maybe a → b

FunctorWithIndex () Maybe 
Instance details

Defined in WithIndex

Methods

imap ∷ (() → a → b) → Maybe a → Maybe b

TraversableWithIndex () Maybe 
Instance details

Defined in WithIndex

Methods

itraverseApplicative f ⇒ (() → a → f b) → Maybe a → f (Maybe b)

MonadBaseControl Maybe Maybe 
Instance details

Defined in Control.Monad.Trans.Control

Associated Types

type StM Maybe a

Methods

liftBaseWith ∷ (RunInBase Maybe MaybeMaybe a) → Maybe a

restoreM ∷ StM Maybe a → Maybe a

MonadError () Maybe 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError ∷ () → Maybe a

catchErrorMaybe a → (() → Maybe a) → Maybe a

(Typeable DefaultUni a, Lift DefaultUni a) ⇒ Lift DefaultUni (Maybe a) Source # 
Instance details

Defined in PlutusTx.Lift.Instances

PrettyBy config a ⇒ DefaultPrettyBy config (Maybe a) 
Instance details

Defined in Text.PrettyBy.Internal

Methods

defaultPrettyBy ∷ config → Maybe a → Doc ann Source #

defaultPrettyListBy ∷ config → [Maybe a] → Doc ann Source #

PrettyDefaultBy config (Maybe a) ⇒ PrettyBy config (Maybe a)

By default a [Maybe a] is converted to [a] first and only then pretty-printed.

>>> braces $ prettyBy () (Just True)
{True}
>>> braces $ prettyBy () (Nothing :: Maybe Bool)
{}
>>> prettyBy () [Just False, Nothing, Just True]
[False, True]
>>> prettyBy () [Nothing, Just 'a', Just 'b', Nothing, Just 'c']
abc
Instance details

Defined in Text.PrettyBy.Internal

Methods

prettyBy ∷ config → Maybe a → Doc ann Source #

prettyListBy ∷ config → [Maybe a] → Doc ann Source #

Lift a ⇒ Lift (Maybe a ∷ Type) 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

liftQuote m ⇒ Maybe a → m Exp Source #

liftTyped ∷ ∀ (m ∷ TypeType). Quote m ⇒ Maybe a → Code m (Maybe a) Source #

FromJSON a ⇒ FromJSON (Maybe a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON ∷ Value → Parser (Maybe a)

parseJSONList ∷ Value → Parser [Maybe a]

omittedFieldMaybe (Maybe a)

ToJSON a ⇒ ToJSON (Maybe a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSONMaybe a → Value

toEncodingMaybe a → Encoding

toJSONList ∷ [Maybe a] → Value

toEncodingList ∷ [Maybe a] → Encoding

omitFieldMaybe a → Bool

Graph g ⇒ Graph (Maybe g) 
Instance details

Defined in Algebra.Graph.Class

Associated Types

type Vertex (Maybe g)

Methods

emptyMaybe g

vertex ∷ Vertex (Maybe g) → Maybe g

overlayMaybe g → Maybe g → Maybe g

connectMaybe g → Maybe g → Maybe g

Preorder g ⇒ Preorder (Maybe g) 
Instance details

Defined in Algebra.Graph.Class

Reflexive g ⇒ Reflexive (Maybe g) 
Instance details

Defined in Algebra.Graph.Class

Transitive g ⇒ Transitive (Maybe g) 
Instance details

Defined in Algebra.Graph.Class

Undirected g ⇒ Undirected (Maybe g) 
Instance details

Defined in Algebra.Graph.Class

Data a ⇒ Data (Maybe a)

Since: base-4.0.0.0

Instance details

Defined in Data.Data

Methods

gfoldl ∷ (∀ d b. Data d ⇒ c (d → b) → d → c b) → (∀ g. g → c g) → Maybe a → c (Maybe a) Source #

gunfold ∷ (∀ b r. Data b ⇒ c (b → r) → c r) → (∀ r. r → c r) → Constr → c (Maybe a) Source #

toConstrMaybe a → Constr Source #

dataTypeOfMaybe a → DataType Source #

dataCast1Typeable t ⇒ (∀ d. Data d ⇒ c (t d)) → Maybe (c (Maybe a)) Source #

dataCast2Typeable t ⇒ (∀ d e. (Data d, Data e) ⇒ c (t d e)) → Maybe (c (Maybe a)) Source #

gmapT ∷ (∀ b. Data b ⇒ b → b) → Maybe a → Maybe a Source #

gmapQl ∷ (r → r' → r) → r → (∀ d. Data d ⇒ d → r') → Maybe a → r Source #

gmapQr ∷ ∀ r r'. (r' → r → r) → r → (∀ d. Data d ⇒ d → r') → Maybe a → r Source #

gmapQ ∷ (∀ d. Data d ⇒ d → u) → Maybe a → [u] Source #

gmapQiInt → (∀ d. Data d ⇒ d → u) → Maybe a → u Source #

gmapMMonad m ⇒ (∀ d. Data d ⇒ d → m d) → Maybe a → m (Maybe a) Source #

gmapMpMonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → Maybe a → m (Maybe a) Source #

gmapMoMonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → Maybe a → m (Maybe a) Source #

Semigroup a ⇒ Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S."

Since 4.11.0: constraint on inner a value generalised from Monoid to Semigroup.

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

memptyMaybe a Source #

mappendMaybe a → Maybe a → Maybe a Source #

mconcat ∷ [Maybe a] → Maybe a Source #

Semigroup a ⇒ Semigroup (Maybe a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(<>)Maybe a → Maybe a → Maybe a Source #

sconcatNonEmpty (Maybe a) → Maybe a Source #

stimesIntegral b ⇒ b → Maybe a → Maybe a Source #

Generic (Maybe a) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (Maybe a) ∷ TypeType Source #

Methods

fromMaybe a → Rep (Maybe a) x Source #

toRep (Maybe a) x → Maybe a Source #

SingKind a ⇒ SingKind (Maybe a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Associated Types

type DemoteRep (Maybe a)

Methods

fromSing ∷ ∀ (a0 ∷ Maybe a). Sing a0 → DemoteRep (Maybe a)

Read a ⇒ Read (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Read

Show a ⇒ Show (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Show

Methods

showsPrecIntMaybe a → ShowS Source #

showMaybe a → String Source #

showList ∷ [Maybe a] → ShowS Source #

Default (Maybe a) 
Instance details

Defined in Data.Default.Class

Methods

defMaybe a #

NFData a ⇒ NFData (Maybe a) 
Instance details

Defined in Control.DeepSeq

Methods

rnfMaybe a → () Source #

Eq a ⇒ Eq (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Maybe

Methods

(==)Maybe a → Maybe a → Bool Source #

(/=)Maybe a → Maybe a → Bool Source #

Ord a ⇒ Ord (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Maybe

Methods

compareMaybe a → Maybe a → Ordering Source #

(<)Maybe a → Maybe a → Bool Source #

(<=)Maybe a → Maybe a → Bool Source #

(>)Maybe a → Maybe a → Bool Source #

(>=)Maybe a → Maybe a → Bool Source #

maxMaybe a → Maybe a → Maybe a Source #

minMaybe a → Maybe a → Maybe a Source #

Hashable a ⇒ Hashable (Maybe a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSaltIntMaybe a → Int

hashMaybe a → Int

At (Maybe a) 
Instance details

Defined in Control.Lens.At

Methods

at ∷ Index (Maybe a) → Lens' (Maybe a) (Maybe (IxValue (Maybe a)))

Ixed (Maybe a) 
Instance details

Defined in Control.Lens.At

Methods

ix ∷ Index (Maybe a) → Traversal' (Maybe a) (IxValue (Maybe a))

AsEmpty (Maybe a) 
Instance details

Defined in Control.Lens.Empty

Methods

_Empty ∷ Prism' (Maybe a) ()

MonoFoldable (Maybe a) 
Instance details

Defined in Data.MonoTraversable

Methods

ofoldMapMonoid m ⇒ (Element (Maybe a) → m) → Maybe a → m

ofoldr ∷ (Element (Maybe a) → b → b) → b → Maybe a → b

ofoldl' ∷ (a0 → Element (Maybe a) → a0) → a0 → Maybe a → a0

otoListMaybe a → [Element (Maybe a)]

oall ∷ (Element (Maybe a) → Bool) → Maybe a → Bool

oany ∷ (Element (Maybe a) → Bool) → Maybe a → Bool

onullMaybe a → Bool

olengthMaybe a → Int

olength64Maybe a → Int64

ocompareLengthIntegral i ⇒ Maybe a → i → Ordering

otraverse_Applicative f ⇒ (Element (Maybe a) → f b) → Maybe a → f ()

ofor_Applicative f ⇒ Maybe a → (Element (Maybe a) → f b) → f ()

omapM_Applicative m ⇒ (Element (Maybe a) → m ()) → Maybe a → m ()

oforM_Applicative m ⇒ Maybe a → (Element (Maybe a) → m ()) → m ()

ofoldlMMonad m ⇒ (a0 → Element (Maybe a) → m a0) → a0 → Maybe a → m a0

ofoldMap1ExSemigroup m ⇒ (Element (Maybe a) → m) → Maybe a → m

ofoldr1Ex ∷ (Element (Maybe a) → Element (Maybe a) → Element (Maybe a)) → Maybe a → Element (Maybe a)

ofoldl1Ex' ∷ (Element (Maybe a) → Element (Maybe a) → Element (Maybe a)) → Maybe a → Element (Maybe a)

headExMaybe a → Element (Maybe a)

lastExMaybe a → Element (Maybe a)

unsafeHeadMaybe a → Element (Maybe a)

unsafeLastMaybe a → Element (Maybe a)

maximumByEx ∷ (Element (Maybe a) → Element (Maybe a) → Ordering) → Maybe a → Element (Maybe a)

minimumByEx ∷ (Element (Maybe a) → Element (Maybe a) → Ordering) → Maybe a → Element (Maybe a)

oelem ∷ Element (Maybe a) → Maybe a → Bool

onotElem ∷ Element (Maybe a) → Maybe a → Bool

MonoFunctor (Maybe a) 
Instance details

Defined in Data.MonoTraversable

Methods

omap ∷ (Element (Maybe a) → Element (Maybe a)) → Maybe a → Maybe a

MonoPointed (Maybe a) 
Instance details

Defined in Data.MonoTraversable

Methods

opoint ∷ Element (Maybe a) → Maybe a

MonoTraversable (Maybe a) 
Instance details

Defined in Data.MonoTraversable

Methods

otraverseApplicative f ⇒ (Element (Maybe a) → f (Element (Maybe a))) → Maybe a → f (Maybe a)

omapMApplicative m ⇒ (Element (Maybe a) → m (Element (Maybe a))) → Maybe a → m (Maybe a)

Eq a ⇒ Eq (Maybe a) Source # 
Instance details

Defined in PlutusTx.Eq

Methods

(==)Maybe a → Maybe a → Bool Source #

FromData a ⇒ FromData (Maybe a) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

ToData a ⇒ ToData (Maybe a) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

UnsafeFromData a ⇒ UnsafeFromData (Maybe a) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

Semigroup a ⇒ Monoid (Maybe a) Source # 
Instance details

Defined in PlutusTx.Monoid

Methods

memptyMaybe a Source #

Ord a ⇒ Ord (Maybe a) Source # 
Instance details

Defined in PlutusTx.Ord

Methods

compareMaybe a → Maybe a → Ordering Source #

(<)Maybe a → Maybe a → Bool Source #

(<=)Maybe a → Maybe a → Bool Source #

(>)Maybe a → Maybe a → Bool Source #

(>=)Maybe a → Maybe a → Bool Source #

maxMaybe a → Maybe a → Maybe a Source #

minMaybe a → Maybe a → Maybe a Source #

Semigroup a ⇒ Semigroup (Maybe a) Source # 
Instance details

Defined in PlutusTx.Semigroup

Methods

(<>)Maybe a → Maybe a → Maybe a Source #

Show a ⇒ Show (Maybe a) Source # 
Instance details

Defined in PlutusTx.Show

Pretty a ⇒ Pretty (Maybe a) 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyMaybe a → Doc ann #

prettyList ∷ [Maybe a] → Doc ann #

Corecursive (Maybe a) 
Instance details

Defined in Data.Functor.Foldable

Methods

embed ∷ Base (Maybe a) (Maybe a) → Maybe a

ana ∷ (a0 → Base (Maybe a) a0) → a0 → Maybe a

apo ∷ (a0 → Base (Maybe a) (Either (Maybe a) a0)) → a0 → Maybe a

postpro ∷ Recursive (Maybe a) ⇒ (∀ b. Base (Maybe a) b → Base (Maybe a) b) → (a0 → Base (Maybe a) a0) → a0 → Maybe a

gpostpro ∷ (Recursive (Maybe a), Monad m) ⇒ (∀ b. m (Base (Maybe a) b) → Base (Maybe a) (m b)) → (∀ c. Base (Maybe a) c → Base (Maybe a) c) → (a0 → Base (Maybe a) (m a0)) → a0 → Maybe a

Recursive (Maybe a) 
Instance details

Defined in Data.Functor.Foldable

Methods

projectMaybe a → Base (Maybe a) (Maybe a)

cata ∷ (Base (Maybe a) a0 → a0) → Maybe a → a0

para ∷ (Base (Maybe a) (Maybe a, a0) → a0) → Maybe a → a0

gpara ∷ (Corecursive (Maybe a), Comonad w) ⇒ (∀ b. Base (Maybe a) (w b) → w (Base (Maybe a) b)) → (Base (Maybe a) (EnvT (Maybe a) w a0) → a0) → Maybe a → a0

prepro ∷ Corecursive (Maybe a) ⇒ (∀ b. Base (Maybe a) b → Base (Maybe a) b) → (Base (Maybe a) a0 → a0) → Maybe a → a0

gprepro ∷ (Corecursive (Maybe a), Comonad w) ⇒ (∀ b. Base (Maybe a) (w b) → w (Base (Maybe a) b)) → (∀ c. Base (Maybe a) c → Base (Maybe a) c) → (Base (Maybe a) (w a0) → a0) → Maybe a → a0

Serialise a ⇒ Serialise (Maybe a) 
Instance details

Defined in Codec.Serialise.Class

Methods

encodeMaybe a → Encoding

decode ∷ Decoder s (Maybe a)

encodeList ∷ [Maybe a] → Encoding

decodeList ∷ Decoder s [Maybe a]

Pretty a ⇒ Pretty (Maybe a) 
Instance details

Defined in Text.PrettyPrint.Annotated.WL

Methods

prettyMaybe a → Doc b

prettyList ∷ [Maybe a] → Doc b

SingI ('NothingMaybe a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing ∷ Sing 'Nothing

Each (Maybe a) (Maybe b) a b 
Instance details

Defined in Control.Lens.Each

Methods

each ∷ Traversal (Maybe a) (Maybe b) a b

Each (Maybe a) (Maybe b) a b 
Instance details

Defined in Lens.Micro.Internal

Methods

each ∷ Traversal (Maybe a) (Maybe b) a b

SingI a2 ⇒ SingI ('Just a2 ∷ Maybe a1)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing ∷ Sing ('Just a2)

Typeable DefaultUni Maybe Source # 
Instance details

Defined in PlutusTx.Lift.Instances

type Failure Maybe 
Instance details

Defined in Basement.Monad

type Failure Maybe = ()
type Rep1 Maybe

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Rep1 Maybe = D1 ('MetaData "Maybe" "GHC.Maybe" "base" 'False) (C1 ('MetaCons "Nothing" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "Just" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type StM Maybe a 
Instance details

Defined in Control.Monad.Trans.Control

type StM Maybe a = a
type Vertex (Maybe g) 
Instance details

Defined in Algebra.Graph.Class

type Vertex (Maybe g) = Vertex g
type DemoteRep (Maybe a) 
Instance details

Defined in GHC.Generics

type DemoteRep (Maybe a) = Maybe (DemoteRep a)
type Rep (Maybe a)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Rep (Maybe a) = D1 ('MetaData "Maybe" "GHC.Maybe" "base" 'False) (C1 ('MetaCons "Nothing" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "Just" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
data Sing (b ∷ Maybe a) 
Instance details

Defined in GHC.Generics

data Sing (b ∷ Maybe a) where
type Index (Maybe a) 
Instance details

Defined in Control.Lens.At

type Index (Maybe a) = ()
type IxValue (Maybe a) 
Instance details

Defined in Control.Lens.At

type IxValue (Maybe a) = a
type Element (Maybe a) 
Instance details

Defined in Data.MonoTraversable

type Element (Maybe a) = a
type Base (Maybe a) 
Instance details

Defined in Data.Functor.Foldable

type Base (Maybe a) = Const (Maybe a) ∷ TypeType

isJustMaybe a → Bool Source #

Check if a Maybe a is Just a

>>> isJust Nothing
False
>>> isJust (Just "plutus")
True

isNothingMaybe a → Bool Source #

Check if a Maybe a is Nothing

>>> isNothing Nothing
True
>>> isNothing (Just "plutus")
False

maybe ∷ b → (a → b) → Maybe a → b Source #

Plutus Tx version of maybe.

>>> maybe "platypus" (\s -> s) (Just "plutus")
"plutus"
>>> maybe "platypus" (\s -> s) Nothing
"platypus"

fromMaybe ∷ a → Maybe a → a Source #

Plutus Tx version of fromMaybe

mapMaybe ∷ (a → Maybe b) → [a] → [b] Source #

Plutus Tx version of mapMaybe.

>>> mapMaybe (\i -> if i == 2 then Just '2' else Nothing) [1, 2, 3, 4]
"2"