Copyright  [2018] Trevor L. McDonell 

License  BSD3 
Maintainer  Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> 
Stability  experimental 
Portability  nonportable (GHC extensions) 
Safe Haskell  None 
Language  Haskell2010 
Since: 1.2.0.0
Synopsis
 data Maybe a
 just :: Elt a => Exp a > Exp (Maybe a)
 nothing :: forall a. Elt a => Exp (Maybe a)
 maybe :: (Elt a, Elt b) => Exp b > (Exp a > Exp b) > Exp (Maybe a) > Exp b
 isJust :: Elt a => Exp (Maybe a) > Exp Bool
 isNothing :: Elt a => Exp (Maybe a) > Exp Bool
 fromMaybe :: Elt a => Exp a > Exp (Maybe a) > Exp a
 fromJust :: Elt a => Exp (Maybe a) > Exp a
 justs :: (Shape sh, Slice sh, Elt a) => Acc (Array (sh :. Int) (Maybe a)) > Acc (Vector a, Array sh Int)
Documentation
The Maybe
type encapsulates an optional value. A value of type
either contains a value of type Maybe
aa
(represented as
),
or it is empty (represented as Just
aNothing
). 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.
Instances
Monad Maybe  Since: base2.1 
Functor Maybe  Since: base2.1 
MonadFix Maybe  Since: base2.1 
Defined in Control.Monad.Fix  
MonadFail Maybe  Since: base4.9.0.0 
Defined in Control.Monad.Fail  
Applicative Maybe  Since: base2.1 
Foldable Maybe  Since: base2.1 
Defined in Data.Foldable fold :: Monoid m => Maybe m > m # foldMap :: Monoid m => (a > m) > Maybe a > m # foldr :: (a > b > b) > b > Maybe a > b # foldr' :: (a > b > b) > b > Maybe a > b # foldl :: (b > a > b) > b > Maybe a > b # foldl' :: (b > a > b) > b > Maybe a > b # foldr1 :: (a > a > a) > Maybe a > a # foldl1 :: (a > a > a) > Maybe a > a # elem :: Eq a => a > Maybe a > Bool # maximum :: Ord a => Maybe a > a # minimum :: Ord a => Maybe a > a #  
Traversable Maybe  Since: base2.1 
Eq1 Maybe  Since: base4.9.0.0 
Ord1 Maybe  Since: base4.9.0.0 
Defined in Data.Functor.Classes  
Read1 Maybe  Since: base4.9.0.0 
Defined in Data.Functor.Classes  
Show1 Maybe  Since: base4.9.0.0 
Alternative Maybe  Since: base2.1 
MonadPlus Maybe  Since: base2.1 
MonadFailure Maybe  
MonadThrow Maybe  
Defined in Control.Monad.Catch  
NFData1 Maybe  Since: deepseq1.4.3.0 
Defined in Control.DeepSeq  
Hashable1 Maybe  
Defined in Data.Hashable.Class  
Functor Maybe #  
FunctorWithIndex () Maybe  
Defined in Control.Lens.Indexed  
FoldableWithIndex () Maybe  
TraversableWithIndex () Maybe  
Defined in Control.Lens.Indexed itraverse :: Applicative f => (() > a > f b) > Maybe a > f (Maybe b) # itraversed :: IndexedTraversal () (Maybe a) (Maybe b) a b #  
MonadBaseControl Maybe Maybe  
() :=> (Functor Maybe)  
() :=> (Applicative Maybe)  
Defined in Data.Constraint ins :: () : Applicative Maybe #  
() :=> (Alternative Maybe)  
Defined in Data.Constraint ins :: () : Alternative Maybe #  
() :=> (MonadPlus Maybe)  
(Lift Exp a, Elt (Plain a)) => Lift Exp (Maybe a) #  
Eq a => Eq (Maybe a)  Since: base2.1 
Ord a => Ord (Maybe a)  Since: base2.1 
Read a => Read (Maybe a)  Since: base2.1 
Show a => Show (Maybe a)  Since: base2.1 
Generic (Maybe a)  
Semigroup a => Semigroup (Maybe a)  Since: base4.9.0.0 
(Semigroup (Exp a), Elt a) => Semigroup (Exp (Maybe a)) #  
Semigroup a => Monoid (Maybe a)  Lift a semigroup into Since 4.11.0: constraint on inner Since: base2.1 
(Monoid (Exp a), Elt a) => Monoid (Exp (Maybe a)) #  
Lift a => Lift (Maybe a)  
Pretty a => Pretty (Maybe a)  
Defined in Text.PrettyPrint.ANSI.Leijen.Internal  
SingKind a => SingKind (Maybe a)  Since: base4.9.0.0 
NFData a => NFData (Maybe a)  
Defined in Control.DeepSeq  
Hashable a => Hashable (Maybe a)  
Defined in Data.Hashable.Class  
Ixed (Maybe a)  
Defined in Control.Lens.At  
At (Maybe a)  
AsEmpty (Maybe a)  
Defined in Control.Lens.Empty  
Pretty a => Pretty (Maybe a)  
Defined in Text.PrettyPrint.Annotated.WL  
Elt a => Elt (Maybe a) #  
Eq a => Eq (Maybe a) #  
Ord a => Ord (Maybe a) #  
Defined in Data.Array.Accelerate.Data.Maybe (<) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool # (>) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool # (<=) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool # (>=) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool # min :: Exp (Maybe a) > Exp (Maybe a) > Exp (Maybe a) #  
Generic1 Maybe  
SingI (Nothing :: Maybe a)  Since: base4.9.0.0 
Defined in GHC.Generics  
(Eq a) :=> (Eq (Maybe a))  
(Ord a) :=> (Ord (Maybe a))  
(Read a) :=> (Read (Maybe a))  
(Show a) :=> (Show (Maybe a))  
(Semigroup a) :=> (Semigroup (Maybe a))  
(Monoid a) :=> (Monoid (Maybe a))  
Each (Maybe a) (Maybe b) a b 

SingI a2 => SingI (Just a2 :: Maybe a1)  Since: base4.9.0.0 
Defined in GHC.Generics  
type Failure Maybe  
Defined in Basement.Monad  
type StM Maybe a  
Defined in Control.Monad.Trans.Control  
type Rep (Maybe a)  Since: base4.6.0.0 
data Sing (b :: Maybe a)  
type DemoteRep (Maybe a)  
Defined in GHC.Generics  
type Index (Maybe a)  
Defined in Control.Lens.At  
type IxValue (Maybe a)  
Defined in Control.Lens.At  
type Plain (Maybe a) #  
Defined in Data.Array.Accelerate.Data.Maybe  
type Rep1 Maybe  Since: base4.6.0.0 
justs :: (Shape sh, Slice sh, Elt a) => Acc (Array (sh :. Int) (Maybe a)) > Acc (Vector a, Array sh Int) #
Extract from an array all of the Just
values, together with a segment
descriptor indicating how many elements along each dimension were returned.
Orphan instances
Functor Maybe #  
(Lift Exp a, Elt (Plain a)) => Lift Exp (Maybe a) #  
(Semigroup (Exp a), Elt a) => Semigroup (Exp (Maybe a)) #  
(Monoid (Exp a), Elt a) => Monoid (Exp (Maybe a)) #  
Elt a => Elt (Maybe a) #  
Eq a => Eq (Maybe a) #  
Ord a => Ord (Maybe a) #  
(<) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool # (>) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool # (<=) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool # (>=) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool # min :: Exp (Maybe a) > Exp (Maybe a) > Exp (Maybe a) # 