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: 2.1 
Functor Maybe  Since: 2.1 
MonadFix Maybe  Since: 2.1 
MonadFail Maybe  Since: 4.9.0.0 
Applicative Maybe  Since: 2.1 
Foldable Maybe  Since: 2.1 
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: 2.1 
Eq1 Maybe  Since: 4.9.0.0 
Ord1 Maybe  Since: 4.9.0.0 
Read1 Maybe  Since: 4.9.0.0 
Show1 Maybe  Since: 4.9.0.0 
Alternative Maybe  Since: 2.1 
MonadPlus Maybe  Since: 2.1 
MonadFailure Maybe  
MonadThrow Maybe  
NFData1 Maybe  Since: 1.4.3.0 
Hashable1 Maybe  
Functor Maybe Source #  
FunctorWithIndex () Maybe  
FoldableWithIndex () Maybe  
ifoldMap :: Monoid m => (() > a > m) > Maybe a > m # ifolded :: (Indexable () p, Contravariant f, Applicative f) => p a (f a) > Maybe a > f (Maybe a) # ifoldr :: (() > a > b > b) > b > Maybe a > b # ifoldl :: (() > b > a > b) > b > Maybe a > b #  
TraversableWithIndex () Maybe  
itraverse :: Applicative f => (() > a > f b) > Maybe a > f (Maybe b) # itraversed :: (Indexable () p, Applicative f) => p a (f b) > Maybe a > f (Maybe b) #  
MonadBaseControl Maybe Maybe  
() :=> (Functor Maybe)  
() :=> (Applicative Maybe)  
ins :: () : Applicative Maybe #  
() :=> (Alternative Maybe)  
ins :: () : Alternative Maybe #  
() :=> (MonadPlus Maybe)  
(Lift Exp a, Elt (Plain a)) => Lift Exp (Maybe a) Source #  
Eq a => Eq (Maybe a)  
Ord a => Ord (Maybe a)  
Read a => Read (Maybe a)  Since: 2.1 
Show a => Show (Maybe a)  
Generic (Maybe a)  
Semigroup a => Semigroup (Maybe a)  Since: 4.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: 2.1 
(Monoid (Exp a), Elt a) => Monoid (Exp (Maybe a)) #  
Lift a => Lift (Maybe a)  
Pretty a => Pretty (Maybe a)  
SingKind a => SingKind (Maybe a)  Since: 4.9.0.0 
NFData a => NFData (Maybe a)  
Hashable a => Hashable (Maybe a)  
Ixed (Maybe a)  
At (Maybe a)  
AsEmpty (Maybe a)  
Pretty a => Pretty (Maybe a)  
Elt a => Elt (Maybe a) Source #  
Eq a => Eq (Maybe a) Source #  
Ord a => Ord (Maybe a) Source #  
(<) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool Source # (>) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool Source # (<=) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool Source # (>=) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool Source # min :: Exp (Maybe a) > Exp (Maybe a) > Exp (Maybe a) Source # max :: Exp (Maybe a) > Exp (Maybe a) > Exp (Maybe a) Source # compare :: Exp (Maybe a) > Exp (Maybe a) > Exp Ordering Source #  
Generic1 Maybe  
SingI (Nothing :: Maybe a)  Since: 4.9.0.0 
(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: 4.9.0.0 
type Failure Maybe  
type StM Maybe a  
type Rep (Maybe a)  
data Sing (b :: Maybe a)  
type DemoteRep (Maybe a)  
type Index (Maybe a)  
type IxValue (Maybe a)  
type Plain (Maybe a) Source #  
type Rep1 Maybe  
isJust :: Elt a => Exp (Maybe a) > Exp Bool Source #
Returns True
if the argument is of the form Just _
justs :: (Shape sh, Slice sh, Elt a) => Acc (Array (sh :. Int) (Maybe a)) > Acc (Vector a, Array sh Int) Source #
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 Source #  
(Lift Exp a, Elt (Plain a)) => Lift Exp (Maybe a) Source #  
(Semigroup (Exp a), Elt a) => Semigroup (Exp (Maybe a)) Source #  
(Monoid (Exp a), Elt a) => Monoid (Exp (Maybe a)) Source #  
Elt a => Elt (Maybe a) Source #  
Eq a => Eq (Maybe a) Source #  
Ord a => Ord (Maybe a) Source #  
(<) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool Source # (>) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool Source # (<=) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool Source # (>=) :: Exp (Maybe a) > Exp (Maybe a) > Exp Bool Source # min :: Exp (Maybe a) > Exp (Maybe a) > Exp (Maybe a) Source # max :: Exp (Maybe a) > Exp (Maybe a) > Exp (Maybe a) Source # compare :: Exp (Maybe a) > Exp (Maybe a) > Exp Ordering Source # 