Copyright | (c) The University of Glasgow 2001 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | libraries@haskell.org |
Stability | stable |
Portability | portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
The Prelude: a standard module. The Prelude is imported by default into all Haskell modules unless either there is an explicit import statement for it, or the NoImplicitPrelude extension is enabled.
Synopsis
- data Bool
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- not :: Bool -> Bool
- otherwise :: Bool
- data Maybe a
- maybe :: b -> (a -> b) -> Maybe a -> b
- data Either a b
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- data Ordering
- data Char
- type String = [Char]
- fst :: (a, b) -> a
- snd :: (a, b) -> b
- curry :: ((a, b) -> c) -> a -> b -> c
- uncurry :: (a -> b -> c) -> (a, b) -> c
- class Eq a where
- class Eq a => Ord a where
- class Enum a where
- succ :: a -> a
- pred :: a -> a
- toEnum :: Int -> a
- fromEnum :: a -> Int
- enumFrom :: a -> [a]
- enumFromThen :: a -> a -> [a]
- enumFromTo :: a -> a -> [a]
- enumFromThenTo :: a -> a -> a -> [a]
- class Bounded a where
- data Int
- data Integer
- data Float
- data Double
- type Rational = Ratio Integer
- data Word
- class Num a where
- class (Num a, Ord a) => Real a where
- toRational :: a -> Rational
- class (Real a, Enum a) => Integral a where
- class Num a => Fractional a where
- (/) :: a -> a -> a
- recip :: a -> a
- fromRational :: Rational -> a
- class Fractional a => Floating a where
- class (Real a, Fractional a) => RealFrac a where
- class (RealFrac a, Floating a) => RealFloat a where
- floatRadix :: a -> Integer
- floatDigits :: a -> Int
- floatRange :: a -> (Int, Int)
- decodeFloat :: a -> (Integer, Int)
- encodeFloat :: Integer -> Int -> a
- exponent :: a -> Int
- significand :: a -> a
- scaleFloat :: Int -> a -> a
- isNaN :: a -> Bool
- isInfinite :: a -> Bool
- isDenormalized :: a -> Bool
- isNegativeZero :: a -> Bool
- isIEEE :: a -> Bool
- atan2 :: a -> a -> a
- subtract :: Num a => a -> a -> a
- even :: Integral a => a -> Bool
- odd :: Integral a => a -> Bool
- gcd :: Integral a => a -> a -> a
- lcm :: Integral a => a -> a -> a
- (^) :: (Num a, Integral b) => a -> b -> a
- (^^) :: (Fractional a, Integral b) => a -> b -> a
- fromIntegral :: (Integral a, Num b) => a -> b
- realToFrac :: (Real a, Fractional b) => a -> b
- class Semigroup a where
- (<>) :: a -> a -> a
- class Semigroup a => Monoid a where
- class Functor (f :: Type -> Type) where
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- class Functor f => Applicative (f :: Type -> Type) where
- class Applicative m => Monad (m :: Type -> Type) where
- class Monad m => MonadFail (m :: Type -> Type) where
- mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- class Foldable (t :: Type -> Type) where
- foldMap :: Monoid m => (a -> m) -> t a -> m
- foldr :: (a -> b -> b) -> b -> t a -> b
- foldl :: (b -> a -> b) -> b -> t a -> b
- foldl' :: (b -> a -> b) -> b -> t a -> b
- foldr1 :: (a -> a -> a) -> t a -> a
- foldl1 :: (a -> a -> a) -> t a -> a
- elem :: Eq a => a -> t a -> Bool
- maximum :: Ord a => t a -> a
- minimum :: Ord a => t a -> a
- sum :: Num a => t a -> a
- product :: Num a => t a -> a
- class (Functor t, Foldable t) => Traversable (t :: Type -> Type) where
- traverse :: Applicative f => (a -> f b) -> t a -> f (t b)
- sequenceA :: Applicative f => t (f a) -> f (t a)
- mapM :: Monad m => (a -> m b) -> t a -> m (t b)
- sequence :: Monad m => t (m a) -> m (t a)
- id :: a -> a
- const :: a -> b -> a
- (.) :: (b -> c) -> (a -> b) -> a -> c
- flip :: (a -> b -> c) -> b -> a -> c
- ($) :: (a -> b) -> a -> b
- until :: (a -> Bool) -> (a -> a) -> a -> a
- asTypeOf :: a -> a -> a
- error :: HasCallStack => [Char] -> a
- errorWithoutStackTrace :: [Char] -> a
- undefined :: HasCallStack => a
- seq :: a -> b -> b
- ($!) :: (a -> b) -> a -> b
- map :: (a -> b) -> [a] -> [b]
- (++) :: [a] -> [a] -> [a]
- filter :: (a -> Bool) -> [a] -> [a]
- head :: HasCallStack => [a] -> a
- last :: HasCallStack => [a] -> a
- tail :: HasCallStack => [a] -> [a]
- init :: HasCallStack => [a] -> [a]
- (!!) :: HasCallStack => [a] -> Int -> a
- null :: Foldable t => t a -> Bool
- length :: Foldable t => t a -> Int
- reverse :: [a] -> [a]
- and :: Foldable t => t Bool -> Bool
- or :: Foldable t => t Bool -> Bool
- any :: Foldable t => (a -> Bool) -> t a -> Bool
- all :: Foldable t => (a -> Bool) -> t a -> Bool
- concat :: Foldable t => t [a] -> [a]
- concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- scanl :: (b -> a -> b) -> b -> [a] -> [b]
- scanl1 :: (a -> a -> a) -> [a] -> [a]
- scanr :: (a -> b -> b) -> b -> [a] -> [b]
- scanr1 :: (a -> a -> a) -> [a] -> [a]
- iterate :: (a -> a) -> a -> [a]
- repeat :: a -> [a]
- replicate :: Int -> a -> [a]
- cycle :: HasCallStack => [a] -> [a]
- take :: Int -> [a] -> [a]
- drop :: Int -> [a] -> [a]
- takeWhile :: (a -> Bool) -> [a] -> [a]
- dropWhile :: (a -> Bool) -> [a] -> [a]
- span :: (a -> Bool) -> [a] -> ([a], [a])
- break :: (a -> Bool) -> [a] -> ([a], [a])
- splitAt :: Int -> [a] -> ([a], [a])
- notElem :: (Foldable t, Eq a) => a -> t a -> Bool
- lookup :: Eq a => a -> [(a, b)] -> Maybe b
- zip :: [a] -> [b] -> [(a, b)]
- zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
- zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
- unzip :: [(a, b)] -> ([a], [b])
- unzip3 :: [(a, b, c)] -> ([a], [b], [c])
- lines :: String -> [String]
- words :: String -> [String]
- unlines :: [String] -> String
- unwords :: [String] -> String
- type ShowS = String -> String
- class Show a where
- shows :: Show a => a -> ShowS
- showChar :: Char -> ShowS
- showString :: String -> ShowS
- showParen :: Bool -> ShowS -> ShowS
- type ReadS a = String -> [(a, String)]
- class Read a where
- reads :: Read a => ReadS a
- readParen :: Bool -> ReadS a -> ReadS a
- read :: Read a => String -> a
- lex :: ReadS String
- data IO a
- putChar :: Char -> IO ()
- putStr :: String -> IO ()
- putStrLn :: String -> IO ()
- print :: Show a => a -> IO ()
- getChar :: IO Char
- getLine :: IO String
- getContents :: IO String
- interact :: (String -> String) -> IO ()
- type FilePath = String
- readFile :: FilePath -> IO String
- writeFile :: FilePath -> String -> IO ()
- appendFile :: FilePath -> String -> IO ()
- readIO :: Read a => String -> IO a
- readLn :: Read a => IO a
- type IOError = IOException
- ioError :: HasCallStack => IOError -> IO a
- userError :: String -> IOError
- class a ~# b => (a :: k) ~ (b :: k)
Standard types, classes and related functions
Basic data types
Instances
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
Eq1 Maybe Source # | Since: base-4.9.0.0 | ||||
Ord1 Maybe Source # | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
Read1 Maybe Source # | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Maybe a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Maybe a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Maybe a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Maybe a] Source # | |||||
Show1 Maybe Source # | Since: base-4.9.0.0 | ||||
Alternative Maybe Source # | Picks the leftmost Since: base-2.1 | ||||
Applicative Maybe Source # | Since: base-2.1 | ||||
Functor Maybe Source # | Since: base-2.1 | ||||
Monad Maybe Source # | Since: base-2.1 | ||||
MonadPlus Maybe Source # | Picks the leftmost Since: base-2.1 | ||||
MonadFail Maybe Source # | Since: base-4.9.0.0 | ||||
MonadFix Maybe Source # | Since: base-2.1 | ||||
MonadZip Maybe Source # | Since: ghc-internal-4.8.0.0 | ||||
Foldable Maybe Source # | Since: base-2.1 | ||||
Defined in GHC.Internal.Data.Foldable fold :: Monoid m => Maybe m -> m Source # foldMap :: Monoid m => (a -> m) -> Maybe a -> m Source # foldMap' :: Monoid m => (a -> m) -> Maybe a -> m Source # foldr :: (a -> b -> b) -> b -> Maybe a -> b Source # foldr' :: (a -> b -> b) -> b -> Maybe a -> b Source # foldl :: (b -> a -> b) -> b -> Maybe a -> b Source # foldl' :: (b -> a -> b) -> b -> Maybe a -> b Source # foldr1 :: (a -> a -> a) -> Maybe a -> a Source # foldl1 :: (a -> a -> a) -> Maybe a -> a Source # toList :: Maybe a -> [a] Source # null :: Maybe a -> Bool Source # length :: Maybe a -> Int Source # elem :: Eq a => a -> Maybe a -> Bool Source # maximum :: Ord a => Maybe a -> a Source # minimum :: Ord a => Maybe a -> a Source # | |||||
Traversable Maybe Source # | Since: base-2.1 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
Generic1 Maybe Source # | |||||
Defined in GHC.Internal.Generics
| |||||
Lift a => Lift (Maybe a :: Type) Source # | |||||
Semigroup a => Monoid (Maybe a) Source # | Lift a semigroup into Since 4.11.0: constraint on inner Since: base-2.1 | ||||
Semigroup a => Semigroup (Maybe a) Source # | Since: base-4.9.0.0 | ||||
Data a => Data (Maybe a) Source # | Since: base-4.0.0.0 | ||||
Defined in GHC.Internal.Data.Data 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)) -> Maybe (c (Maybe a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (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 # | |||||
Generic (Maybe a) Source # | |||||
Defined in GHC.Internal.Generics
| |||||
SingKind a => SingKind (Maybe a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics
| |||||
Read a => Read (Maybe a) Source # | Since: base-2.1 | ||||
Show a => Show (Maybe a) Source # | Since: base-2.1 | ||||
Eq a => Eq (Maybe a) Source # | Since: base-2.1 | ||||
Ord a => Ord (Maybe a) Source # | Since: base-2.1 | ||||
SingI ('Nothing :: Maybe a) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
SingI a2 => SingI ('Just a2 :: Maybe a1) | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
type Rep1 Maybe Source # | Since: base-4.6.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
type DemoteRep (Maybe a) Source # | |||||
Defined in GHC.Internal.Generics | |||||
type Rep (Maybe a) Source # | Since: base-4.6.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
data Sing (b :: Maybe a) Source # | |||||
maybe :: b -> (a -> b) -> Maybe a -> b Source #
The maybe
function takes a default value, a function, and a Maybe
value. If the Maybe
value is Nothing
, the function returns the
default value. Otherwise, it applies the function to the value inside
the Just
and returns the result.
Examples
Basic usage:
>>>
maybe False odd (Just 3)
True
>>>
maybe False odd Nothing
False
Read an integer from a string using readMaybe
. If we succeed,
return twice the integer; that is, apply (*2)
to it. If instead
we fail to parse an integer, return 0
by default:
>>>
import GHC.Internal.Text.Read ( readMaybe )
>>>
maybe 0 (*2) (readMaybe "5")
10>>>
maybe 0 (*2) (readMaybe "")
0
Apply show
to a Maybe Int
. If we have Just n
, we want to show
the underlying Int
n
. But if we have Nothing
, we return the
empty string instead of (for example) "Nothing":
>>>
maybe "" show (Just 5)
"5">>>
maybe "" show Nothing
""
The Either
type represents values with two possibilities: a value of
type
is either Either
a b
or Left
a
.Right
b
The Either
type is sometimes used to represent a value which is
either correct or an error; by convention, the Left
constructor is
used to hold an error value and the Right
constructor is used to
hold a correct value (mnemonic: "right" also means "correct").
Examples
The type
is the type of values which can be either
a Either
String
Int
String
or an Int
. The Left
constructor can be used only on
String
s, and the Right
constructor can be used only on Int
s:
>>>
let s = Left "foo" :: Either String Int
>>>
s
Left "foo">>>
let n = Right 3 :: Either String Int
>>>
n
Right 3>>>
:type s
s :: Either String Int>>>
:type n
n :: Either String Int
The fmap
from our Functor
instance will ignore Left
values, but
will apply the supplied function to values contained in a Right
:
>>>
let s = Left "foo" :: Either String Int
>>>
let n = Right 3 :: Either String Int
>>>
fmap (*2) s
Left "foo">>>
fmap (*2) n
Right 6
The Monad
instance for Either
allows us to chain together multiple
actions which may fail, and fail overall if any of the individual
steps failed. First we'll write a function that can either parse an
Int
from a Char
, or fail.
>>>
import Data.Char ( digitToInt, isDigit )
>>>
:{
let parseEither :: Char -> Either String Int parseEither c | isDigit c = Right (digitToInt c) | otherwise = Left "parse error">>>
:}
The following should work, since both '1'
and '2'
can be
parsed as Int
s.
>>>
:{
let parseMultiple :: Either String Int parseMultiple = do x <- parseEither '1' y <- parseEither '2' return (x + y)>>>
:}
>>>
parseMultiple
Right 3
But the following should fail overall, since the first operation where
we attempt to parse 'm'
as an Int
will fail:
>>>
:{
let parseMultiple :: Either String Int parseMultiple = do x <- parseEither 'm' y <- parseEither '2' return (x + y)>>>
:}
>>>
parseMultiple
Left "parse error"
Instances
Bifoldable Either Source # | Since: base-4.10.0.0 | ||||
Bifoldable1 Either Source # | |||||
Bifunctor Either Source # | Since: base-4.8.0.0 | ||||
Bitraversable Either Source # | Since: base-4.10.0.0 | ||||
Defined in Data.Bitraversable bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) Source # | |||||
Eq2 Either Source # | Since: base-4.9.0.0 | ||||
Ord2 Either Source # | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
Read2 Either Source # | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Either a b) Source # liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Either a b] Source # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Either a b) Source # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Either a b] Source # | |||||
Show2 Either Source # | Since: base-4.9.0.0 | ||||
Generic1 (Either a :: Type -> Type) Source # | |||||
Defined in GHC.Internal.Generics
| |||||
(Lift a, Lift b) => Lift (Either a b :: Type) Source # | |||||
Eq a => Eq1 (Either a) Source # | Since: base-4.9.0.0 | ||||
Ord a => Ord1 (Either a) Source # | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
Read a => Read1 (Either a) Source # | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Either a a0) Source # liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Either a a0] Source # liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Either a a0) Source # liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Either a a0] Source # | |||||
Show a => Show1 (Either a) Source # | Since: base-4.9.0.0 | ||||
Applicative (Either e) Source # | Since: base-3.0 | ||||
Defined in GHC.Internal.Data.Either | |||||
Functor (Either a) Source # | Since: base-3.0 | ||||
Monad (Either e) Source # | Since: base-4.4.0.0 | ||||
MonadFix (Either e) Source # | Since: base-4.3.0.0 | ||||
Foldable (Either a) Source # | Since: base-4.7.0.0 | ||||
Defined in GHC.Internal.Data.Foldable fold :: Monoid m => Either a m -> m Source # foldMap :: Monoid m => (a0 -> m) -> Either a a0 -> m Source # foldMap' :: Monoid m => (a0 -> m) -> Either a a0 -> m Source # foldr :: (a0 -> b -> b) -> b -> Either a a0 -> b Source # foldr' :: (a0 -> b -> b) -> b -> Either a a0 -> b Source # foldl :: (b -> a0 -> b) -> b -> Either a a0 -> b Source # foldl' :: (b -> a0 -> b) -> b -> Either a a0 -> b Source # foldr1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 Source # foldl1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 Source # toList :: Either a a0 -> [a0] Source # null :: Either a a0 -> Bool Source # length :: Either a a0 -> Int Source # elem :: Eq a0 => a0 -> Either a a0 -> Bool Source # maximum :: Ord a0 => Either a a0 -> a0 Source # minimum :: Ord a0 => Either a a0 -> a0 Source # | |||||
Traversable (Either a) Source # | Since: base-4.7.0.0 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
Semigroup (Either a b) Source # | Since: base-4.9.0.0 | ||||
(Data a, Data b) => Data (Either a b) Source # | Since: base-4.0.0.0 | ||||
Defined in GHC.Internal.Data.Data gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Either a b -> c (Either a b) Source # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Either a b) Source # toConstr :: Either a b -> Constr Source # dataTypeOf :: Either a b -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Either a b)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Either a b)) Source # gmapT :: (forall b0. Data b0 => b0 -> b0) -> Either a b -> Either a b Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Either a b -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Either a b -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Either a b -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Either a b -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Either a b -> m (Either a b) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Either a b -> m (Either a b) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Either a b -> m (Either a b) Source # | |||||
Generic (Either a b) Source # | |||||
Defined in GHC.Internal.Generics
| |||||
(Read a, Read b) => Read (Either a b) Source # | Since: base-3.0 | ||||
(Show a, Show b) => Show (Either a b) Source # | Since: base-3.0 | ||||
(Eq a, Eq b) => Eq (Either a b) Source # | Since: base-2.1 | ||||
(Ord a, Ord b) => Ord (Either a b) Source # | Since: base-2.1 | ||||
Defined in GHC.Internal.Data.Either compare :: Either a b -> Either a b -> Ordering Source # (<) :: Either a b -> Either a b -> Bool Source # (<=) :: Either a b -> Either a b -> Bool Source # (>) :: Either a b -> Either a b -> Bool Source # (>=) :: Either a b -> Either a b -> Bool Source # | |||||
type Rep1 (Either a :: Type -> Type) Source # | Since: base-4.6.0.0 | ||||
Defined in GHC.Internal.Generics type Rep1 (Either a :: Type -> Type) = D1 ('MetaData "Either" "GHC.Internal.Data.Either" "ghc-internal" 'False) (C1 ('MetaCons "Left" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Right" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
type Rep (Either a b) Source # | Since: base-4.6.0.0 | ||||
Defined in GHC.Internal.Generics type Rep (Either a b) = D1 ('MetaData "Either" "GHC.Internal.Data.Either" "ghc-internal" 'False) (C1 ('MetaCons "Left" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Right" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 b))) |
either :: (a -> c) -> (b -> c) -> Either a b -> c Source #
Case analysis for the Either
type.
If the value is
, apply the first function to Left
aa
;
if it is
, apply the second function to Right
bb
.
Examples
We create two values of type
, one using the
Either
String
Int
Left
constructor and another using the Right
constructor. Then
we apply "either" the length
function (if we have a String
)
or the "times-two" function (if we have an Int
):
>>>
let s = Left "foo" :: Either String Int
>>>
let n = Right 3 :: Either String Int
>>>
either length (*2) s
3>>>
either length (*2) n
6
Instances
Monoid Ordering Source # | Since: base-2.1 |
Semigroup Ordering Source # | Since: base-4.9.0.0 |
Data Ordering Source # | Since: base-4.0.0.0 |
Defined in GHC.Internal.Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ordering -> c Ordering Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Ordering Source # toConstr :: Ordering -> Constr Source # dataTypeOf :: Ordering -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Ordering) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ordering) Source # gmapT :: (forall b. Data b => b -> b) -> Ordering -> Ordering Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ordering -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ordering -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Ordering -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Ordering -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering Source # | |
Bounded Ordering Source # | Since: base-2.1 |
Enum Ordering Source # | Since: base-2.1 |
Defined in GHC.Internal.Enum succ :: Ordering -> Ordering Source # pred :: Ordering -> Ordering Source # toEnum :: Int -> Ordering Source # fromEnum :: Ordering -> Int Source # enumFrom :: Ordering -> [Ordering] Source # enumFromThen :: Ordering -> Ordering -> [Ordering] Source # enumFromTo :: Ordering -> Ordering -> [Ordering] Source # enumFromThenTo :: Ordering -> Ordering -> Ordering -> [Ordering] Source # | |
Generic Ordering Source # | |
Defined in GHC.Internal.Generics | |
Ix Ordering Source # | Since: base-2.1 |
Defined in GHC.Internal.Ix | |
Read Ordering Source # | Since: base-2.1 |
Show Ordering Source # | Since: base-2.1 |
Eq Ordering Source # | |
Ord Ordering Source # | |
Defined in GHC.Classes | |
type Rep Ordering Source # | Since: base-4.6.0.0 |
The character type Char
represents Unicode codespace
and its elements are code points as in definitions
D9 and D10 of the Unicode Standard.
Character literals in Haskell are single-quoted: 'Q'
, 'Я'
or 'Ω'
.
To represent a single quote itself use '\''
, and to represent a backslash
use '\\'
. The full grammar can be found in the section 2.6 of the
Haskell 2010 Language Report.
To specify a character by its code point one can use decimal, hexadecimal
or octal notation: '\65'
, '\x41'
and '\o101'
are all alternative forms
of 'A'
. The largest code point is '\x10ffff'
.
There is a special escape syntax for ASCII control characters:
Escape | Alternatives | Meaning |
---|---|---|
'\NUL' | '\0' | null character |
'\SOH' | '\1' | start of heading |
'\STX' | '\2' | start of text |
'\ETX' | '\3' | end of text |
'\EOT' | '\4' | end of transmission |
'\ENQ' | '\5' | enquiry |
'\ACK' | '\6' | acknowledge |
'\BEL' | '\7' , '\a' | bell (alert) |
'\BS' | '\8' , '\b' | backspace |
'\HT' | '\9' , '\t' | horizontal tab |
'\LF' | '\10' , '\n' | line feed (new line) |
'\VT' | '\11' , '\v' | vertical tab |
'\FF' | '\12' , '\f' | form feed |
'\CR' | '\13' , '\r' | carriage return |
'\SO' | '\14' | shift out |
'\SI' | '\15' | shift in |
'\DLE' | '\16' | data link escape |
'\DC1' | '\17' | device control 1 |
'\DC2' | '\18' | device control 2 |
'\DC3' | '\19' | device control 3 |
'\DC4' | '\20' | device control 4 |
'\NAK' | '\21' | negative acknowledge |
'\SYN' | '\22' | synchronous idle |
'\ETB' | '\23' | end of transmission block |
'\CAN' | '\24' | cancel |
'\EM' | '\25' | end of medium |
'\SUB' | '\26' | substitute |
'\ESC' | '\27' | escape |
'\FS' | '\28' | file separator |
'\GS' | '\29' | group separator |
'\RS' | '\30' | record separator |
'\US' | '\31' | unit separator |
'\SP' | '\32' , ' ' | space |
'\DEL' | '\127' | delete |
Instances
IsChar Char Source # | Since: base-2.1 | ||||
PrintfArg Char Source # | Since: base-2.1 | ||||
Defined in Text.Printf formatArg :: Char -> FieldFormatter Source # parseFormat :: Char -> ModifierParser Source # | |||||
Data Char Source # | Since: base-4.0.0.0 | ||||
Defined in GHC.Internal.Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Char -> c Char Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Char Source # toConstr :: Char -> Constr Source # dataTypeOf :: Char -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Char) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Char) Source # gmapT :: (forall b. Data b => b -> b) -> Char -> Char Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Char -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Char -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Char -> m Char Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char Source # | |||||
Bounded Char Source # | Since: base-2.1 | ||||
Enum Char Source # | Since: base-2.1 | ||||
Storable Char Source # | Since: base-2.1 | ||||
Defined in GHC.Internal.Foreign.Storable sizeOf :: Char -> Int Source # alignment :: Char -> Int Source # peekElemOff :: Ptr Char -> Int -> IO Char Source # pokeElemOff :: Ptr Char -> Int -> Char -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Char Source # pokeByteOff :: Ptr b -> Int -> Char -> IO () Source # | |||||
Ix Char Source # | Since: base-2.1 | ||||
Read Char Source # | Since: base-2.1 | ||||
Show Char Source # | Since: base-2.1 | ||||
Eq Char Source # | |||||
Ord Char Source # | |||||
TestCoercion SChar Source # | Since: base-4.18.0.0 | ||||
Defined in GHC.Internal.TypeLits | |||||
TestEquality SChar Source # | Since: base-4.18.0.0 | ||||
Defined in GHC.Internal.TypeLits | |||||
Lift Char Source # | |||||
Generic1 (URec Char :: k -> Type) Source # | |||||
Defined in GHC.Internal.Generics
| |||||
Eq1 (UChar :: Type -> Type) Source # | Since: base-4.21.0.0 | ||||
Ord1 (UChar :: Type -> Type) Source # | Since: base-4.21.0.0 | ||||
Defined in Data.Functor.Classes | |||||
Show1 (UChar :: Type -> Type) Source # | Since: base-4.21.0.0 | ||||
Foldable (UChar :: Type -> Type) Source # | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Foldable fold :: Monoid m => UChar m -> m Source # foldMap :: Monoid m => (a -> m) -> UChar a -> m Source # foldMap' :: Monoid m => (a -> m) -> UChar a -> m Source # foldr :: (a -> b -> b) -> b -> UChar a -> b Source # foldr' :: (a -> b -> b) -> b -> UChar a -> b Source # foldl :: (b -> a -> b) -> b -> UChar a -> b Source # foldl' :: (b -> a -> b) -> b -> UChar a -> b Source # foldr1 :: (a -> a -> a) -> UChar a -> a Source # foldl1 :: (a -> a -> a) -> UChar a -> a Source # toList :: UChar a -> [a] Source # null :: UChar a -> Bool Source # length :: UChar a -> Int Source # elem :: Eq a => a -> UChar a -> Bool Source # maximum :: Ord a => UChar a -> a Source # minimum :: Ord a => UChar a -> a Source # | |||||
Traversable (UChar :: Type -> Type) Source # | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
Functor (URec Char :: Type -> Type) Source # | Since: base-4.9.0.0 | ||||
Generic (URec Char p) Source # | |||||
Defined in GHC.Internal.Generics
| |||||
Show (URec Char p) Source # | Since: base-4.9.0.0 | ||||
Eq (URec Char p) Source # | Since: base-4.9.0.0 | ||||
Ord (URec Char p) Source # | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics compare :: URec Char p -> URec Char p -> Ordering Source # (<) :: URec Char p -> URec Char p -> Bool Source # (<=) :: URec Char p -> URec Char p -> Bool Source # (>) :: URec Char p -> URec Char p -> Bool Source # (>=) :: URec Char p -> URec Char p -> Bool Source # | |||||
data URec Char (p :: k) Source # | Used for marking occurrences of Since: base-4.9.0.0 | ||||
type Compare (a :: Char) (b :: Char) Source # | |||||
Defined in GHC.Internal.Data.Type.Ord | |||||
type Rep1 (URec Char :: k -> Type) Source # | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
type Rep (URec Char p) Source # | Since: base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics |
String
is an alias for a list of characters.
String constants in Haskell are values of type String
.
That means if you write a string literal like "hello world"
,
it will have the type [Char]
, which is the same as String
.
Note: You can ask the compiler to automatically infer different types
with the -XOverloadedStrings
language extension, for example
"hello world" :: Text
. See IsString
for more information.
Because String
is just a list of characters, you can use normal list functions
to do basic string manipulation. See Data.List for operations on lists.
Performance considerations
[Char]
is a relatively memory-inefficient type.
It is a linked list of boxed word-size characters, internally it looks something like:
╭─────┬───┬──╮ ╭─────┬───┬──╮ ╭─────┬───┬──╮ ╭────╮ │ (:) │ │ ─┼─>│ (:) │ │ ─┼─>│ (:) │ │ ─┼─>│ [] │ ╰─────┴─┼─┴──╯ ╰─────┴─┼─┴──╯ ╰─────┴─┼─┴──╯ ╰────╯ v v v 'a' 'b' 'c'
The String
"abc" will use 5*3+1 = 16
(in general 5n+1
)
words of space in memory.
Furthermore, operations like (++)
(string concatenation) are O(n)
(in the left argument).
For historical reasons, the base
library uses String
in a lot of places
for the conceptual simplicity, but library code dealing with user-data
should use the text
package for Unicode text, or the the
bytestring package
for binary data.
Tuples
curry :: ((a, b) -> c) -> a -> b -> c Source #
Convert an uncurried function to a curried function.
Examples
>>>
curry fst 1 2
1
uncurry :: (a -> b -> c) -> (a, b) -> c Source #
uncurry
converts a curried function to a function on pairs.
Examples
>>>
uncurry (+) (1,2)
3
>>>
uncurry ($) (show, 1)
"1"
>>>
map (uncurry max) [(1,2), (3,4), (6,8)]
[2,4,8]
Basic type classes
The Eq
class defines equality (==
) and inequality (/=
).
All the basic datatypes exported by the Prelude are instances of Eq
,
and Eq
may be derived for any datatype whose constituents are also
instances of Eq
.
The Haskell Report defines no laws for Eq
. However, instances are
encouraged to follow these properties:
Instances
Eq ByteArray Source # | Since: base-4.17.0.0 |
Eq Timeout Source # | |
Eq BigNat # | |
Eq Void Source # | Since: base-4.8.0.0 |
Eq ByteOrder Source # | Since: base-4.11.0.0 |
Eq ClosureType Source # | |
Defined in GHC.Internal.ClosureTypes (==) :: ClosureType -> ClosureType -> Bool Source # (/=) :: ClosureType -> ClosureType -> Bool Source # | |
Eq BlockReason Source # | Since: base-4.3.0.0 |
Defined in GHC.Internal.Conc.Sync (==) :: BlockReason -> BlockReason -> Bool Source # (/=) :: BlockReason -> BlockReason -> Bool Source # | |
Eq ThreadId Source # | Since: base-4.2.0.0 |
Eq ThreadStatus Source # | Since: base-4.3.0.0 |
Defined in GHC.Internal.Conc.Sync (==) :: ThreadStatus -> ThreadStatus -> Bool Source # (/=) :: ThreadStatus -> ThreadStatus -> Bool Source # | |
Eq Constr Source # | Equality of constructors Since: base-4.0.0.0 |
Eq ConstrRep Source # | Since: base-4.0.0.0 |
Eq DataRep Source # | Since: base-4.0.0.0 |
Eq Fixity Source # | Since: base-4.0.0.0 |
Eq All Source # | Since: base-2.1 |
Eq Any Source # | Since: base-2.1 |
Eq SomeTypeRep Source # | |
Defined in GHC.Internal.Data.Typeable.Internal (==) :: SomeTypeRep -> SomeTypeRep -> Bool Source # (/=) :: SomeTypeRep -> SomeTypeRep -> Bool Source # | |
Eq Unique Source # | |
Eq Version Source # | Since: base-2.1 |
Eq ControlMessage Source # | Since: base-4.4.0.0 |
Eq Event Source # | Since: base-4.4.0.0 |
Eq EventLifetime Source # | Since: base-4.8.0.0 |
Eq Lifetime Source # | Since: base-4.8.1.0 |
Eq FdKey Source # | Since: base-4.4.0.0 |
Eq State Source # | Since: base-4.4.0.0 |
Eq TimeoutKey Source # | |
Defined in GHC.Internal.Event.TimeOut (==) :: TimeoutKey -> TimeoutKey -> Bool Source # (/=) :: TimeoutKey -> TimeoutKey -> Bool Source # | |
Eq State Source # | Since: base-4.7.0.0 |
Eq Unique Source # | Since: base-4.4.0.0 |
Eq ErrorCall Source # | Since: base-4.7.0.0 |
Eq ArithException Source # | Since: base-3.0 |
Defined in GHC.Internal.Exception.Type (==) :: ArithException -> ArithException -> Bool Source # (/=) :: ArithException -> ArithException -> Bool Source # | |
Eq SpecConstrAnnotation Source # | Since: base-4.3.0.0 |
Defined in GHC.Internal.Exts (==) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool Source # (/=) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool Source # | |
Eq Fingerprint Source # | Since: base-4.4.0.0 |
Defined in GHC.Internal.Fingerprint.Type (==) :: Fingerprint -> Fingerprint -> Bool Source # (/=) :: Fingerprint -> Fingerprint -> Bool Source # | |
Eq Errno Source # | Since: base-2.1 |
Eq CBool Source # | |
Eq CChar Source # | |
Eq CClock Source # | |
Eq CDouble Source # | |
Eq CFloat Source # | |
Eq CInt Source # | |
Eq CIntMax Source # | |
Eq CIntPtr Source # | |
Eq CLLong Source # | |
Eq CLong Source # | |
Eq CPtrdiff Source # | |
Eq CSChar Source # | |
Eq CSUSeconds Source # | |
Defined in GHC.Internal.Foreign.C.Types (==) :: CSUSeconds -> CSUSeconds -> Bool Source # (/=) :: CSUSeconds -> CSUSeconds -> Bool Source # | |
Eq CShort Source # | |
Eq CSigAtomic Source # | |
Defined in GHC.Internal.Foreign.C.Types (==) :: CSigAtomic -> CSigAtomic -> Bool Source # (/=) :: CSigAtomic -> CSigAtomic -> Bool Source # | |
Eq CSize Source # | |
Eq CTime Source # | |
Eq CUChar Source # | |
Eq CUInt Source # | |
Eq CUIntMax Source # | |
Eq CUIntPtr Source # | |
Eq CULLong Source # | |
Eq CULong Source # | |
Eq CUSeconds Source # | |
Eq CUShort Source # | |
Eq CWchar Source # | |
Eq IntPtr Source # | |
Eq WordPtr Source # | |
Eq ForeignSrcLang Source # | |
Defined in GHC.Internal.ForeignSrcLang (==) :: ForeignSrcLang -> ForeignSrcLang -> Bool Source # (/=) :: ForeignSrcLang -> ForeignSrcLang -> Bool Source # | |
Eq Associativity Source # | Since: base-4.6.0.0 |
Defined in GHC.Internal.Generics (==) :: Associativity -> Associativity -> Bool Source # (/=) :: Associativity -> Associativity -> Bool Source # | |
Eq DecidedStrictness Source # | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics (==) :: DecidedStrictness -> DecidedStrictness -> Bool Source # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool Source # | |
Eq Fixity Source # | Since: base-4.6.0.0 |
Eq SourceStrictness Source # | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics (==) :: SourceStrictness -> SourceStrictness -> Bool Source # (/=) :: SourceStrictness -> SourceStrictness -> Bool Source # | |
Eq SourceUnpackedness Source # | Since: base-4.9.0.0 |
Defined in GHC.Internal.Generics (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool Source # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool Source # | |
Eq MaskingState Source # | Since: base-4.3.0.0 |
Defined in GHC.Internal.IO (==) :: MaskingState -> MaskingState -> Bool Source # (/=) :: MaskingState -> MaskingState -> Bool Source # | |
Eq BufferState Source # | Since: base-4.2.0.0 |
Defined in GHC.Internal.IO.Buffer (==) :: BufferState -> BufferState -> Bool Source # (/=) :: BufferState -> BufferState -> Bool Source # | |
Eq IODeviceType Source # | Since: base-4.2.0.0 |
Defined in GHC.Internal.IO.Device (==) :: IODeviceType -> IODeviceType -> Bool Source # (/=) :: IODeviceType -> IODeviceType -> Bool Source # | |
Eq SeekMode Source # | Since: base-4.2.0.0 |
Eq CodingProgress Source # | Since: base-4.4.0.0 |
Defined in GHC.Internal.IO.Encoding.Types (==) :: CodingProgress -> CodingProgress -> Bool Source # (/=) :: CodingProgress -> CodingProgress -> Bool Source # | |
Eq ArrayException Source # | Since: base-4.2.0.0 |
Defined in GHC.Internal.IO.Exception (==) :: ArrayException -> ArrayException -> Bool Source # (/=) :: ArrayException -> ArrayException -> Bool Source # | |
Eq AsyncException Source # | Since: base-4.2.0.0 |
Defined in GHC.Internal.IO.Exception (==) :: AsyncException -> AsyncException -> Bool Source # (/=) :: AsyncException -> AsyncException -> Bool Source # | |
Eq ExitCode Source # | |
Eq IOErrorType Source # | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception (==) :: IOErrorType -> IOErrorType -> Bool Source # (/=) :: IOErrorType -> IOErrorType -> Bool Source # | |
Eq IOException Source # | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception (==) :: IOException -> IOException -> Bool Source # (/=) :: IOException -> IOException -> Bool Source # | |
Eq HandlePosn Source # | Since: base-4.1.0.0 |
Defined in GHC.Internal.IO.Handle (==) :: HandlePosn -> HandlePosn -> Bool Source # (/=) :: HandlePosn -> HandlePosn -> Bool Source # | |
Eq BufferMode Source # | Since: base-4.2.0.0 |
Defined in GHC.Internal.IO.Handle.Types (==) :: BufferMode -> BufferMode -> Bool Source # (/=) :: BufferMode -> BufferMode -> Bool Source # | |
Eq Handle Source # | Since: base-4.1.0.0 |
Eq Newline Source # | Since: base-4.2.0.0 |
Eq NewlineMode Source # | Since: base-4.2.0.0 |
Defined in GHC.Internal.IO.Handle.Types (==) :: NewlineMode -> NewlineMode -> Bool Source # (/=) :: NewlineMode -> NewlineMode -> Bool Source # | |
Eq IOMode Source # | Since: base-4.2.0.0 |
Eq IoSubSystem Source # | |
Defined in GHC.Internal.IO.SubSystem (==) :: IoSubSystem -> IoSubSystem -> Bool Source # (/=) :: IoSubSystem -> IoSubSystem -> Bool Source # | |
Eq InfoProv Source # | |
Eq Int16 Source # | Since: base-2.1 |
Eq Int32 Source # | Since: base-2.1 |
Eq Int64 Source # | Since: base-2.1 |
Eq Int8 Source # | Since: base-2.1 |
Eq Extension Source # | |
Eq IoManagerFlag Source # | |
Defined in GHC.Internal.RTS.Flags (==) :: IoManagerFlag -> IoManagerFlag -> Bool Source # (/=) :: IoManagerFlag -> IoManagerFlag -> Bool Source # | |
Eq StackEntry Source # | |
Defined in GHC.Internal.Stack.CloneStack (==) :: StackEntry -> StackEntry -> Bool Source # (/=) :: StackEntry -> StackEntry -> Bool Source # | |
Eq SrcLoc Source # | Since: base-4.9.0.0 |
Eq CBlkCnt Source # | |
Eq CBlkSize Source # | |
Eq CCc Source # | |
Eq CClockId Source # | |
Eq CDev Source # | |
Eq CFsBlkCnt Source # | |
Eq CFsFilCnt Source # | |
Eq CGid Source # | |
Eq CId Source # | |
Eq CIno Source # | |
Eq CKey Source # | |
Eq CMode Source # | |
Eq CNfds Source # | |
Eq CNlink Source # | |
Eq COff Source # | |
Eq CPid Source # | |
Eq CRLim Source # | |
Eq CSocklen Source # | |
Eq CSpeed Source # | |
Eq CSsize Source # | |
Eq CTcflag Source # | |
Eq CTimer Source # | |
Eq CUid Source # | |
Eq Fd Source # | |
Eq AnnLookup Source # | |
Eq AnnTarget Source # | |
Eq Bang Source # | |
Eq BndrVis Source # | |
Eq Body Source # | |
Eq Bytes Source # | |
Eq Callconv Source # | |
Eq Clause Source # | |
Eq Con Source # | |
Eq Dec Source # | |
Eq DecidedStrictness Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: DecidedStrictness -> DecidedStrictness -> Bool Source # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool Source # | |
Eq DerivClause Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: DerivClause -> DerivClause -> Bool Source # (/=) :: DerivClause -> DerivClause -> Bool Source # | |
Eq DerivStrategy Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: DerivStrategy -> DerivStrategy -> Bool Source # (/=) :: DerivStrategy -> DerivStrategy -> Bool Source # | |
Eq DocLoc Source # | |
Eq Exp Source # | |
Eq FamilyResultSig Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: FamilyResultSig -> FamilyResultSig -> Bool Source # (/=) :: FamilyResultSig -> FamilyResultSig -> Bool Source # | |
Eq Fixity Source # | |
Eq FixityDirection Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: FixityDirection -> FixityDirection -> Bool Source # (/=) :: FixityDirection -> FixityDirection -> Bool Source # | |
Eq Foreign Source # | |
Eq FunDep Source # | |
Eq Guard Source # | |
Eq Info Source # | |
Eq InjectivityAnn Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: InjectivityAnn -> InjectivityAnn -> Bool Source # (/=) :: InjectivityAnn -> InjectivityAnn -> Bool Source # | |
Eq Inline Source # | |
Eq Lit Source # | |
Eq Loc Source # | |
Eq Match Source # | |
Eq ModName Source # | |
Eq Module Source # | |
Eq ModuleInfo Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: ModuleInfo -> ModuleInfo -> Bool Source # (/=) :: ModuleInfo -> ModuleInfo -> Bool Source # | |
Eq Name Source # | |
Eq NameFlavour Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: NameFlavour -> NameFlavour -> Bool Source # (/=) :: NameFlavour -> NameFlavour -> Bool Source # | |
Eq NameSpace Source # | |
Eq NamespaceSpecifier Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: NamespaceSpecifier -> NamespaceSpecifier -> Bool Source # (/=) :: NamespaceSpecifier -> NamespaceSpecifier -> Bool Source # | |
Eq OccName Source # | |
Eq Overlap Source # | |
Eq Pat Source # | |
Eq PatSynArgs Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: PatSynArgs -> PatSynArgs -> Bool Source # (/=) :: PatSynArgs -> PatSynArgs -> Bool Source # | |
Eq PatSynDir Source # | |
Eq Phases Source # | |
Eq PkgName Source # | |
Eq Pragma Source # | |
Eq Range Source # | |
Eq Role Source # | |
Eq RuleBndr Source # | |
Eq RuleMatch Source # | |
Eq Safety Source # | |
Eq SourceStrictness Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: SourceStrictness -> SourceStrictness -> Bool Source # (/=) :: SourceStrictness -> SourceStrictness -> Bool Source # | |
Eq SourceUnpackedness Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool Source # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool Source # | |
Eq Specificity Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: Specificity -> Specificity -> Bool Source # (/=) :: Specificity -> Specificity -> Bool Source # | |
Eq Stmt Source # | |
Eq TyLit Source # | |
Eq TySynEqn Source # | |
Eq Type Source # | |
Eq TypeFamilyHead Source # | |
Defined in GHC.Internal.TH.Syntax (==) :: TypeFamilyHead -> TypeFamilyHead -> Bool Source # (/=) :: TypeFamilyHead -> TypeFamilyHead -> Bool Source # | |
Eq Lexeme Source # | Since: base-2.1 |
Eq Number Source # | Since: base-4.6.0.0 |
Eq SomeChar Source # | |
Eq SomeSymbol Source # | Since: base-4.7.0.0 |
Defined in GHC.Internal.TypeLits (==) :: SomeSymbol -> SomeSymbol -> Bool Source # (/=) :: SomeSymbol -> SomeSymbol -> Bool Source # | |
Eq SomeNat Source # | Since: base-4.7.0.0 |
Eq GeneralCategory Source # | Since: base-2.1 |
Defined in GHC.Internal.Unicode (==) :: GeneralCategory -> GeneralCategory -> Bool Source # (/=) :: GeneralCategory -> GeneralCategory -> Bool Source # | |
Eq Word16 Source # | Since: base-2.1 |
Eq Word32 Source # | Since: base-2.1 |
Eq Word64 Source # | Since: base-2.1 |
Eq Word8 Source # | Since: base-2.1 |
Eq Module Source # | |
Eq Ordering Source # | |
Eq TrName Source # | |
Eq TyCon Source # | |
Eq Integer # | |
Eq Natural # | |
Eq () Source # | |
Eq Bool Source # | |
Eq Char Source # | |
Eq Double Source # | Note that due to the presence of
Also note that
|
Eq Float Source # | Note that due to the presence of
Also note that
|
Eq Int Source # | |
Eq Word Source # | |
Eq (Chan a) Source # | Since: base-4.4.0.0 |
Eq (MutableByteArray s) Source # | Since: base-4.17.0.0 |
Defined in Data.Array.Byte (==) :: MutableByteArray s -> MutableByteArray s -> Bool Source # (/=) :: MutableByteArray s -> MutableByteArray s -> Bool Source # | |
Eq a => Eq (Complex a) Source # | Since: base-2.1 |
Eq a => Eq (First a) Source # | Since: base-4.9.0.0 |
Eq a => Eq (Last a) Source # | Since: base-4.9.0.0 |
Eq a => Eq (Max a) Source # | Since: base-4.9.0.0 |
Eq a => Eq (Min a) Source # | Since: base-4.9.0.0 |
Eq m => Eq (WrappedMonoid m) Source # | Since: base-4.9.0.0 |
Defined in Data.Semigroup (==) :: WrappedMonoid m -> WrappedMonoid m -> Bool Source # (/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool Source # | |
Eq a => Eq (NonEmpty a) Source # | Since: base-4.9.0.0 |
Eq (TVar a) Source # | Since: base-4.8.0.0 |
Eq a => Eq (And a) Source # | Since: base-4.16 |
Eq a => Eq (Iff a) Source # | Since: base-4.16 |
Eq a => Eq (Ior a) Source # | Since: base-4.16 |
Eq a => Eq (Xor a) Source # | Since: base-4.16 |
Eq a => Eq (Identity a) Source # | Since: base-4.8.0.0 |
Eq a => Eq (First a) Source # | Since: base-2.1 |
Eq a => Eq (Last a) Source # | Since: base-2.1 |
Eq a => Eq (Down a) Source # | Since: base-4.6.0.0 |
Eq a => Eq (Dual a) Source # | Since: base-2.1 |
Eq a => Eq (Product a) Source # | Since: base-2.1 |
Eq a => Eq (Sum a) Source # | Since: base-2.1 |
Eq (ConstPtr a) Source # | |
Eq (ForeignPtr a) Source # | Since: base-2.1 |
Defined in GHC.Internal.ForeignPtr (==) :: ForeignPtr a -> ForeignPtr a -> Bool Source # (/=) :: ForeignPtr a -> ForeignPtr a -> Bool Source # | |
Eq a => Eq (ZipList a) Source # | Since: base-4.7.0.0 |
Eq p => Eq (Par1 p) Source # | Since: base-4.7.0.0 |
Eq (IOPort a) Source # | Since: base-4.1.0.0 |
Eq (IORef a) Source # | Pointer equality. Since: base-4.0.0.0 |
Eq (MVar a) Source # | Compares the underlying pointers. Since: base-4.1.0.0 |
Eq (FunPtr a) Source # | |
Eq (Ptr a) Source # | Since: base-2.1 |
Eq a => Eq (Ratio a) Source # | Since: base-2.1 |
Eq (StablePtr a) Source # | Since: base-2.1 |
Eq (StableName a) Source # | Since: base-2.1 |
Defined in GHC.Internal.StableName (==) :: StableName a -> StableName a -> Bool Source # (/=) :: StableName a -> StableName a -> Bool Source # | |
Eq flag => Eq (TyVarBndr flag) Source # | |
Eq (SChar c) Source # | Since: base-4.19.0.0 |
Eq (SSymbol s) Source # | Since: base-4.19.0.0 |
Eq (SNat n) Source # | Since: base-4.19.0.0 |
Eq a => Eq (Maybe a) Source # | Since: base-2.1 |
Eq a => Eq (Solo a) Source # | |
Eq a => Eq [a] Source # | |
Eq (Fixed a) Source # | Since: base-2.1 |
Eq a => Eq (Arg a b) Source # | Note that
Since: base-4.9.0.0 |
(Ix i, Eq e) => Eq (Array i e) Source # | Since: base-2.1 |
(Eq a, Eq b) => Eq (Either a b) Source # | Since: base-2.1 |
Eq (Proxy s) Source # | Since: base-4.7.0.0 |
Eq (TypeRep a) Source # | Since: base-2.1 |
Eq (U1 p) Source # | Since: base-4.9.0.0 |
Eq (V1 p) Source # | Since: base-4.9.0.0 |
Eq (IOArray i e) Source # | Since: base-4.1.0.0 |
Eq (STRef s a) Source # | Pointer equality. Since: base-2.1 |
(Eq a, Eq b) => Eq (a, b) Source # | |
Eq (STArray s i e) Source # | Since: base-2.1 |
Eq a => Eq (Const a b) Source # | Since: base-4.9.0.0 |
Eq (f a) => Eq (Ap f a) Source # | Since: base-4.12.0.0 |
Eq (f a) => Eq (Alt f a) Source # | Since: base-4.8.0.0 |
Eq (Coercion a b) Source # | Since: base-4.7.0.0 |
Eq (a :~: b) Source # | Since: base-4.7.0.0 |
Eq (OrderingI a b) Source # | |
(Generic1 f, Eq (Rep1 f a)) => Eq (Generically1 f a) Source # | Since: base-4.18.0.0 |
Defined in GHC.Internal.Generics (==) :: Generically1 f a -> Generically1 f a -> Bool Source # (/=) :: Generically1 f a -> Generically1 f a -> Bool Source # | |
Eq (f p) => Eq (Rec1 f p) Source # | Since: base-4.7.0.0 |
Eq (URec (Ptr ()) p) Source # | Since: base-4.9.0.0 |
Eq (URec Char p) Source # | Since: base-4.9.0.0 |
Eq (URec Double p) Source # | Since: base-4.9.0.0 |
Eq (URec Float p) Source # | |
Eq (URec Int p) Source # | Since: base-4.9.0.0 |
Eq (URec Word p) Source # | Since: base-4.9.0.0 |
(Eq a, Eq b, Eq c) => Eq (a, b, c) Source # | |
(Eq (f a), Eq (g a)) => Eq (Product f g a) Source # | Since: base-4.18.0.0 |
(Eq (f a), Eq (g a)) => Eq (Sum f g a) Source # | Since: base-4.18.0.0 |
Eq (a :~~: b) Source # | Since: base-4.10.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :*: g) p) Source # | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :+: g) p) Source # | Since: base-4.7.0.0 |
Eq c => Eq (K1 i c p) Source # | Since: base-4.7.0.0 |
(Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) Source # | |
Eq (f (g a)) => Eq (Compose f g a) Source # | Since: base-4.18.0.0 |
Eq (f (g p)) => Eq ((f :.: g) p) Source # | Since: base-4.7.0.0 |
Eq (f p) => Eq (M1 i c f p) Source # | Since: base-4.7.0.0 |
(Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) Source # | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) Source # | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) Source # | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h) Source # | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i) Source # | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j) Source # | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k) Source # | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l) Source # | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) Source # | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source # | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source # | |
class Eq a => Ord a where Source #
The Ord
class is used for totally ordered datatypes.
Instances of Ord
can be derived for any user-defined datatype whose
constituent types are in Ord
. The declared order of the constructors in
the data declaration determines the ordering in derived Ord
instances. The
Ordering
datatype allows a single comparison to determine the precise
ordering of two objects.
Ord
, as defined by the Haskell report, implements a total order and has the
following properties:
- Comparability
x <= y || y <= x
=True
- Transitivity
- if
x <= y && y <= z
=True
, thenx <= z
=True
- Reflexivity
x <= x
=True
- Antisymmetry
- if
x <= y && y <= x
=True
, thenx == y
=True
The following operator interactions are expected to hold:
x >= y
=y <= x
x < y
=x <= y && x /= y
x > y
=y < x
x < y
=compare x y == LT
x > y
=compare x y == GT
x == y
=compare x y == EQ
min x y == if x <= y then x else y
=True
max x y == if x >= y then x else y
=True
Note that (7.) and (8.) do not require min
and max
to return either of
their arguments. The result is merely required to equal one of the
arguments in terms of (==)
. Users who expect a stronger guarantee are advised
to write their own min and/or max functions.
The nuance of the above distinction is not always fully internalized by
developers, and in the past (tracing back to the Haskell 1.4 Report) the
specification for Ord
asserted the stronger property that (min x y, max x
y) = (x, y)
or (y, x)
, or in other words, that min
and max
will
return one of their arguments, using argument order as the tie-breaker if
the arguments are equal by comparison. A few list and
Foldable
functions have behavior that is best understood
with this assumption in mind: all variations of minimumBy
and maximumBy
(which can't use min
and max
in their implementations) are written such
that minimumBy
and compare
maximumBy
are respectively
equivalent to compare
minimum
and maximum
(which do use min
and max
) only if
min
and max
adhere to this tie-breaking convention. Otherwise, if there
are multiple least or largest elements in a container, minimum
and
maximum
may not return the same one that minimumBy
and
compare
maximumBy
do (though they should return something that is
equal). (This is relevant for types with non-extensional equality, like
compare
Arg
, but also in cases where the precise reference held
matters for memory-management reasons.) Unless there is a reason to deviate,
it is less confusing for implementors of Ord
to respect this same
convention (as the default definitions of min
and max
do).
Minimal complete definition: either compare
or <=
.
Using compare
can be more efficient for complex types.
compare :: a -> a -> Ordering Source #
(<) :: a -> a -> Bool infix 4 Source #
(<=) :: a -> a -> Bool infix 4 Source #
(>) :: a -> a -> Bool infix 4 Source #
Instances
Ord ByteArray Source # | Non-lexicographic ordering. This compares the lengths of the byte arrays first and uses a lexicographic ordering if the lengths are equal. Subject to change between major versions. Since: base-4.17.0.0 |
Defined in Data.Array.Byte | |
Ord BigNat # | |
Defined in GHC.Num.BigNat | |
Ord Void Source # | Since: base-4.8.0.0 |
Ord ByteOrder Source # | Since: base-4.11.0.0 |
Defined in GHC.Internal.ByteOrder | |
Ord ClosureType Source # | |
Defined in GHC.Internal.ClosureTypes compare :: ClosureType -> ClosureType -> Ordering Source # (<) :: ClosureType -> ClosureType -> Bool Source # (<=) :: ClosureType -> ClosureType -> Bool Source # (>) :: ClosureType -> ClosureType -> Bool Source # (>=) :: ClosureType -> ClosureType -> Bool Source # max :: ClosureType -> ClosureType -> ClosureType Source # min :: ClosureType -> ClosureType -> ClosureType Source # | |
Ord BlockReason Source # | Since: base-4.3.0.0 |
Defined in GHC.Internal.Conc.Sync compare :: BlockReason -> BlockReason -> Ordering Source # (<) :: BlockReason -> BlockReason -> Bool Source # (<=) :: BlockReason -> BlockReason -> Bool Source # (>) :: BlockReason -> BlockReason -> Bool Source # (>=) :: BlockReason -> BlockReason -> Bool Source # max :: BlockReason -> BlockReason -> BlockReason Source # min :: BlockReason -> BlockReason -> BlockReason Source # | |
Ord ThreadId Source # | Since: base-4.2.0.0 |
Defined in GHC.Internal.Conc.Sync | |
Ord ThreadStatus Source # | Since: base-4.3.0.0 |
Defined in GHC.Internal.Conc.Sync compare :: ThreadStatus -> ThreadStatus -> Ordering Source # (<) :: ThreadStatus -> ThreadStatus -> Bool Source # (<=) :: ThreadStatus -> ThreadStatus -> Bool Source # (>) :: ThreadStatus -> ThreadStatus -> Bool Source # (>=) :: ThreadStatus -> ThreadStatus -> Bool Source # max :: ThreadStatus -> ThreadStatus -> ThreadStatus Source # min :: ThreadStatus -> ThreadStatus -> ThreadStatus Source # | |
Ord All Source # | Since: base-2.1 |
Ord Any Source # | Since: base-2.1 |
Ord SomeTypeRep Source # | |
Defined in GHC.Internal.Data.Typeable.Internal compare :: SomeTypeRep -> SomeTypeRep -> Ordering Source # (<) :: SomeTypeRep -> SomeTypeRep -> Bool Source # (<=) :: SomeTypeRep -> SomeTypeRep -> Bool Source # (>) :: SomeTypeRep -> SomeTypeRep -> Bool Source # (>=) :: SomeTypeRep -> SomeTypeRep -> Bool Source # max :: SomeTypeRep -> SomeTypeRep -> SomeTypeRep Source # min :: SomeTypeRep -> SomeTypeRep -> SomeTypeRep Source # | |
Ord Unique Source # | |
Defined in GHC.Internal.Data.Unique | |
Ord Version Source # | Since: base-2.1 |
Defined in GHC.Internal.Data.Version | |
Ord TimeoutKey Source # | |
Defined in GHC.Internal.Event.TimeOut compare :: TimeoutKey -> TimeoutKey -> Ordering Source # (<) :: TimeoutKey -> TimeoutKey -> Bool Source # (<=) :: TimeoutKey -> TimeoutKey -> Bool Source # (>) :: TimeoutKey -> TimeoutKey -> Bool Source # (>=) :: TimeoutKey -> TimeoutKey -> Bool Source # max :: TimeoutKey -> TimeoutKey -> TimeoutKey Source # min :: TimeoutKey -> TimeoutKey -> TimeoutKey Source # | |
Ord Unique Source # | Since: base-4.4.0.0 |
Defined in GHC.Internal.Event.Unique | |
Ord ErrorCall Source # | Since: base-4.7.0.0 |
Defined in GHC.Internal.Exception | |
Ord ArithException Source # | Since: base-3.0 |
Defined in GHC.Internal.Exception.Type compare :: ArithException -> ArithException -> Ordering Source # (<) :: ArithException -> ArithException -> Bool Source # (<=) :: ArithException -> ArithException -> Bool Source # (>) :: ArithException -> ArithException -> Bool Source # (>=) :: ArithException -> ArithException -> Bool Source # max :: ArithException -> ArithException -> ArithException Source # min :: ArithException -> ArithException -> ArithException Source # | |
Ord Fingerprint Source # | Since: base-4.4.0.0 |
Defined in GHC.Internal.Fingerprint.Type compare :: Fingerprint -> Fingerprint -> Ordering Source # (<) :: Fingerprint -> Fingerprint -> Bool Source # (<=) :: Fingerprint -> Fingerprint -> Bool Source # (>) :: Fingerprint -> Fingerprint -> Bool Source # (>=) :: Fingerprint -> Fingerprint -> Bool Source # max :: Fingerprint -> Fingerprint -> Fingerprint Source # min :: Fingerprint -> Fingerprint -> Fingerprint Source # | |
Ord CBool Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CChar Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CClock Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CDouble Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CFloat Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CInt Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CIntMax Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CIntPtr Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CLLong Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CLong Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CPtrdiff Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CSChar Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CSUSeconds Source # | |
Defined in GHC.Internal.Foreign.C.Types compare :: CSUSeconds -> CSUSeconds -> Ordering Source # (<) :: CSUSeconds -> CSUSeconds -> Bool Source # (<=) :: CSUSeconds -> CSUSeconds -> Bool Source # (>) :: CSUSeconds -> CSUSeconds -> Bool Source # (>=) :: CSUSeconds -> CSUSeconds -> Bool Source # max :: CSUSeconds -> CSUSeconds -> CSUSeconds Source # min :: CSUSeconds -> CSUSeconds -> CSUSeconds Source # | |
Ord CShort Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CSigAtomic Source # | |
Defined in GHC.Internal.Foreign.C.Types compare :: CSigAtomic -> CSigAtomic -> Ordering Source # (<) :: CSigAtomic -> CSigAtomic -> Bool Source # (<=) :: CSigAtomic -> CSigAtomic -> Bool Source # (>) :: CSigAtomic -> CSigAtomic -> Bool Source # (>=) :: CSigAtomic -> CSigAtomic -> Bool Source # max :: CSigAtomic -> CSigAtomic -> CSigAtomic Source # min :: CSigAtomic -> CSigAtomic -> CSigAtomic Source # | |
Ord CSize Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CTime Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CUChar Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CUInt Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CUIntMax Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CUIntPtr Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CULLong Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CULong Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CUSeconds Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CUShort Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord CWchar Source # | |
Defined in GHC.Internal.Foreign.C.Types | |
Ord IntPtr Source # | |
Defined in GHC.Internal.Foreign.Ptr | |
Ord WordPtr Source # | |
Defined in GHC.Internal.Foreign.Ptr | |
Ord Associativity Source # | Since: base-4.6.0.0 |
Defined in GHC.Internal.Generics compare :: Associativity -> Associativity -> Ordering Source # (<) :: Associativity -> Associativity -> Bool Source |