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: accelerate1.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 Source #  
FunctorWithIndex () Maybe  
FoldableWithIndex () Maybe  
Defined in Control.Lens.Indexed 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  
Defined in Control.Lens.Indexed 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)  
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) Source #  
Eq a => Eq (Maybe a)  
Ord a => Ord (Maybe a)  
Read a => Read (Maybe a)  Since: base2.1 
Show a => Show (Maybe a)  
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) Source #  
Eq a => Eq (Maybe a) Source #  
Ord a => Ord (Maybe a) Source #  
Defined in Data.Array.Accelerate.Data.Maybe (<) :: 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: 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)  
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) Source #  
Defined in Data.Array.Accelerate.Data.Maybe  
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 # 