{-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_HADDOCK not-home #-} -- | Maybe type module GHC.Internal.Maybe ( Maybe (..) ) where import GHC.Num.Integer () -- See Note [Depend on GHC.Num.Integer] in GHC.Internal.Base import GHC.Classes default () ------------------------------------------------------------------------------- -- Maybe type ------------------------------------------------------------------------------- -- | 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 'Prelude.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 'Data.Either.Either' type. -- data Maybe a = Nothing | Just a deriving ( Maybe a -> Maybe a -> Bool (Maybe a -> Maybe a -> Bool) -> (Maybe a -> Maybe a -> Bool) -> Eq (Maybe a) forall a. Eq a => Maybe a -> Maybe a -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: forall a. Eq a => Maybe a -> Maybe a -> Bool == :: Maybe a -> Maybe a -> Bool $c/= :: forall a. Eq a => Maybe a -> Maybe a -> Bool /= :: Maybe a -> Maybe a -> Bool Eq -- ^ @since base-2.01 , Eq (Maybe a) Eq (Maybe a) => (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) -> (Maybe a -> Maybe a -> Maybe a) -> (Maybe a -> Maybe a -> Maybe a) -> Ord (Maybe a) Maybe a -> Maybe a -> Bool Maybe a -> Maybe a -> Maybe a Maybe a -> Maybe a -> Ordering forall a. Eq a => (a -> a -> Ordering) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> a) -> (a -> a -> a) -> Ord a forall a. Ord a => Eq (Maybe a) forall a. Ord a => Maybe a -> Maybe a -> Bool forall a. Ord a => Maybe a -> Maybe a -> Maybe a forall a. Ord a => Maybe a -> Maybe a -> Ordering $ccompare :: forall a. Ord a => Maybe a -> Maybe a -> Ordering compare :: Maybe a -> Maybe a -> Ordering $c< :: forall a. Ord a => Maybe a -> Maybe a -> Bool < :: Maybe a -> Maybe a -> Bool $c<= :: forall a. Ord a => Maybe a -> Maybe a -> Bool <= :: Maybe a -> Maybe a -> Bool $c> :: forall a. Ord a => Maybe a -> Maybe a -> Bool > :: Maybe a -> Maybe a -> Bool $c>= :: forall a. Ord a => Maybe a -> Maybe a -> Bool >= :: Maybe a -> Maybe a -> Bool $cmax :: forall a. Ord a => Maybe a -> Maybe a -> Maybe a max :: Maybe a -> Maybe a -> Maybe a $cmin :: forall a. Ord a => Maybe a -> Maybe a -> Maybe a min :: Maybe a -> Maybe a -> Maybe a Ord -- ^ @since base-2.01 )