Agda-2.6.4.3: A dependently typed functional programming language and proof assistant
Safe HaskellNone
LanguageHaskell2010

Agda.Utils.Maybe.Strict

Description

A strict version of the Maybe type.

Import qualified, as in import qualified Agda.Utils.Maybe.Strict as Strict

Synopsis

Documentation

data Maybe a #

Constructors

Nothing 
Just !a 

Instances

Instances details
EncodeTCM Range Source # 
Instance details

Defined in Agda.Interaction.JSONTop

Pretty TopLevelModuleName Source # 
Instance details

Defined in Agda.Syntax.TopLevelModuleName

HasRange Interval Source # 
Instance details

Defined in Agda.Syntax.Position

HasRange Range Source # 
Instance details

Defined in Agda.Syntax.Position

Methods

getRange :: Range -> Range Source #

KillRange Range Source # 
Instance details

Defined in Agda.Syntax.Position

SetRange Range Source # 
Instance details

Defined in Agda.Syntax.Position

Methods

setRange :: Range -> Range -> Range Source #

FreshName Range Source # 
Instance details

Defined in Agda.TypeChecking.Monad.Base

PrettyTCM Range Source # 
Instance details

Defined in Agda.TypeChecking.Pretty

Methods

prettyTCM :: MonadPretty m => Range -> m Doc Source #

PrettyTCM TopLevelModuleName Source # 
Instance details

Defined in Agda.TypeChecking.Pretty

EmbPrj Range Source #

Ranges are always deserialised as noRange.

Instance details

Defined in Agda.TypeChecking.Serialise.Instances.Common

EmbPrj TopLevelModuleName Source # 
Instance details

Defined in Agda.TypeChecking.Serialise.Instances.Common

Subst Range Source # 
Instance details

Defined in Agda.TypeChecking.Substitute

Associated Types

type SubstArg Range 
Instance details

Defined in Agda.TypeChecking.Substitute

Sized TopLevelModuleName Source # 
Instance details

Defined in Agda.Syntax.TopLevelModuleName

Foldable Maybe 
Instance details

Defined in Data.Strict.Maybe

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 #

Eq1 Maybe 
Instance details

Defined in Data.Strict.Maybe

Methods

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

Ord1 Maybe 
Instance details

Defined in Data.Strict.Maybe

Methods

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

Read1 Maybe 
Instance details

Defined in Data.Strict.Maybe

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

Defined in Data.Strict.Maybe

Methods

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

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

Traversable Maybe 
Instance details

Defined in Data.Strict.Maybe

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

Applicative Maybe Source #

Note that strict Maybe is an Applicative only modulo strictness. The laws only hold in the strict semantics. Eg. pure f * pure _|_ = _|_, but according to the laws for Applicative it should be pure (f _|_). We ignore this issue here, it applies also to Foldable and Traversable.

Instance details

Defined in Agda.Utils.Maybe.Strict

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 #

Functor Maybe 
Instance details

Defined in Data.Strict.Maybe

Methods

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

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

NFData Interval Source # 
Instance details

Defined in Agda.Syntax.Position

Methods

rnf :: Interval -> () #

NFData Position Source # 
Instance details

Defined in Agda.Syntax.Position

Methods

rnf :: Position -> () #

NFData1 Maybe 
Instance details

Defined in Data.Strict.Maybe

Methods

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

Hashable1 Maybe 
Instance details

Defined in Data.Strict.Maybe

Methods

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

FromJSON1 Maybe 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Maybe a) #

liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Maybe a] #

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

ToJSON Range Source # 
Instance details

Defined in Agda.Interaction.JSONTop

ToJSON1 Maybe 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Maybe a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Maybe a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Maybe a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Maybe a] -> Encoding #

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

LensClosure MetaInfo Range Source # 
Instance details

Defined in Agda.TypeChecking.Monad.Base

LensClosure MetaVariable Range Source # 
Instance details

Defined in Agda.TypeChecking.Monad.Base

Generic1 Maybe 
Instance details

Defined in Data.Strict.Maybe

Associated Types

type Rep1 Maybe 
Instance details

Defined in Data.Strict.Maybe

type Rep1 Maybe = D1 ('MetaData "Maybe" "Data.Strict.Maybe" "strct-0.5-f6f3492b" 'False) (C1 ('MetaCons "Nothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Just" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1))

Methods

from1 :: Maybe a -> Rep1 Maybe a #

to1 :: Rep1 Maybe a -> Maybe a #

Pretty a => Pretty (Interval' (Maybe a)) Source # 
Instance details

Defined in Agda.Syntax.Common.Pretty

Pretty a => Pretty (Position' (Maybe a)) Source # 
Instance details

Defined in Agda.Syntax.Common.Pretty

Pretty a => Pretty (Range' (Maybe a)) Source # 
Instance details

Defined in Agda.Syntax.Common.Pretty

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

Defined in Agda.Syntax.Internal.Names

Methods

namesAndMetasIn' :: Monoid m => (Either QName MetaId -> m) -> Maybe a -> m Source #

HasRange (TopLevelModuleName' Range) Source # 
Instance details

Defined in Agda.Syntax.Position

KillRange (TopLevelModuleName' Range) Source # 
Instance details

Defined in Agda.Syntax.Position

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

Defined in Agda.Syntax.Position

SetRange (TopLevelModuleName' Range) Source # 
Instance details

Defined in Agda.Syntax.Position

Instantiate t => Instantiate (Maybe t) Source # 
Instance details

Defined in Agda.TypeChecking.Reduce

Methods

instantiate' :: Maybe t -> ReduceM (Maybe t) Source #

InstantiateFull t => InstantiateFull (Maybe t) Source # 
Instance details

Defined in Agda.TypeChecking.Reduce

Normalise t => Normalise (Maybe t) Source # 
Instance details

Defined in Agda.TypeChecking.Reduce

Methods

normalise' :: Maybe t -> ReduceM (Maybe t) Source #

Simplify t => Simplify (Maybe t) Source # 
Instance details

Defined in Agda.TypeChecking.Reduce

Methods

simplify' :: Maybe t -> ReduceM (Maybe t)

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

Defined in Agda.TypeChecking.Serialise.Instances.Common

Methods

icode :: Maybe a -> S Int32 Source #

icod_ :: Maybe a -> S Int32 Source #

value :: Int32 -> R (Maybe a) Source #

Apply t => Apply (Maybe t) Source # 
Instance details

Defined in Agda.TypeChecking.Substitute

Methods

apply :: Maybe t -> Args -> Maybe t Source #

applyE :: Maybe t -> Elims -> Maybe t Source #

Null (Maybe a) Source # 
Instance details

Defined in Agda.Utils.Maybe.Strict

Methods

empty :: Maybe a Source #

null :: Maybe a -> Bool Source #

Data a => Data (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Maybe a -> c (Maybe a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Maybe a) #

toConstr :: Maybe a -> Constr #

dataTypeOf :: Maybe a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Maybe a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Maybe a)) #

gmapT :: (forall b. Data b => b -> b) -> Maybe a -> Maybe a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Maybe a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Maybe a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Maybe a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Maybe a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a) #

Semigroup a => Monoid (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Methods

mempty :: Maybe a #

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

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

Semigroup a => Semigroup (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Methods

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

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

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

Generic (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Associated Types

type Rep (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

type Rep (Maybe a) = D1 ('MetaData "Maybe" "Data.Strict.Maybe" "strct-0.5-f6f3492b" 'False) (C1 ('MetaCons "Nothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Just" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

Methods

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

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

Read a => Read (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Show a => Show (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Methods

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

show :: Maybe a -> String #

showList :: [Maybe a] -> ShowS #

Binary a => Binary (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Methods

put :: Maybe a -> Put #

get :: Get (Maybe a) #

putList :: [Maybe a] -> Put #

NFData a => NFData (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Methods

rnf :: Maybe a -> () #

Eq a => Eq (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Methods

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

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

Ord a => Ord (Maybe a) 
Instance details

Defined in Data.Strict.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 #

Hashable a => Hashable (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

Methods

hashWithSalt :: Int -> Maybe a -> Int

hash :: Maybe a -> Int

FromJSON a => FromJSON (Maybe a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

parseJSON :: Value -> Parser (Maybe a) #

parseJSONList :: Value -> Parser [Maybe a] #

omittedField :: Maybe (Maybe a) #

ToJSON a => ToJSON (Maybe a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Strict (Maybe a) (Maybe a) 
Instance details

Defined in Data.Strict.Classes

Methods

toStrict :: Maybe a -> Maybe a #

toLazy :: Maybe a -> Maybe a #

FreshName (Range, String) Source # 
Instance details

Defined in Agda.TypeChecking.Monad.Base

type SubstArg Range Source # 
Instance details

Defined in Agda.TypeChecking.Substitute

type Rep1 Maybe 
Instance details

Defined in Data.Strict.Maybe

type Rep1 Maybe = D1 ('MetaData "Maybe" "Data.Strict.Maybe" "strct-0.5-f6f3492b" 'False) (C1 ('MetaCons "Nothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Just" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1))
type Rep (Maybe a) 
Instance details

Defined in Data.Strict.Maybe

type Rep (Maybe a) = D1 ('MetaData "Maybe" "Data.Strict.Maybe" "strct-0.5-f6f3492b" 'False) (C1 ('MetaCons "Nothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Just" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

mapMaybe :: (a -> Maybe b) -> [a] -> [b] #

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

isJust :: Maybe a -> Bool #

fromJust :: Maybe a -> a #

fromMaybe :: a -> Maybe a -> a #

maybeToList :: Maybe a -> [a] #

listToMaybe :: [a] -> Maybe a #

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

class Strict lazy strict | lazy -> strict, strict -> lazy where #

Methods

toStrict :: lazy -> strict #

toLazy :: strict -> lazy #

Instances

Instances details
Strict ByteString ByteString 
Instance details

Defined in Data.Strict.Classes

Strict Text Text 
Instance details

Defined in Data.Strict.Classes

Methods

toStrict :: Text -> Text #

toLazy :: Text -> Text #

Strict (Maybe a) (Maybe a) 
Instance details

Defined in Data.Strict.Classes

Methods

toStrict :: Maybe a -> Maybe a #

toLazy :: Maybe a -> Maybe a #

Strict (ST s a) (ST s a) 
Instance details

Defined in Data.Strict.Classes

Methods

toStrict :: ST s a -> ST s a #

toLazy :: ST s a -> ST s a #

Strict (Either a b) (Either a b) 
Instance details

Defined in Data.Strict.Classes

Methods

toStrict :: Either a b -> Either a b #

toLazy :: Either a b -> Either a b #

Strict (These a b) (These a b) 
Instance details

Defined in Data.Strict.Classes

Methods

toStrict :: These a b -> These a b #

toLazy :: These a b -> These a b #

Strict (a, b) (Pair a b) 
Instance details

Defined in Data.Strict.Classes

Methods

toStrict :: (a, b) -> Pair a b #

toLazy :: Pair a b -> (a, b) #

Strict (StateT s m a) (StateT s m a) 
Instance details

Defined in Data.Strict.Classes

Methods

toStrict :: StateT s m a -> StateT s m a #

toLazy :: StateT s m a -> StateT s m a #

Strict (WriterT w m a) (WriterT w m a) 
Instance details

Defined in Data.Strict.Classes

Methods

toStrict :: WriterT w m a -> WriterT w m a #

toLazy :: WriterT w m a -> WriterT w m a #

Strict (RWST r w s m a) (RWST r w s m a) 
Instance details

Defined in Data.Strict.Classes

Methods

toStrict :: RWST r w s m a -> RWST r w s m a #

toLazy :: RWST r w s m a -> RWST r w s m a #

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

Monadic version of caseMaybe. That is, maybeM with a different argument ordering.

fromMaybeM :: Monad m => m a -> m (Maybe a) -> m a Source #

Monadic version of fromMaybe.

forMaybe :: [a] -> (a -> Maybe b) -> [b] Source #

Version of mapMaybe with different argument ordering.

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

Filtering a singleton list.

filterMaybe p a = listToMaybe (filter p [a])

whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () Source #

A more telling name for forM for the Maybe collection type. Or: caseMaybe without the Nothing case.

unionMaybeWith :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a Source #

unionWith for collections of size <= 1.

unzipMaybe :: Maybe (a, b) -> (Maybe a, Maybe b) Source #

Unzipping a list of length <= 1.

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

Version of maybe with different argument ordering. Often, we want to case on a Maybe, do something interesting in the Just case, but only a default action in the Nothing case. Then, the argument ordering of caseMaybe is preferable.

caseMaybe m err f = flip (maybe err) m f

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

Monadic version of maybe.

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

caseMaybeM with flipped branches.

whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () Source #

caseMaybeM without the Nothing case.

Orphan instances

Applicative Maybe Source #

Note that strict Maybe is an Applicative only modulo strictness. The laws only hold in the strict semantics. Eg. pure f * pure _|_ = _|_, but according to the laws for Applicative it should be pure (f _|_). We ignore this issue here, it applies also to Foldable and Traversable.

Instance details

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 #

Null (Maybe a) Source # 
Instance details

Methods

empty :: Maybe a Source #

null :: Maybe a -> Bool Source #