cabal-gild-1.1.4.0: Formats package descriptions.
Safe HaskellSafe-Inferred
LanguageHaskell2010

CabalGild.Type.Optional

Synopsis

Documentation

data Optional a Source #

Represents a value that may or may not be present. Isomorphic to Maybe. Useful to distinguish between a value not being given and a value happening to be the same as the default.

Constructors

Default 
Specific a 

Instances

Instances details
Show a => Show (Optional a) Source # 
Instance details

Defined in CabalGild.Type.Optional

Methods

showsPrec :: Int -> Optional a -> ShowS #

show :: Optional a -> String #

showList :: [Optional a] -> ShowS #

Eq a => Eq (Optional a) Source # 
Instance details

Defined in CabalGild.Type.Optional

Methods

(==) :: Optional a -> Optional a -> Bool #

(/=) :: Optional a -> Optional a -> Bool #

withDefault :: a -> Optional a -> a Source #

Uses the provided default value if the optional is Default, otherwise gets the value out of the Specific. Similar to fromMaybe.

optional :: b -> (a -> b) -> Optional a -> b Source #

Basic destructor, similar to maybe.