strict-0.4.0.1: Strict data types and String IO.
Safe Haskell Safe
Language Haskell2010

Data.Strict.Maybe

Description

The strict variant of the standard Haskell Maybe type and the corresponding variants of the functions from Data.Maybe .

Note that in contrast to the standard lazy Maybe type, the strict Maybe type is not an applicative functor, and therefore also not a monad. The problem is the homomorphism law, which states that

pure f <*> pure x = pure (f x)  -- must hold for all f

This law does not hold for the expected applicative functor instance of Maybe , as this instance does not satisfy pure f <*> pure _|_ = pure (f _|_) for f = const .

Synopsis

Documentation

data Maybe a Source #

The type of strict optional values.

Constructors

Nothing
Just !a

Instances

Instances details
Functor Maybe Source #
Instance details

Defined in Data.Strict.Maybe

Foldable Maybe Source #
Instance details

Defined in Data.Strict.Maybe

Traversable Maybe Source #
Instance details

Defined in Data.Strict.Maybe

Eq1 Maybe Source #
Instance details

Defined in Data.Strict.Maybe

Methods

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

Ord1 Maybe Source #
Instance details

Defined in Data.Strict.Maybe

Read1 Maybe Source #
Instance details

Defined in Data.Strict.Maybe

Show1 Maybe Source #
Instance details

Defined in Data.Strict.Maybe

NFData1 Maybe Source #
Instance details

Defined in Data.Strict.Maybe

Methods

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

Hashable1 Maybe Source #
Instance details

Defined in Data.Strict.Maybe

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

Defined in Data.Strict.Maybe

Data a => Data ( Maybe a) Source #
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) Source #

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

toConstr :: Maybe a -> Constr Source #

dataTypeOf :: Maybe a -> DataType Source #

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

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

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

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

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

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

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

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

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

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

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

Defined in Data.Strict.Maybe

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

Defined in Data.Strict.Maybe

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

Defined in Data.Strict.Maybe

Generic ( Maybe a) Source #
Instance details

Defined in Data.Strict.Maybe

Associated Types

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

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

Defined in Data.Strict.Maybe

Semigroup a => Monoid ( Maybe a) Source #
Instance details

Defined in Data.Strict.Maybe

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

Defined in Data.Strict.Maybe

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

Defined in Data.Strict.Maybe

Methods

rnf :: Maybe a -> () Source #

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

Defined in Data.Strict.Maybe

Generic1 Maybe Source #
Instance details

Defined in Data.Strict.Maybe

Associated Types

type Rep1 Maybe :: k -> Type Source #

Methods

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

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

Strict ( Maybe a) ( Maybe a) Source #
Instance details

Defined in Data.Strict.Classes

type Rep ( Maybe a) Source #
Instance details

Defined in Data.Strict.Maybe

type Rep1 Maybe Source #
Instance details

Defined in Data.Strict.Maybe

isJust :: Maybe a -> Bool Source #

Yields True iff the argument is of the form Just _ .

fromJust :: Maybe a -> a Source #

Extracts the element out of a Just and throws an error if the argument is Nothing .

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

Given a default value and a Maybe , yield the default value if the Maybe argument is Nothing and extract the value out of the Just otherwise.

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

Given a default value, a function and a Maybe value, yields the default value if the Maybe value is Nothing and applies the function to the value stored in the Just otherwise.

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

Analogous to mapMaybe in Data.Maybe .