Copyright | [2018..2020] The Accelerate Team |
---|---|
License | BSD3 |
Maintainer | Trevor L. McDonell <trevor.mcdonell@gmail.com> |
Stability | experimental |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Since: 1.2.0.0
Synopsis
- data Maybe a
- pattern Nothing_ :: forall a. (HasCallStack, Elt a) => Exp (Maybe a)
- pattern Just_ :: forall a. (HasCallStack, Elt a) => Exp 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: base-2.1 |
Functor Maybe | Since: base-2.1 |
MonadFix Maybe | Since: base-2.1 |
Defined in Control.Monad.Fix | |
MonadFail Maybe | Since: base-4.9.0.0 |
Defined in Control.Monad.Fail | |
Applicative Maybe | Since: base-2.1 |
Foldable Maybe | Since: base-2.1 |
Defined in Data.Foldable fold :: Monoid m => Maybe m -> m # foldMap :: Monoid m => (a -> m) -> Maybe a -> 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: base-2.1 |
Eq1 Maybe | Since: base-4.9.0.0 |
Ord1 Maybe | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Read1 Maybe | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Show1 Maybe | Since: base-4.9.0.0 |
Alternative Maybe | Since: base-2.1 |
MonadPlus Maybe | Since: base-2.1 |
MonadFailure Maybe | |
MonadThrow Maybe | |
Defined in Control.Monad.Catch | |
NFData1 Maybe | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
Hashable1 Maybe | |
Defined in Data.Hashable.Class | |
Functor Maybe Source # | |
MonadBaseControl Maybe 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 # | |
Lift a => Lift (Maybe a :: Type) | |
(Lift Exp a, Elt (Plain a)) => Lift Exp (Maybe a) Source # | |
Eq a => Eq (Maybe a) | Since: base-2.1 |
Ord a => Ord (Maybe a) | Since: base-2.1 |
Read a => Read (Maybe a) | Since: base-2.1 |
Show a => Show (Maybe a) | Since: base-2.1 |
Generic (Maybe a) | Since: base-4.6.0.0 |
Semigroup a => Semigroup (Maybe a) | Since: base-4.9.0.0 |
(Semigroup (Exp a), Elt a) => Semigroup (Exp (Maybe a)) Source # | |
Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner Since: base-2.1 |
(Monoid (Exp a), Elt a) => Monoid (Exp (Maybe a)) Source # | |
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) | Ignore
|
Defined in Data.Text.Prettyprint.Doc.Internal | |
Pretty a => Pretty (Maybe a) | |
Defined in Text.PrettyPrint.Annotated.WL | |
SingKind a => SingKind (Maybe a) | Since: base-4.9.0.0 |
Defined in GHC.Generics type DemoteRep (Maybe a) | |
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 | Since: base-4.6.0.0 |
SingI ('Nothing :: Maybe a) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
Each (Maybe a) (Maybe b) a b |
|
SingI a2 => SingI ('Just a2 :: Maybe a1) | Since: base-4.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) | |
Defined in GHC.Generics | |
type Index (Maybe a) | |
Defined in Control.Lens.At | |
type IxValue (Maybe a) | |
Defined in Control.Lens.At | |
type DemoteRep (Maybe a) | |
Defined in GHC.Generics | |
data Sing (b :: Maybe a) | |
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 # | |
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 # |