accelerate-1.3.0.0: An embedded language for accelerated array processing
Copyright[2018..2020] The Accelerate Team
LicenseBSD3
MaintainerTrevor L. McDonell <trevor.mcdonell@gmail.com>
Stabilityexperimental
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Data.Array.Accelerate.Data.Maybe

Description

Since: 1.2.0.0

Synopsis

Documentation

data Maybe a #

The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as Just a), or it is empty (represented as Nothing). 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.

Constructors

Nothing 
Just a 

Instances

Instances details
Monad Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

(>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b #

(>>) :: Maybe a -> Maybe b -> Maybe b #

return :: a -> Maybe a #

Functor Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

fmap :: (a -> b) -> Maybe a -> Maybe b #

(<$) :: a -> Maybe b -> Maybe a #

MonadFix Maybe

Since: base-2.1

Instance details

Defined in Control.Monad.Fix

Methods

mfix :: (a -> Maybe a) -> Maybe a #

MonadFail Maybe

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Fail

Methods

fail :: String -> Maybe a #

Applicative Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

pure :: a -> Maybe a #

(<*>) :: Maybe (a -> b) -> Maybe a -> Maybe b #

liftA2 :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c #

(*>) :: Maybe a -> Maybe b -> Maybe b #

(<*) :: Maybe a -> Maybe b -> Maybe a #

Foldable Maybe

Since: base-2.1

Instance details

Defined in Data.Foldable

Methods

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 #

toList :: Maybe a -> [a] #

null :: Maybe a -> Bool #

length :: Maybe a -> Int #

elem :: Eq a => a -> Maybe a -> Bool #

maximum :: Ord a => Maybe a -> a #

minimum :: Ord a => Maybe a -> a #

sum :: Num a => Maybe a -> a #

product :: Num a => Maybe a -> a #

Traversable Maybe

Since: base-2.1

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> Maybe a -> f (Maybe b) #

sequenceA :: Applicative f => Maybe (f a) -> f (Maybe a) #

mapM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b) #

sequence :: Monad m => Maybe (m a) -> m (Maybe a) #

Eq1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> Maybe a -> Maybe b -> Bool #

Ord1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> Maybe a -> Maybe b -> Ordering #

Read1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Maybe a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Maybe a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Maybe a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Maybe a] #

Show1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Maybe a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Maybe a] -> ShowS #

Alternative Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

empty :: Maybe a #

(<|>) :: Maybe a -> Maybe a -> Maybe a #

some :: Maybe a -> Maybe [a] #

many :: Maybe a -> Maybe [a] #

MonadPlus Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

mzero :: Maybe a #

mplus :: Maybe a -> Maybe a -> Maybe a #

MonadFailure Maybe 
Instance details

Defined in Basement.Monad

Associated Types

type Failure Maybe #

Methods

mFail :: Failure Maybe -> Maybe () #

MonadThrow Maybe 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Maybe a #

NFData1 Maybe

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> Maybe a -> () #

Hashable1 Maybe 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> Maybe a -> Int #

Functor Maybe Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Maybe

Methods

fmap :: (Elt a, Elt b, Elt (Maybe a), Elt (Maybe b)) => (Exp a -> Exp b) -> Exp (Maybe a) -> Exp (Maybe b) Source #

(<$) :: (Elt a, Elt b, Elt (Maybe a), Elt (Maybe b)) => Exp a -> Exp (Maybe b) -> Exp (Maybe a) Source #

MonadBaseControl Maybe Maybe 
Instance details

Defined in Control.Monad.Trans.Control

Associated Types

type StM Maybe a #

FunctorWithIndex () Maybe 
Instance details

Defined in Control.Lens.Indexed

Methods

imap :: (() -> a -> b) -> Maybe a -> Maybe b #

imapped :: IndexedSetter () (Maybe a) (Maybe b) a b #

FoldableWithIndex () Maybe 
Instance details

Defined in Control.Lens.Indexed

Methods

ifoldMap :: Monoid m => (() -> a -> m) -> Maybe a -> m #

ifolded :: IndexedFold () (Maybe a) a #

ifoldr :: (() -> a -> b -> b) -> b -> Maybe a -> b #

ifoldl :: (() -> b -> a -> b) -> b -> Maybe a -> b #

ifoldr' :: (() -> a -> b -> b) -> b -> Maybe a -> b #

ifoldl' :: (() -> b -> a -> b) -> b -> Maybe a -> b #

TraversableWithIndex () Maybe 
Instance details

Defined in Control.Lens.Indexed

Methods

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) 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

lift :: Maybe a -> Q Exp #

liftTyped :: Maybe a -> Q (TExp (Maybe a)) #

(Lift Exp a, Elt (Plain a)) => Lift Exp (Maybe a) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Maybe

Associated Types

type Plain (Maybe a) Source #

Methods

lift :: Maybe a -> Exp (Plain (Maybe a)) Source #

Eq a => Eq (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Maybe

Methods

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

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

Ord a => Ord (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Maybe

Methods

compare :: Maybe a -> Maybe a -> Ordering #

(<) :: Maybe a -> Maybe a -> Bool #

(<=) :: Maybe a -> Maybe a -> Bool #

(>) :: Maybe a -> Maybe a -> Bool #

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

max :: Maybe a -> Maybe a -> Maybe a #

min :: Maybe a -> Maybe a -> Maybe a #

Read a => Read (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Read

Show a => Show (Maybe a)

Since: base-2.1

Instance details

Defined in GHC.Show

Methods

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

show :: Maybe a -> String #

showList :: [Maybe a] -> ShowS #

Generic (Maybe a)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

Associated Types

type Rep (Maybe a) :: Type -> Type #

Methods

from :: Maybe a -> Rep (Maybe a) x #

to :: Rep (Maybe a) x -> Maybe a #

Semigroup a => Semigroup (Maybe a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(<>) :: Maybe a -> Maybe a -> Maybe a #

sconcat :: NonEmpty (Maybe a) -> Maybe a #

stimes :: Integral b => b -> Maybe a -> Maybe a #

(Semigroup (Exp a), Elt a) => Semigroup (Exp (Maybe a)) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Maybe

Methods

(<>) :: Exp (Maybe a) -> Exp (Maybe a) -> Exp (Maybe a) #

sconcat :: NonEmpty (Exp (Maybe a)) -> Exp (Maybe a) #

stimes :: Integral b => b -> Exp (Maybe a) -> Exp (Maybe a) #

Semigroup a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S."

Since 4.11.0: constraint on inner a value generalised from Monoid to Semigroup.

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

mempty :: Maybe a #

mappend :: Maybe a -> Maybe a -> Maybe a #

mconcat :: [Maybe a] -> Maybe a #

(Monoid (Exp a), Elt a) => Monoid (Exp (Maybe a)) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Maybe

Methods

mempty :: Exp (Maybe a) #

mappend :: Exp (Maybe a) -> Exp (Maybe a) -> Exp (Maybe a) #

mconcat :: [Exp (Maybe a)] -> Exp (Maybe a) #

NFData a => NFData (Maybe a) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Maybe a -> () #

Hashable a => Hashable (Maybe a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Maybe a -> Int #

hash :: Maybe a -> Int #

Ixed (Maybe a) 
Instance details

Defined in Control.Lens.At

Methods

ix :: Index (Maybe a) -> Traversal' (Maybe a) (IxValue (Maybe a)) #

At (Maybe a) 
Instance details

Defined in Control.Lens.At

Methods

at :: Index (Maybe a) -> Lens' (Maybe a) (Maybe (IxValue (Maybe a))) #

AsEmpty (Maybe a) 
Instance details

Defined in Control.Lens.Empty

Methods

_Empty :: Prism' (Maybe a) () #

Pretty a => Pretty (Maybe a)

Ignore Nothings, print Just contents.

>>> pretty (Just True)
True
>>> braces (pretty (Nothing :: Maybe Bool))
{}
>>> pretty [Just 1, Nothing, Just 3, Nothing]
[1, 3]
Instance details

Defined in Data.Text.Prettyprint.Doc.Internal

Methods

pretty :: Maybe a -> Doc ann #

prettyList :: [Maybe a] -> Doc ann #

Pretty a => Pretty (Maybe a) 
Instance details

Defined in Text.PrettyPrint.Annotated.WL

Methods

pretty :: Maybe a -> Doc b #

prettyList :: [Maybe a] -> Doc b #

SingKind a => SingKind (Maybe a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Associated Types

type DemoteRep (Maybe a)

Methods

fromSing :: forall (a0 :: Maybe a). Sing a0 -> DemoteRep (Maybe a)

Elt a => Elt (Maybe a) Source # 
Instance details

Defined in Data.Array.Accelerate.Sugar.Elt

Associated Types

type EltR (Maybe a)

Methods

eltR :: TypeR (EltR (Maybe a))

tagsR :: [TagR (EltR (Maybe a))]

fromElt :: Maybe a -> EltR (Maybe a)

toElt :: EltR (Maybe a) -> Maybe a

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

Defined in Data.Array.Accelerate.Data.Maybe

Methods

(==) :: Exp (Maybe a) -> Exp (Maybe a) -> Exp Bool Source #

(/=) :: Exp (Maybe a) -> Exp (Maybe a) -> Exp Bool Source #

Ord a => Ord (Maybe a) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Maybe

Methods

(<) :: 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

Instance details

Defined in GHC.Generics

Associated Types

type Rep1 Maybe :: k -> Type #

Methods

from1 :: forall (a :: k). Maybe a -> Rep1 Maybe a #

to1 :: forall (a :: k). Rep1 Maybe a -> Maybe a #

SingI ('Nothing :: Maybe a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing :: Sing 'Nothing

Each (Maybe a) (Maybe b) a b
each :: Traversal (Maybe a) (Maybe b) a b
Instance details

Defined in Control.Lens.Each

Methods

each :: Traversal (Maybe a) (Maybe b) a b #

SingI a2 => SingI ('Just a2 :: Maybe a1)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing :: Sing ('Just a2)

type Failure Maybe 
Instance details

Defined in Basement.Monad

type Failure Maybe = ()
type StM Maybe a 
Instance details

Defined in Control.Monad.Trans.Control

type StM Maybe a = a
type Rep (Maybe a) 
Instance details

Defined in GHC.Generics

type Rep (Maybe a) = D1 ('MetaData "Maybe" "GHC.Maybe" "base" 'False) (C1 ('MetaCons "Nothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Just" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Index (Maybe a) 
Instance details

Defined in Control.Lens.At

type Index (Maybe a) = ()
type IxValue (Maybe a) 
Instance details

Defined in Control.Lens.At

type IxValue (Maybe a) = a
type DemoteRep (Maybe a) 
Instance details

Defined in GHC.Generics

type DemoteRep (Maybe a) = Maybe (DemoteRep a)
data Sing (b :: Maybe a) 
Instance details

Defined in GHC.Generics

data Sing (b :: Maybe a) where
type Plain (Maybe a) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Maybe

type Plain (Maybe a) = Maybe (Plain a)
type Rep1 Maybe 
Instance details

Defined in GHC.Generics

type Rep1 Maybe = D1 ('MetaData "Maybe" "GHC.Maybe" "base" 'False) (C1 ('MetaCons "Nothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Just" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))

pattern Nothing_ :: forall a. (HasCallStack, Elt a) => Exp (Maybe a) Source #

pattern Just_ :: forall a. (HasCallStack, Elt a) => Exp a -> Exp (Maybe a) Source #

maybe :: (Elt a, Elt b) => Exp b -> (Exp a -> Exp b) -> Exp (Maybe a) -> Exp b Source #

The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is nothing, the default value is returned; otherwise, it applies the function to the value inside the Just and returns the result

isJust :: Elt a => Exp (Maybe a) -> Exp Bool Source #

Returns True if the argument is of the form Just _

isNothing :: Elt a => Exp (Maybe a) -> Exp Bool Source #

Returns True if the argument is Nothing

fromMaybe :: Elt a => Exp a -> Exp (Maybe a) -> Exp a Source #

The fromMaybe function takes a default value and a Maybe value. If the Maybe is Nothing, the default value is returned; otherwise, it returns the value contained in the Maybe.

fromJust :: Elt a => Exp (Maybe a) -> Exp a Source #

The fromJust function extracts the element out of the Just constructor. If the argument was actually Nothing, you will get an undefined value instead.

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 # 
Instance details

Methods

fmap :: (Elt a, Elt b, Elt (Maybe a), Elt (Maybe b)) => (Exp a -> Exp b) -> Exp (Maybe a) -> Exp (Maybe b) Source #

(<$) :: (Elt a, Elt b, Elt (Maybe a), Elt (Maybe b)) => Exp a -> Exp (Maybe b) -> Exp (Maybe a) Source #

(Lift Exp a, Elt (Plain a)) => Lift Exp (Maybe a) Source # 
Instance details

Associated Types

type Plain (Maybe a) Source #

Methods

lift :: Maybe a -> Exp (Plain (Maybe a)) Source #

(Semigroup (Exp a), Elt a) => Semigroup (Exp (Maybe a)) Source # 
Instance details

Methods

(<>) :: Exp (Maybe a) -> Exp (Maybe a) -> Exp (Maybe a) #

sconcat :: NonEmpty (Exp (Maybe a)) -> Exp (Maybe a) #

stimes :: Integral b => b -> Exp (Maybe a) -> Exp (Maybe a) #

(Monoid (Exp a), Elt a) => Monoid (Exp (Maybe a)) Source # 
Instance details

Methods

mempty :: Exp (Maybe a) #

mappend :: Exp (Maybe a) -> Exp (Maybe a) -> Exp (Maybe a) #

mconcat :: [Exp (Maybe a)] -> Exp (Maybe a) #

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

Methods

(==) :: Exp (Maybe a) -> Exp (Maybe a) -> Exp Bool Source #

(/=) :: Exp (Maybe a) -> Exp (Maybe a) -> Exp Bool Source #

Ord a => Ord (Maybe a) Source # 
Instance details

Methods

(<) :: 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 #