Copyright | (c) 2016 Stephen Diehl (c) 2016-2018 Serokell (c) 2018-2022 Kowainik |
---|---|
License | MIT |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Stability | Stable |
Portability | Portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Reexports from Data.*
and GHC.*
modules of
base package.
Synopsis
- data Char
- chr :: Int -> Char
- class Eq a where
- class Eq a => Ord a where
- data Ordering
- comparing :: Ord a => (b -> a) -> b -> b -> Ordering
- newtype Down a = Down {
- getDown :: a
- data IO a
- type FilePath = String
- data IOMode
- coerce :: forall (k :: RuntimeRep) (a :: TYPE k) (b :: TYPE k). Coercible a b => a -> b
- class a ~R# b => Coercible (a :: k) (b :: k)
- type Type = Type
- data Constraint
- data Proxy (t :: k) = Proxy
- class Typeable (a :: k)
- vacuous :: Functor f => f Void -> f a
- absurd :: Void -> a
- data Void
- seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b
- asTypeOf :: a -> a -> a
- ($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- ord :: Char -> Int
- class Generic a
- class Show a
- class KnownNat (n :: Nat)
- data Nat
- type family CmpNat (a :: Nat) (b :: Nat) :: Ordering where ...
- someNatVal :: Natural -> SomeNat
- natVal :: forall (n :: Nat) proxy. KnownNat n => proxy n -> Natural
- data SomeNat = KnownNat n => SomeNat (Proxy n)
- class IsLabel (x :: Symbol) a where
- fromLabel :: a
- showStackTrace :: IO (Maybe String)
- getStackTrace :: IO (Maybe [Location])
- data CallStack
- withFrozenCallStack :: HasCallStack => (HasCallStack => a) -> a
- callStack :: HasCallStack => CallStack
- prettyCallStack :: CallStack -> String
- prettySrcLoc :: SrcLoc -> String
- currentCallStack :: IO [String]
- getCallStack :: CallStack -> [([Char], SrcLoc)]
- type HasCallStack = ?callStack :: CallStack
Base types
The character type Char
is an enumeration whose values represent
Unicode (or equivalently ISO/IEC 10646) code points (i.e. characters, see
http://www.unicode.org/ for details). This set extends the ISO 8859-1
(Latin-1) character set (the first 256 characters), which is itself an extension
of the ASCII character set (the first 128 characters). A character literal in
Haskell has type Char
.
To convert a Char
to or from the corresponding Int
value defined
by Unicode, use toEnum
and fromEnum
from the
Enum
class respectively (or equivalently ord
and
chr
).
Instances
Bounded Char | Since: base-2.1 |
Enum Char | Since: base-2.1 |
Eq Char | |
Data Char | Since: base-4.0.0.0 |
Defined in Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Char -> c Char # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Char # dataTypeOf :: Char -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Char) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Char) # gmapT :: (forall b. Data b => b -> b) -> Char -> Char # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r # gmapQ :: (forall d. Data d => d -> u) -> Char -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Char -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Char -> m Char # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char # | |
Ord Char | |
Read Char | Since: base-2.1 |
Show Char | Since: base-2.1 |
Ix Char | Since: base-2.1 |
NFData Char | |
Defined in Control.DeepSeq | |
Hashable Char | |
Defined in Data.Hashable.Class | |
ErrorList Char | |
Defined in Control.Monad.Trans.Error | |
ToString String Source # | |
ToLText String Source # | |
ToText String Source # | |
Lift Char | |
ConvertUtf8 String ShortByteString Source # | Since: 0.6.0.0 |
Defined in Relude.String.Conversion | |
ConvertUtf8 String ByteString Source # | |
Defined in Relude.String.Conversion encodeUtf8 :: String -> ByteString Source # decodeUtf8 :: ByteString -> String Source # decodeUtf8Strict :: ByteString -> Either UnicodeException String Source # | |
ConvertUtf8 String LByteString Source # | Converting |
Defined in Relude.String.Conversion | |
Generic1 (URec Char :: k -> Type) | Since: base-4.9.0.0 |
Foldable (UChar :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => UChar m -> m # foldMap :: Monoid m => (a -> m) -> UChar a -> m # foldMap' :: Monoid m => (a -> m) -> UChar a -> m # foldr :: (a -> b -> b) -> b -> UChar a -> b # foldr' :: (a -> b -> b) -> b -> UChar a -> b # foldl :: (b -> a -> b) -> b -> UChar a -> b # foldl' :: (b -> a -> b) -> b -> UChar a -> b # foldr1 :: (a -> a -> a) -> UChar a -> a # foldl1 :: (a -> a -> a) -> UChar a -> a # elem :: Eq a => a -> UChar a -> Bool # maximum :: Ord a => UChar a -> a # minimum :: Ord a => UChar a -> a # | |
Traversable (UChar :: Type -> Type) | Since: base-4.9.0.0 |
Functor (URec Char :: Type -> Type) | Since: base-4.9.0.0 |
Eq (URec Char p) | Since: base-4.9.0.0 |
Ord (URec Char p) | Since: base-4.9.0.0 |
Show (URec Char p) | Since: base-4.9.0.0 |
Generic (URec Char p) | Since: base-4.9.0.0 |
data URec Char (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 |
type Rep1 (URec Char :: k -> Type) | |
Defined in GHC.Generics | |
type Rep (URec Char p) | |
Defined in GHC.Generics |
Base 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, ==
is customarily
expected to implement an equivalence relationship where two values comparing
equal are indistinguishable by "public" functions, with a "public" function
being one not allowing to see implementation details. For example, for a
type representing non-normalised natural numbers modulo 100, a "public"
function doesn't make the difference between 1 and 201. It is expected to
have the following properties:
Instances
Eq Bool | |
Eq Char | |
Eq Double | Note that due to the presence of
Also note that
|
Eq Float | Note that due to the presence of
Also note that
|
Eq Int | |
Eq Int8 | Since: base-2.1 |
Eq Int16 | Since: base-2.1 |
Eq Int32 | Since: base-2.1 |
Eq Int64 | Since: base-2.1 |
Eq Integer | |
Eq Natural | Since: base-4.8.0.0 |
Eq Ordering | |
Eq Word | |
Eq Word8 | Since: base-2.1 |
Eq Word16 | Since: base-2.1 |
Eq Word32 | Since: base-2.1 |
Eq Word64 | Since: base-2.1 |
Eq SomeTypeRep | |
Defined in Data.Typeable.Internal (==) :: SomeTypeRep -> SomeTypeRep -> Bool # (/=) :: SomeTypeRep -> SomeTypeRep -> Bool # | |
Eq Exp | |
Eq Match | |
Eq Clause | |
Eq Pat | |
Eq Type | |
Eq Dec | |
Eq Name | |
Eq FunDep | |
Eq InjectivityAnn | |
Defined in Language.Haskell.TH.Syntax (==) :: InjectivityAnn -> InjectivityAnn -> Bool # (/=) :: InjectivityAnn -> InjectivityAnn -> Bool # | |
Eq Overlap | |
Eq () | |
Eq TyCon | |
Eq Module | |
Eq TrName | |
Eq Handle | Since: base-4.1.0.0 |
Eq Void | Since: base-4.8.0.0 |
Eq SpecConstrAnnotation | Since: base-4.3.0.0 |
Defined in GHC.Exts (==) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool # (/=) :: SpecConstrAnnotation -> SpecConstrAnnotation -> Bool # | |
Eq Constr | Equality of constructors Since: base-4.0.0.0 |
Eq DataRep | Since: base-4.0.0.0 |
Eq ConstrRep | Since: base-4.0.0.0 |
Eq Fixity | Since: base-4.0.0.0 |
Eq Unique | |
Eq Version | Since: base-2.1 |
Eq HandlePosn | Since: base-4.1.0.0 |
Defined in GHC.IO.Handle (==) :: HandlePosn -> HandlePosn -> Bool # (/=) :: HandlePosn -> HandlePosn -> Bool # | |
Eq ThreadId | Since: base-4.2.0.0 |
Eq BlockReason | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync (==) :: BlockReason -> BlockReason -> Bool # (/=) :: BlockReason -> BlockReason -> Bool # | |
Eq ThreadStatus | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync (==) :: ThreadStatus -> ThreadStatus -> Bool # (/=) :: ThreadStatus -> ThreadStatus -> Bool # | |
Eq AsyncException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception (==) :: AsyncException -> AsyncException -> Bool # (/=) :: AsyncException -> AsyncException -> Bool # | |
Eq ArrayException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception (==) :: ArrayException -> ArrayException -> Bool # (/=) :: ArrayException -> ArrayException -> Bool # | |
Eq ExitCode | |
Eq IOErrorType | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception (==) :: IOErrorType -> IOErrorType -> Bool # (/=) :: IOErrorType -> IOErrorType -> Bool # | |
Eq BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types (==) :: BufferMode -> BufferMode -> Bool # (/=) :: BufferMode -> BufferMode -> Bool # | |
Eq Newline | Since: base-4.2.0.0 |
Eq NewlineMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types (==) :: NewlineMode -> NewlineMode -> Bool # (/=) :: NewlineMode -> NewlineMode -> Bool # | |
Eq MaskingState | Since: base-4.3.0.0 |
Defined in GHC.IO (==) :: MaskingState -> MaskingState -> Bool # (/=) :: MaskingState -> MaskingState -> Bool # | |
Eq IOException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception (==) :: IOException -> IOException -> Bool # (/=) :: IOException -> IOException -> Bool # | |
Eq ErrorCall | Since: base-4.7.0.0 |
Eq ArithException | Since: base-3.0 |
Defined in GHC.Exception.Type (==) :: ArithException -> ArithException -> Bool # (/=) :: ArithException -> ArithException -> Bool # | |
Eq All | Since: base-2.1 |
Eq Any | Since: base-2.1 |
Eq Fixity | Since: base-4.6.0.0 |
Eq Associativity | Since: base-4.6.0.0 |
Defined in GHC.Generics (==) :: Associativity -> Associativity -> Bool # (/=) :: Associativity -> Associativity -> Bool # | |
Eq SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # | |
Eq SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics (==) :: SourceStrictness -> SourceStrictness -> Bool # (/=) :: SourceStrictness -> SourceStrictness -> Bool # | |
Eq DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics (==) :: DecidedStrictness -> DecidedStrictness -> Bool # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool # | |
Eq SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits (==) :: SomeSymbol -> SomeSymbol -> Bool # (/=) :: SomeSymbol -> SomeSymbol -> Bool # | |
Eq SomeNat | Since: base-4.7.0.0 |
Eq CChar | |
Eq CSChar | |
Eq CUChar | |
Eq CShort | |
Eq CUShort | |
Eq CInt | |
Eq CUInt | |
Eq CLong | |
Eq CULong | |
Eq CLLong | |
Eq CULLong | |
Eq CBool | |
Eq CFloat | |
Eq CDouble | |
Eq CPtrdiff | |
Eq CSize | |
Eq CWchar | |
Eq CSigAtomic | |
Defined in Foreign.C.Types (==) :: CSigAtomic -> CSigAtomic -> Bool # (/=) :: CSigAtomic -> CSigAtomic -> Bool # | |
Eq CClock | |
Eq CTime | |
Eq CUSeconds | |
Eq CSUSeconds | |
Defined in Foreign.C.Types (==) :: CSUSeconds -> CSUSeconds -> Bool # (/=) :: CSUSeconds -> CSUSeconds -> Bool # | |
Eq CIntPtr | |
Eq CUIntPtr | |
Eq CIntMax | |
Eq CUIntMax | |
Eq WordPtr | |
Eq IntPtr | |
Eq IOMode | Since: base-4.2.0.0 |
Eq Fingerprint | Since: base-4.4.0.0 |
Defined in GHC.Fingerprint.Type (==) :: Fingerprint -> Fingerprint -> Bool # (/=) :: Fingerprint -> Fingerprint -> Bool # | |
Eq Lexeme | Since: base-2.1 |
Eq Number | Since: base-4.6.0.0 |
Eq SrcLoc | Since: base-4.9.0.0 |
Eq ShortByteString | |
Defined in Data.ByteString.Short.Internal (==) :: ShortByteString -> ShortByteString -> Bool # (/=) :: ShortByteString -> ShortByteString -> Bool # | |
Eq ByteString | |
Defined in Data.ByteString.Lazy.Internal (==) :: ByteString -> ByteString -> Bool # (/=) :: ByteString -> ByteString -> Bool # | |
Eq ByteString | |
Defined in Data.ByteString.Internal (==) :: ByteString -> ByteString -> Bool # (/=) :: ByteString -> ByteString -> Bool # | |
Eq IntSet | |
Eq Extension | |
Eq ForeignSrcLang | |
Defined in GHC.ForeignSrcLang.Type (==) :: ForeignSrcLang -> ForeignSrcLang -> Bool # (/=) :: ForeignSrcLang -> ForeignSrcLang -> Bool # | |
Eq BigNat | |
Eq ModName | |
Eq PkgName | |
Eq Module | |
Eq OccName | |
Eq NameFlavour | |
Defined in Language.Haskell.TH.Syntax (==) :: NameFlavour -> NameFlavour -> Bool # (/=) :: NameFlavour -> NameFlavour -> Bool # | |
Eq NameSpace | |
Eq Loc | |
Eq Info | |
Eq ModuleInfo | |
Defined in Language.Haskell.TH.Syntax (==) :: ModuleInfo -> ModuleInfo -> Bool # (/=) :: ModuleInfo -> ModuleInfo -> Bool # | |
Eq Fixity | |
Eq FixityDirection | |
Defined in Language.Haskell.TH.Syntax (==) :: FixityDirection -> FixityDirection -> Bool # (/=) :: FixityDirection -> FixityDirection -> Bool # | |
Eq Lit | |
Eq Bytes | |
Eq Body | |
Eq Guard | |
Eq Stmt | |
Eq Range | |
Eq DerivClause | |
Defined in Language.Haskell.TH.Syntax (==) :: DerivClause -> DerivClause -> Bool # (/=) :: DerivClause -> DerivClause -> Bool # | |
Eq DerivStrategy | |
Defined in Language.Haskell.TH.Syntax (==) :: DerivStrategy -> DerivStrategy -> Bool # (/=) :: DerivStrategy -> DerivStrategy -> Bool # | |
Eq TypeFamilyHead | |
Defined in Language.Haskell.TH.Syntax (==) :: TypeFamilyHead -> TypeFamilyHead -> Bool # (/=) :: TypeFamilyHead -> TypeFamilyHead -> Bool # | |
Eq TySynEqn | |
Eq Foreign | |
Eq Callconv | |
Eq Safety | |
Eq Pragma | |
Eq Inline | |
Eq RuleMatch | |
Eq Phases | |
Eq RuleBndr | |
Eq AnnTarget | |
Eq SourceUnpackedness | |
Defined in Language.Haskell.TH.Syntax (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # | |
Eq SourceStrictness | |
Defined in Language.Haskell.TH.Syntax (==) :: SourceStrictness -> SourceStrictness -> Bool # (/=) :: SourceStrictness -> SourceStrictness -> Bool # | |
Eq DecidedStrictness | |
Defined in Language.Haskell.TH.Syntax (==) :: DecidedStrictness -> DecidedStrictness -> Bool # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool # | |
Eq Con | |
Eq Bang | |
Eq PatSynDir | |
Eq PatSynArgs | |
Defined in Language.Haskell.TH.Syntax (==) :: PatSynArgs -> PatSynArgs -> Bool # (/=) :: PatSynArgs -> PatSynArgs -> Bool # | |
Eq TyVarBndr | |
Eq FamilyResultSig | |
Defined in Language.Haskell.TH.Syntax (==) :: FamilyResultSig -> FamilyResultSig -> Bool # (/=) :: FamilyResultSig -> FamilyResultSig -> Bool # | |
Eq TyLit | |
Eq Role | |
Eq AnnLookup | |
Eq UnicodeException | |
Defined in Data.Text.Encoding.Error (==) :: UnicodeException -> UnicodeException -> Bool # (/=) :: UnicodeException -> UnicodeException -> Bool # | |
Eq CodePoint | |
Eq DecoderState | |
Eq Undefined Source # | |
Eq a => Eq [a] | |
Eq a => Eq (Maybe a) | Since: base-2.1 |
Eq a => Eq (Ratio a) | Since: base-2.1 |
Eq (Ptr a) | Since: base-2.1 |
Eq (FunPtr a) | |
Eq p => Eq (Par1 p) | Since: base-4.7.0.0 |
Eq a => Eq (Complex a) | Since: base-2.1 |
Eq a => Eq (Min a) | Since: base-4.9.0.0 |
Eq a => Eq (Max a) | Since: base-4.9.0.0 |
Eq a => Eq (First a) | Since: base-4.9.0.0 |
Eq a => Eq (Last a) | Since: base-4.9.0.0 |
Eq m => Eq (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup (==) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # | |
Eq a => Eq (Option a) | Since: base-4.9.0.0 |
Eq (StableName a) | Since: base-2.1 |
Defined in GHC.StableName (==) :: StableName a -> StableName a -> Bool # (/=) :: StableName a -> StableName a -> Bool # | |
Eq a => Eq (ZipList a) | Since: base-4.7.0.0 |
Eq a => Eq (Identity a) | Since: base-4.8.0.0 |
Eq (TVar a) | Since: base-4.8.0.0 |
Eq (IORef a) | Pointer equality. Since: base-4.0.0.0 |
Eq a => Eq (First a) | Since: base-2.1 |
Eq a => Eq (Last a) | Since: base-2.1 |
Eq a => Eq (Dual a) | Since: base-2.1 |
Eq a => Eq (Sum a) | Since: base-2.1 |
Eq a => Eq (Product a) | Since: base-2.1 |
Eq a => Eq (Down a) | Since: base-4.6.0.0 |
Eq (MVar a) | Since: base-4.1.0.0 |
Eq a => Eq (NonEmpty a) | Since: base-4.9.0.0 |
Eq a => Eq (IntMap a) | |
Eq a => Eq (Tree a) | |
Eq a => Eq (Seq a) | |
Eq a => Eq (ViewL a) | |
Eq a => Eq (ViewR a) | |
Eq a => Eq (Set a) | |
Eq a => Eq (Hashed a) | Uses precomputed hash to detect inequality faster |
Eq (TMVar a) | |
Eq a => Eq (HashSet a) | Note that, in the presence of hash collisions, equal
In general, the lack of substitutivity can be observed with any function that depends on the key ordering, such as folds and traversals. |
(Eq a, Eq b) => Eq (Either a b) | Since: base-2.1 |
Eq (V1 p) | Since: base-4.9.0.0 |
Eq (U1 p) | Since: base-4.9.0.0 |
Eq (TypeRep a) | Since: base-2.1 |
(Eq a, Eq b) => Eq (a, b) | |
(Ix i, Eq e) => Eq (Array i e) | Since: base-2.1 |
Eq (Fixed a) | Since: base-2.1 |
Eq a => Eq (Arg a b) | Since: base-4.9.0.0 |
Eq (Proxy s) | Since: base-4.7.0.0 |
Eq (STRef s a) | Pointer equality. Since: base-2.1 |
(Eq k, Eq a) => Eq (Map k a) | |
(Eq1 m, Eq a) => Eq (MaybeT m a) | |
(Eq k, Eq v) => Eq (Leaf k v) | |
(Eq k, Eq v) => Eq (HashMap k v) | Note that, in the presence of hash collisions, equal
In general, the lack of substitutivity can be observed with any function that depends on the key ordering, such as folds and traversals. |
Eq (f p) => Eq (Rec1 f p) | Since: base-4.7.0.0 |
Eq (URec (Ptr ()) p) | Since: base-4.9.0.0 |
Eq (URec Char p) | Since: base-4.9.0.0 |
Eq (URec Double p) | Since: base-4.9.0.0 |
Eq (URec Float p) | |
Eq (URec Int p) | Since: base-4.9.0.0 |
Eq (URec Word p) | Since: base-4.9.0.0 |
(Eq a, Eq b, Eq c) => Eq (a, b, c) | |
Eq (STArray s i e) | Since: base-2.1 |
Eq a => Eq (Const a b) | Since: base-4.9.0.0 |
Eq (f a) => Eq (Ap f a) | Since: base-4.12.0.0 |
Eq (f a) => Eq (Alt f a) | Since: base-4.8.0.0 |
Eq (a :~: b) | Since: base-4.7.0.0 |
(Eq1 f, Eq a) => Eq (IdentityT f a) | |
(Eq e, Eq1 m, Eq a) => Eq (ErrorT e m a) | |
(Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a) | |
Eq c => Eq (K1 i c p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :+: g) p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :*: g) p) | Since: base-4.7.0.0 |
(Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) | |
(Eq1 f, Eq1 g, Eq a) => Eq (Product f g a) | Since: base-4.9.0.0 |
(Eq1 f, Eq1 g, Eq a) => Eq (Sum f g a) | Since: base-4.9.0.0 |
Eq (a :~~: b) | Since: base-4.10.0.0 |
Eq (f p) => Eq (M1 i c f p) | Since: base-4.7.0.0 |
Eq (f (g p)) => Eq ((f :.: g) p) | Since: base-4.7.0.0 |
(Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) | |
(Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) | Since: base-4.9.0.0 |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) | |
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) | |
(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) | |
(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) | |
(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) | |
(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) | |
(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) | |
(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) | |
(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) | |
(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) | |
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.
The Haskell Report defines no laws for Ord
. However, <=
is customarily
expected to implement a non-strict partial order and have the following
properties:
- Transitivity
- if
x <= y && y <= z
=True
, thenx <= z
=True
- Reflexivity
x <= x
=True
- Antisymmetry
- if
x <= y && y <= x
=True
, thenx == y
=True
Note that 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 (==)
.
Minimal complete definition: either compare
or <=
.
Using compare
can be more efficient for complex types.
compare :: a -> a -> Ordering #
(<) :: a -> a -> Bool infix 4 #
(<=) :: a -> a -> Bool infix 4 #
(>) :: a -> a -> Bool infix 4 #
Instances
Ord Bool | |
Ord Char | |
Ord Double | Note that due to the presence of
Also note that, due to the same,
|
Ord Float | Note that due to the presence of
Also note that, due to the same,
|
Ord Int | |
Ord Int8 | Since: base-2.1 |
Ord Int16 | Since: base-2.1 |
Ord Int32 | Since: base-2.1 |
Ord Int64 | Since: base-2.1 |
Ord Integer | |
Ord Natural | Since: base-4.8.0.0 |
Ord Ordering | |
Defined in GHC.Classes | |
Ord Word | |
Ord Word8 | Since: base-2.1 |
Ord Word16 | Since: base-2.1 |
Ord Word32 | Since: base-2.1 |
Ord Word64 | Since: base-2.1 |
Ord SomeTypeRep | |
Defined in Data.Typeable.Internal compare :: SomeTypeRep -> SomeTypeRep -> Ordering # (<) :: SomeTypeRep -> SomeTypeRep -> Bool # (<=) :: SomeTypeRep -> SomeTypeRep -> Bool # (>) :: SomeTypeRep -> SomeTypeRep -> Bool # (>=) :: SomeTypeRep -> SomeTypeRep -> Bool # max :: SomeTypeRep -> SomeTypeRep -> SomeTypeRep # min :: SomeTypeRep -> SomeTypeRep -> SomeTypeRep # | |
Ord Exp | |
Ord Match | |
Ord Clause | |
Ord Pat | |
Ord Type | |
Ord Dec | |
Ord Name | |
Ord FunDep | |
Ord InjectivityAnn | |
Defined in Language.Haskell.TH.Syntax compare :: InjectivityAnn -> InjectivityAnn -> Ordering # (<) :: InjectivityAnn -> InjectivityAnn -> Bool # (<=) :: InjectivityAnn -> InjectivityAnn -> Bool # (>) :: InjectivityAnn -> InjectivityAnn -> Bool # (>=) :: InjectivityAnn -> InjectivityAnn -> Bool # max :: InjectivityAnn -> InjectivityAnn -> InjectivityAnn # min :: InjectivityAnn -> InjectivityAnn -> InjectivityAnn # | |
Ord Overlap | |
Ord () | |
Ord TyCon | |
Ord Void | Since: base-4.8.0.0 |
Ord Unique | |
Ord Version | Since: base-2.1 |
Ord ThreadId | Since: base-4.2.0.0 |
Defined in GHC.Conc.Sync | |
Ord BlockReason | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync compare :: BlockReason -> BlockReason -> Ordering # (<) :: BlockReason -> BlockReason -> Bool # (<=) :: BlockReason -> BlockReason -> Bool # (>) :: BlockReason -> BlockReason -> Bool # (>=) :: BlockReason -> BlockReason -> Bool # max :: BlockReason -> BlockReason -> BlockReason # min :: BlockReason -> BlockReason -> BlockReason # | |
Ord ThreadStatus | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync compare :: ThreadStatus -> ThreadStatus -> Ordering # (<) :: ThreadStatus -> ThreadStatus -> Bool # (<=) :: ThreadStatus -> ThreadStatus -> Bool # (>) :: ThreadStatus -> ThreadStatus -> Bool # (>=) :: ThreadStatus -> ThreadStatus -> Bool # max :: ThreadStatus -> ThreadStatus -> ThreadStatus # min :: ThreadStatus -> ThreadStatus -> ThreadStatus # | |
Ord AsyncException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception compare :: AsyncException -> AsyncException -> Ordering # (<) :: AsyncException -> AsyncException -> Bool # (<=) :: AsyncException -> AsyncException -> Bool # (>) :: AsyncException -> AsyncException -> Bool # (>=) :: AsyncException -> AsyncException -> Bool # max :: AsyncException -> AsyncException -> AsyncException # min :: AsyncException -> AsyncException -> AsyncException # | |
Ord ArrayException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception compare :: ArrayException -> ArrayException -> Ordering # (<) :: ArrayException -> ArrayException -> Bool # (<=) :: ArrayException -> ArrayException -> Bool # (>) :: ArrayException -> ArrayException -> Bool # (>=) :: ArrayException -> ArrayException -> Bool # max :: ArrayException -> ArrayException -> ArrayException # min :: ArrayException -> ArrayException -> ArrayException # | |
Ord ExitCode | |
Defined in GHC.IO.Exception | |
Ord BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types compare :: BufferMode -> BufferMode -> Ordering # (<) :: BufferMode -> BufferMode -> Bool # (<=) :: BufferMode -> BufferMode -> Bool # (>) :: BufferMode -> BufferMode -> Bool # (>=) :: BufferMode -> BufferMode -> Bool # max :: BufferMode -> BufferMode -> BufferMode # min :: BufferMode -> BufferMode -> BufferMode # | |
Ord Newline | Since: base-4.3.0.0 |
Ord NewlineMode | Since: base-4.3.0.0 |
Defined in GHC.IO.Handle.Types compare :: NewlineMode -> NewlineMode -> Ordering # (<) :: NewlineMode -> NewlineMode -> Bool # (<=) :: NewlineMode -> NewlineMode -> Bool # (>) :: NewlineMode -> NewlineMode -> Bool # (>=) :: NewlineMode -> NewlineMode -> Bool # max :: NewlineMode -> NewlineMode -> NewlineMode # min :: NewlineMode -> NewlineMode -> NewlineMode # | |
Ord ErrorCall | Since: base-4.7.0.0 |
Defined in GHC.Exception | |
Ord ArithException | Since: base-3.0 |
Defined in GHC.Exception.Type compare :: ArithException -> ArithException -> Ordering # (<) :: ArithException -> ArithException -> Bool # (<=) :: ArithException -> ArithException -> Bool # (>) :: ArithException -> ArithException -> Bool # (>=) :: ArithException -> ArithException -> Bool # max :: ArithException -> ArithException -> ArithException # min :: ArithException -> ArithException -> ArithException # | |
Ord All | Since: base-2.1 |
Ord Any | Since: base-2.1 |
Ord Fixity | Since: base-4.6.0.0 |
Ord Associativity | Since: base-4.6.0.0 |
Defined in GHC.Generics compare :: Associativity -> Associativity -> Ordering # (<) :: Associativity -> Associativity -> Bool # (<=) :: Associativity -> Associativity -> Bool # (>) :: Associativity -> Associativity -> Bool # (>=) :: Associativity -> Associativity -> Bool # max :: Associativity -> Associativity -> Associativity # min :: Associativity -> Associativity -> Associativity # | |
Ord SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: SourceUnpackedness -> SourceUnpackedness -> Ordering # (<) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (<=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (>) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (>=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # max :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness # min :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness # | |
Ord SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: SourceStrictness -> SourceStrictness -> Ordering # (<) :: SourceStrictness -> SourceStrictness -> Bool # (<=) :: SourceStrictness -> SourceStrictness -> Bool # (>) :: SourceStrictness -> SourceStrictness -> Bool # (>=) :: SourceStrictness -> SourceStrictness -> Bool # max :: SourceStrictness -> SourceStrictness -> SourceStrictness # min :: SourceStrictness -> SourceStrictness -> SourceStrictness # | |
Ord DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: DecidedStrictness -> DecidedStrictness -> Ordering # (<) :: DecidedStrictness -> DecidedStrictness -> Bool # (<=) :: DecidedStrictness -> DecidedStrictness -> Bool # (>) :: DecidedStrictness -> DecidedStrictness -> Bool # (>=) :: DecidedStrictness -> DecidedStrictness -> Bool # max :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness # min :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness # | |
Ord SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits compare :: SomeSymbol -> SomeSymbol -> Ordering # (<) :: SomeSymbol -> SomeSymbol -> Bool # (<=) :: SomeSymbol -> SomeSymbol -> Bool # (>) :: SomeSymbol -> SomeSymbol -> Bool # (>=) :: SomeSymbol -> SomeSymbol -> Bool # max :: SomeSymbol -> SomeSymbol -> SomeSymbol # min :: SomeSymbol -> SomeSymbol -> SomeSymbol # | |
Ord SomeNat | Since: base-4.7.0.0 |
Ord CChar | |
Ord CSChar | |
Ord CUChar | |
Ord CShort | |
Ord CUShort | |
Ord CInt | |
Ord CUInt | |
Ord CLong | |
Ord CULong | |
Ord CLLong | |
Ord CULLong | |
Ord CBool | |
Ord CFloat | |
Ord CDouble | |
Ord CPtrdiff | |
Defined in Foreign.C.Types | |
Ord CSize | |
Ord CWchar | |
Ord CSigAtomic | |
Defined in Foreign.C.Types compare :: CSigAtomic -> CSigAtomic -> Ordering # (<) :: CSigAtomic -> CSigAtomic -> Bool # (<=) :: CSigAtomic -> CSigAtomic -> Bool # (>) :: CSigAtomic -> CSigAtomic -> Bool # (>=) :: CSigAtomic -> CSigAtomic -> Bool # max :: CSigAtomic -> CSigAtomic -> CSigAtomic # min :: CSigAtomic -> CSigAtomic -> CSigAtomic # | |
Ord CClock | |
Ord CTime | |
Ord CUSeconds | |
Defined in Foreign.C.Types | |
Ord CSUSeconds | |
Defined in Foreign.C.Types compare :: CSUSeconds -> CSUSeconds -> Ordering # (<) :: CSUSeconds -> CSUSeconds -> Bool # (<=) :: CSUSeconds -> CSUSeconds -> Bool # (>) :: CSUSeconds -> CSUSeconds -> Bool # (>=) :: CSUSeconds -> CSUSeconds -> Bool # max :: CSUSeconds -> CSUSeconds -> CSUSeconds # min :: CSUSeconds -> CSUSeconds -> CSUSeconds # | |
Ord CIntPtr | |
Ord CUIntPtr | |
Defined in Foreign.C.Types | |
Ord CIntMax | |
Ord CUIntMax | |
Defined in Foreign.C.Types | |
Ord WordPtr | |
Ord IntPtr | |
Ord IOMode | Since: base-4.2.0.0 |
Ord Fingerprint | Since: base-4.4.0.0 |
Defined in GHC.Fingerprint.Type compare :: Fingerprint -> Fingerprint -> Ordering # (<) :: Fingerprint -> Fingerprint -> Bool # (<=) :: Fingerprint -> Fingerprint -> Bool # (>) :: Fingerprint -> Fingerprint -> Bool # (>=) :: Fingerprint -> Fingerprint -> Bool # max :: Fingerprint -> Fingerprint -> Fingerprint # min :: Fingerprint -> Fingerprint -> Fingerprint # | |
Ord ShortByteString | |
Defined in Data.ByteString.Short.Internal compare :: ShortByteString -> ShortByteString -> Ordering # (<) :: ShortByteString -> ShortByteString -> Bool # (<=) :: ShortByteString -> ShortByteString -> Bool # (>) :: ShortByteString -> ShortByteString -> Bool # (>=) :: ShortByteString -> ShortByteString -> Bool # max :: ShortByteString -> ShortByteString -> ShortByteString # min :: ShortByteString -> ShortByteString -> ShortByteString # | |
Ord ByteString | |
Defined in Data.ByteString.Lazy.Internal compare :: ByteString -> ByteString -> Ordering # (<) :: ByteString -> ByteString -> Bool # (<=) :: ByteString -> ByteString -> Bool # (>) :: ByteString -> ByteString -> Bool # (>=) :: ByteString -> ByteString -> Bool # max :: ByteString -> ByteString -> ByteString # min :: ByteString -> ByteString -> ByteString # | |
Ord ByteString | |
Defined in Data.ByteString.Internal compare :: ByteString -> ByteString -> Ordering # (<) :: ByteString -> ByteString -> Bool # (<=) :: ByteString -> ByteString -> Bool # (>) :: ByteString -> ByteString -> Bool # (>=) :: ByteString -> ByteString -> Bool # max :: ByteString -> ByteString -> ByteString # min :: ByteString -> ByteString -> ByteString # | |
Ord IntSet | |
Ord BigNat | |
Ord ModName | |
Ord PkgName | |
Ord Module | |
Ord OccName | |
Ord NameFlavour | |
Defined in Language.Haskell.TH.Syntax compare :: NameFlavour -> NameFlavour -> Ordering # (<) :: NameFlavour -> NameFlavour -> Bool # (<=) :: NameFlavour -> NameFlavour -> Bool # (>) :: NameFlavour -> NameFlavour -> Bool # (>=) :: NameFlavour -> NameFlavour -> Bool # max :: NameFlavour -> NameFlavour -> NameFlavour # min :: NameFlavour -> NameFlavour -> NameFlavour # | |
Ord NameSpace | |
Defined in Language.Haskell.TH.Syntax | |
Ord Loc | |
Ord Info | |
Ord ModuleInfo | |
Defined in Language.Haskell.TH.Syntax compare :: ModuleInfo -> ModuleInfo -> Ordering # (<) :: ModuleInfo -> ModuleInfo -> Bool # (<=) :: ModuleInfo -> ModuleInfo -> Bool # (>) :: ModuleInfo -> ModuleInfo -> Bool # (>=) :: ModuleInfo -> ModuleInfo -> Bool # max :: ModuleInfo -> ModuleInfo -> ModuleInfo # min :: ModuleInfo -> ModuleInfo -> ModuleInfo # | |
Ord Fixity | |
Ord FixityDirection | |
Defined in Language.Haskell.TH.Syntax compare :: FixityDirection -> FixityDirection -> Ordering # (<) :: FixityDirection -> FixityDirection -> Bool # (<=) :: FixityDirection -> FixityDirection -> Bool # (>) :: FixityDirection -> FixityDirection -> Bool # (>=) :: FixityDirection -> FixityDirection -> Bool # max :: FixityDirection -> FixityDirection -> FixityDirection # min :: FixityDirection -> FixityDirection -> FixityDirection # | |
Ord Lit | |
Ord Bytes | |
Ord Body | |
Ord Guard | |
Ord Stmt | |
Ord Range | |
Ord DerivClause | |
Defined in Language.Haskell.TH.Syntax compare :: DerivClause -> DerivClause -> Ordering # (<) :: DerivClause -> DerivClause -> Bool # (<=) :: DerivClause -> DerivClause -> Bool # (>) :: DerivClause -> DerivClause -> Bool # (>=) :: DerivClause -> DerivClause -> Bool # max :: DerivClause -> DerivClause -> DerivClause # min :: DerivClause -> DerivClause -> DerivClause # | |
Ord DerivStrategy | |
Defined in Language.Haskell.TH.Syntax compare :: DerivStrategy -> DerivStrategy -> Ordering # (<) :: DerivStrategy -> DerivStrategy -> Bool # (<=) :: DerivStrategy -> DerivStrategy -> Bool # (>) :: DerivStrategy -> DerivStrategy -> Bool # (>=) :: DerivStrategy -> DerivStrategy -> Bool # max :: DerivStrategy -> DerivStrategy -> DerivStrategy # min :: DerivStrategy -> DerivStrategy -> DerivStrategy # | |
Ord TypeFamilyHead | |
Defined in Language.Haskell.TH.Syntax compare :: TypeFamilyHead -> TypeFamilyHead -> Ordering # (<) :: TypeFamilyHead -> TypeFamilyHead -> Bool # (<=) :: TypeFamilyHead -> TypeFamilyHead -> Bool # (>) :: TypeFamilyHead -> TypeFamilyHead -> Bool # (>=) :: TypeFamilyHead -> TypeFamilyHead -> Bool # max :: TypeFamilyHead -> TypeFamilyHead -> TypeFamilyHead # min :: TypeFamilyHead -> TypeFamilyHead -> TypeFamilyHead # | |
Ord TySynEqn | |
Defined in Language.Haskell.TH.Syntax | |
Ord Foreign | |
Ord Callconv | |
Defined in Language.Haskell.TH.Syntax | |
Ord Safety | |
Ord Pragma | |
Ord Inline | |
Ord RuleMatch | |
Defined in Language.Haskell.TH.Syntax | |
Ord Phases | |
Ord RuleBndr | |
Defined in Language.Haskell.TH.Syntax | |
Ord AnnTarget | |
Defined in Language.Haskell.TH.Syntax | |
Ord SourceUnpackedness | |
Defined in Language.Haskell.TH.Syntax compare :: SourceUnpackedness -> SourceUnpackedness -> Ordering # (<) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (<=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (>) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (>=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # max :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness # min :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness # | |
Ord SourceStrictness | |
Defined in Language.Haskell.TH.Syntax compare :: SourceStrictness -> SourceStrictness -> Ordering # (<) :: SourceStrictness -> SourceStrictness -> Bool # (<=) :: SourceStrictness -> SourceStrictness -> Bool # (>) :: SourceStrictness -> SourceStrictness -> Bool # (>=) :: SourceStrictness -> SourceStrictness -> Bool # max :: SourceStrictness -> SourceStrictness -> SourceStrictness # min :: SourceStrictness -> SourceStrictness -> SourceStrictness # | |
Ord DecidedStrictness | |
Defined in Language.Haskell.TH.Syntax compare :: DecidedStrictness -> DecidedStrictness -> Ordering # (<) :: DecidedStrictness -> DecidedStrictness -> Bool # (<=) :: DecidedStrictness -> DecidedStrictness -> Bool # (>) :: DecidedStrictness -> DecidedStrictness -> Bool # (>=) :: DecidedStrictness -> DecidedStrictness -> Bool # max :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness # min :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness # | |
Ord Con | |
Ord Bang | |
Ord PatSynDir | |
Defined in Language.Haskell.TH.Syntax | |
Ord PatSynArgs | |
Defined in Language.Haskell.TH.Syntax compare :: PatSynArgs -> PatSynArgs -> Ordering # (<) :: PatSynArgs -> PatSynArgs -> Bool # (<=) :: PatSynArgs -> PatSynArgs -> Bool # (>) :: PatSynArgs -> PatSynArgs -> Bool # (>=) :: PatSynArgs -> PatSynArgs -> Bool # max :: PatSynArgs -> PatSynArgs -> PatSynArgs # min :: PatSynArgs -> PatSynArgs -> PatSynArgs # | |
Ord TyVarBndr | |
Defined in Language.Haskell.TH.Syntax | |
Ord FamilyResultSig | |
Defined in Language.Haskell.TH.Syntax compare :: FamilyResultSig -> FamilyResultSig -> Ordering # (<) :: FamilyResultSig -> FamilyResultSig -> Bool # (<=) :: FamilyResultSig -> FamilyResultSig -> Bool # (>) :: FamilyResultSig -> FamilyResultSig -> Bool # (>=) :: FamilyResultSig -> FamilyResultSig -> Bool # max :: FamilyResultSig -> FamilyResultSig -> FamilyResultSig # min :: FamilyResultSig -> FamilyResultSig -> FamilyResultSig # | |
Ord TyLit | |
Ord Role | |
Ord AnnLookup | |
Defined in Language.Haskell.TH.Syntax | |
Ord Undefined Source # | |
Defined in Relude.Debug | |
Ord a => Ord [a] | |
Ord a => Ord (Maybe a) | Since: base-2.1 |
Integral a => Ord (Ratio a) | Since: base-2.0.1 |
Ord (Ptr a) | Since: base-2.1 |
Ord (FunPtr a) | |
Ord p => Ord (Par1 p) | Since: base-4.7.0.0 |
Ord a => Ord (Min a) | Since: base-4.9.0.0 |
Ord a => Ord (Max a) | Since: base-4.9.0.0 |
Ord a => Ord (First a) | Since: base-4.9.0.0 |
Ord a => Ord (Last a) | Since: base-4.9.0.0 |
Ord m => Ord (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup compare :: WrappedMonoid m -> WrappedMonoid m -> Ordering # (<) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (<=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (>) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (>=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # max :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # min :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # | |
Ord a => Ord (Option a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup | |
Ord a => Ord (ZipList a) | Since: base-4.7.0.0 |
Defined in Control.Applicative | |
Ord a => Ord (Identity a) | Since: base-4.8.0.0 |
Ord a => Ord (First a) | Since: base-2.1 |
Ord a => Ord (Last a) | Since: base-2.1 |
Ord a => Ord (Dual a) | Since: base-2.1 |
Ord a => Ord (Sum a) | Since: base-2.1 |
Ord a => Ord (Product a) | Since: base-2.1 |
Defined in Data.Semigroup.Internal | |
Ord a => Ord (Down a) | Since: base-4.6.0.0 |
Ord a => Ord (NonEmpty a) | Since: base-4.9.0.0 |
Ord a => Ord (IntMap a) | |
Defined in Data.IntMap.Internal | |
Ord a => Ord (Seq a) | |
Ord a => Ord (ViewL a) | |
Ord a => Ord (ViewR a) | |
Ord a => Ord (Set a) | |
Ord a => Ord (Hashed a) | |
Defined in Data.Hashable.Class | |
Ord a => Ord (HashSet a) | |
Defined in Data.HashSet.Internal | |
(Ord a, Ord b) => Ord (Either a b) | Since: base-2.1 |
Ord (V1 p) | Since: base-4.9.0.0 |
Ord (U1 p) | Since: base-4.7.0.0 |
Ord (TypeRep a) | Since: base-4.4.0.0 |
Defined in Data.Typeable.Internal | |
(Ord a, Ord b) => Ord (a, b) | |
(Ix i, Ord e) => Ord (Array i e) | Since: base-2.1 |
Defined in GHC.Arr | |
Ord (Fixed a) | Since: base-2.1 |
Ord a => Ord (Arg a b) | Since: base-4.9.0.0 |
Ord (Proxy s) | Since: base-4.7.0.0 |
(Ord k, Ord v) => Ord (Map k v) | |
(Ord1 m, Ord a) => Ord (MaybeT m a) | |
(Ord k, Ord v) => Ord (HashMap k v) | The ordering is total and consistent with the |
Defined in Data.HashMap.Internal | |
Ord (f p) => Ord (Rec1 f p) | Since: base-4.7.0.0 |
Defined in GHC.Generics | |
Ord (URec (Ptr ()) p) | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering # (<) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (<=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (>) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (>=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # max :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p # min :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p # | |
Ord (URec Char p) | Since: base-4.9.0.0 |
Ord (URec Double p) | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: URec Double p -> URec Double p -> Ordering # (<) :: URec Double p -> URec Double p -> Bool # (<=) :: URec Double p -> URec Double p -> Bool # (>) :: URec Double p -> URec Double p -> Bool # (>=) :: URec Double p -> URec Double p -> Bool # | |
Ord (URec Float p) | |
Defined in GHC.Generics | |
Ord (URec Int p) | Since: base-4.9.0.0 |
Ord (URec Word p) | Since: base-4.9.0.0 |
(Ord a, Ord b, Ord c) => Ord (a, b, c) | |
Defined in GHC.Classes | |
Ord a => Ord (Const a b) | Since: base-4.9.0.0 |
Defined in Data.Functor.Const | |
Ord (f a) => Ord (Ap f a) | Since: base-4.12.0.0 |
Ord (f a) => Ord (Alt f a) | Since: base-4.8.0.0 |
Ord (a :~: b) | Since: base-4.7.0.0 |
Defined in Data.Type.Equality | |
(Ord1 f, Ord a) => Ord (IdentityT f a) | |
Defined in Control.Monad.Trans.Identity compare :: IdentityT f a -> IdentityT f a -> Ordering # (<) :: IdentityT f a -> IdentityT f a -> Bool # (<=) :: IdentityT f a -> IdentityT f a -> Bool # (>) :: IdentityT f a -> IdentityT f a -> Bool # (>=) :: IdentityT f a -> IdentityT f a -> Bool # | |
(Ord e, Ord1 m, Ord a) => Ord (ErrorT e m a) | |
Defined in Control.Monad.Trans.Error | |
(Ord e, Ord1 m, Ord a) => Ord (ExceptT e m a) | |
Defined in Control.Monad.Trans.Except compare :: ExceptT e m a -> ExceptT e m a -> Ordering # (<) :: ExceptT e m a -> ExceptT e m a -> Bool # (<=) :: ExceptT e m a -> ExceptT e m a -> Bool # (>) :: ExceptT e m a -> ExceptT e m a -> Bool # (>=) :: ExceptT e m a -> ExceptT e m a -> Bool # | |
Ord c => Ord (K1 i c p) | Since: base-4.7.0.0 |
Defined in GHC.Generics | |
(Ord (f p), Ord (g p)) => Ord ((f :+: g) p) | Since: base-4.7.0.0 |
(Ord (f p), Ord (g p)) => Ord ((f :*: g) p) | Since: base-4.7.0.0 |
(Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d) | |
Defined in GHC.Classes | |
(Ord1 f, Ord1 g, Ord a) => Ord (Product f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Product compare :: Product f g a -> Product f g a -> Ordering # (<) :: Product f g a -> Product f g a -> Bool # (<=) :: Product f g a -> Product f g a -> Bool # (>) :: Product f g a -> Product f g a -> Bool # (>=) :: Product f g a -> Product f g a -> Bool # | |
(Ord1 f, Ord1 g, Ord a) => Ord (Sum f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum | |
Ord (a :~~: b) | Since: base-4.10.0.0 |
Ord (f p) => Ord (M1 i c f p) | Since: base-4.7.0.0 |
Ord (f (g p)) => Ord ((f :.: g) p) | Since: base-4.7.0.0 |
(Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e) | |
Defined in GHC.Classes compare :: (a, b, c, d, e) -> (a, b, c, d, e) -> Ordering # (<) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (<=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (>) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (>=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # max :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) # min :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) # | |
(Ord1 f, Ord1 g, Ord a) => Ord (Compose f g a) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose compare :: Compose f g a -> Compose f g a -> Ordering # (<) :: Compose f g a -> Compose f g a -> Bool # (<=) :: Compose f g a -> Compose f g a -> Bool # (>) :: Compose f g a -> Compose f g a -> Bool # (>=) :: Compose f g a -> Compose f g a -> Bool # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Ordering # (<) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (<=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (>) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (>=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # max :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) # min :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Ordering # (<) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (<=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (>) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (>=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # max :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) # min :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => Ord (a, b, c, d, e, f, g, h) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Ordering # (<) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (<=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (>) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (>=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # max :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) # min :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => Ord (a, b, c, d, e, f, g, h, i) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # max :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) # min :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j) => Ord (a, b, c, d, e, f, g, h, i, j) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) # min :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k) => Ord (a, b, c, d, e, f, g, h, i, j, k) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) # min :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l) => Ord (a, b, c, d, e, f, g, h, i, j, k, l) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) # min :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) # min :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # min :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # | |
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) | |
Defined in GHC.Classes compare :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool # max :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # min :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # |
Instances
Bounded Ordering | Since: base-2.1 |
Enum Ordering | Since: base-2.1 |
Eq Ordering | |
Data Ordering | Since: base-4.0.0.0 |
Defined in Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ordering -> c Ordering # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Ordering # toConstr :: Ordering -> Constr # dataTypeOf :: Ordering -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Ordering) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ordering) # gmapT :: (forall b. Data b => b -> b) -> Ordering -> Ordering # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ordering -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ordering -> r # gmapQ :: (forall d. Data d => d -> u) -> Ordering -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Ordering -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering # | |
Ord Ordering | |
Defined in GHC.Classes | |
Read Ordering | Since: base-2.1 |
Show Ordering | Since: base-2.1 |
Ix Ordering | Since: base-2.1 |
Defined in GHC.Ix | |
Generic Ordering | Since: base-4.6.0.0 |
Semigroup Ordering | Since: base-4.9.0.0 |
Monoid Ordering | Since: base-2.1 |
NFData Ordering | |
Defined in Control.DeepSeq | |
Hashable Ordering | |
Defined in Data.Hashable.Class | |
type Rep Ordering | |
comparing :: Ord a => (b -> a) -> b -> b -> Ordering #
comparing p x y = compare (p x) (p y)
Useful combinator for use in conjunction with the xxxBy
family
of functions from Data.List, for example:
... sortBy (comparing fst) ...
The Down
type allows you to reverse sort order conveniently. A value of type
contains a value of type Down
aa
(represented as
).
If Down
aa
has an
instance associated with it then comparing two
values thus wrapped will give you the opposite of their normal sort order.
This is particularly useful when sorting in generalised list comprehensions,
as in: Ord
then sortWith by
Down
x
Since: base-4.6.0.0
Instances
Monad Down | Since: base-4.11.0.0 |
Functor Down | Since: base-4.11.0.0 |
Applicative Down | Since: base-4.11.0.0 |
Foldable Down | Since: base-4.12.0.0 |
Defined in Data.Foldable fold :: Monoid m => Down m -> m # foldMap :: Monoid m => (a -> m) -> Down a -> m # foldMap' :: Monoid m => (a -> m) -> Down a -> m # foldr :: (a -> b -> b) -> b -> Down a -> b # foldr' :: (a -> b -> b) -> b -> Down a -> b # foldl :: (b -> a -> b) -> b -> Down a -> b # foldl' :: (b -> a -> b) -> b -> Down a -> b # foldr1 :: (a -> a -> a) -> Down a -> a # foldl1 :: (a -> a -> a) -> Down a -> a # elem :: Eq a => a -> Down a -> Bool # maximum :: Ord a => Down a -> a # | |
Traversable Down | Since: base-4.12.0.0 |
Eq1 Down | Since: base-4.12.0.0 |
Ord1 Down | Since: base-4.12.0.0 |
Defined in Data.Functor.Classes | |
Read1 Down | Since: base-4.12.0.0 |
Defined in Data.Functor.Classes | |
Show1 Down | Since: base-4.12.0.0 |
NFData1 Down | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
Bounded a => Bounded (Down a) | Since: base-4.14.0.0 |
Enum a => Enum (Down a) | Since: base-4.14.0.0 |
Defined in Data.Ord | |
Eq a => Eq (Down a) | Since: base-4.6.0.0 |
Floating a => Floating (Down a) | Since: base-4.14.0.0 |
Fractional a => Fractional (Down a) | Since: base-4.14.0.0 |
Integral a => Integral (Down a) | Since: base-4.14.0.0 |
Data a => Data (Down a) | Since: base-4.12.0.0 |
Defined in Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Down a -> c (Down a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Down a) # toConstr :: Down a -> Constr # dataTypeOf :: Down a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Down a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Down a)) # gmapT :: (forall b. Data b => b -> b) -> Down a -> Down a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Down a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Down a -> r # gmapQ :: (forall d. Data d => d -> u) -> Down a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Down a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Down a -> m (Down a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Down a -> m (Down a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Down a -> m (Down a) # | |
Num a => Num (Down a) | Since: base-4.11.0.0 |
Ord a => Ord (Down a) | Since: base-4.6.0.0 |
Read a => Read (Down a) | This instance would be equivalent to the derived instances of the
Since: base-4.7.0.0 |
Real a => Real (Down a) | Since: base-4.14.0.0 |
Defined in Data.Ord toRational :: Down a -> Rational # | |
RealFloat a => RealFloat (Down a) | Since: base-4.14.0.0 |
Defined in Data.Ord floatRadix :: Down a -> Integer # floatDigits :: Down a -> Int # floatRange :: Down a -> (Int, Int) # decodeFloat :: Down a -> (Integer, Int) # encodeFloat :: Integer -> Int -> Down a # significand :: Down a -> Down a # scaleFloat :: Int -> Down a -> Down a # isInfinite :: Down a -> Bool # isDenormalized :: Down a -> Bool # isNegativeZero :: Down a -> Bool # | |
RealFrac a => RealFrac (Down a) | Since: base-4.14.0.0 |
Show a => Show (Down a) | This instance would be equivalent to the derived instances of the
Since: base-4.7.0.0 |
Ix a => Ix (Down a) | Since: base-4.14.0.0 |
Generic (Down a) | Since: base-4.12.0.0 |
Semigroup a => Semigroup (Down a) | Since: base-4.11.0.0 |
Monoid a => Monoid (Down a) | Since: base-4.11.0.0 |
Storable a => Storable (Down a) | Since: base-4.14.0.0 |
Bits a => Bits (Down a) | Since: base-4.14.0.0 |
Defined in Data.Ord (.&.) :: Down a -> Down a -> Down a # (.|.) :: Down a -> Down a -> Down a # xor :: Down a -> Down a -> Down a # complement :: Down a -> Down a # shift :: Down a -> Int -> Down a # rotate :: Down a -> Int -> Down a # setBit :: Down a -> Int -> Down a # clearBit :: Down a -> Int -> Down a # complementBit :: Down a -> Int -> Down a # testBit :: Down a -> Int -> Bool # bitSizeMaybe :: Down a -> Maybe Int # shiftL :: Down a -> Int -> Down a # unsafeShiftL :: Down a -> Int -> Down a # shiftR :: Down a -> Int -> Down a # unsafeShiftR :: Down a -> Int -> Down a # rotateL :: Down a -> Int -> Down a # | |
FiniteBits a => FiniteBits (Down a) | Since: base-4.14.0.0 |
Defined in Data.Ord finiteBitSize :: Down a -> Int # countLeadingZeros :: Down a -> Int # countTrailingZeros :: Down a -> Int # | |
NFData a => NFData (Down a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
Generic1 Down | Since: base-4.12.0.0 |
type Rep (Down a) | |
Defined in GHC.Generics | |
type Rep1 Down | |
Defined in GHC.Generics |
System IO
A value of type
is a computation which, when performed,
does some I/O before returning a value of type IO
aa
.
There is really only one way to "perform" an I/O action: bind it to
Main.main
in your program. When your program is run, the I/O will
be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the IO
monad and called
at some point, directly or indirectly, from Main.main
.
IO
is a monad, so IO
actions can be combined using either the do-notation
or the >>
and >>=
operations from the Monad
class.
Instances
File and directory names are values of type String
, whose precise
meaning is operating system dependent. Files can be opened, yielding a
handle which can then be used to operate on the contents of that file.
See openFile
Types for type-level computation
coerce :: forall (k :: RuntimeRep) (a :: TYPE k) (b :: TYPE k). Coercible a b => a -> b #
The function coerce
allows you to safely convert between values of
types that have the same representation with no run-time overhead. In the
simplest case you can use it instead of a newtype constructor, to go from
the newtype's concrete type to the abstract type. But it also works in
more complicated settings, e.g. converting a list of newtypes to a list of
concrete types.
This function is runtime-representation polymorphic, but the
RuntimeRep
type argument is marked as Inferred
, meaning
that it is not available for visible type application. This means
the typechecker will accept coerce @Int @Age 42
.
class a ~R# b => Coercible (a :: k) (b :: k) #
Coercible
is a two-parameter class that has instances for types a
and b
if
the compiler can infer that they have the same representation. This class
does not have regular instances; instead they are created on-the-fly during
type-checking. Trying to manually declare an instance of Coercible
is an error.
Nevertheless one can pretend that the following three kinds of instances exist. First, as a trivial base-case:
instance Coercible a a
Furthermore, for every type constructor there is
an instance that allows to coerce under the type constructor. For
example, let D
be a prototypical type constructor (data
or
newtype
) with three type arguments, which have roles nominal
,
representational
resp. phantom
. Then there is an instance of
the form
instance Coercible b b' => Coercible (D a b c) (D a b' c')
Note that the nominal
type arguments are equal, the
representational
type arguments can differ, but need to have a
Coercible
instance themself, and the phantom
type arguments can be
changed arbitrarily.
The third kind of instance exists for every newtype NT = MkNT T
and
comes in two variants, namely
instance Coercible a T => Coercible a NT
instance Coercible T b => Coercible NT b
This instance is only usable if the constructor MkNT
is in scope.
If, as a library author of a type constructor like Set a
, you
want to prevent a user of your module to write
coerce :: Set T -> Set NT
,
you need to set the role of Set
's type parameter to nominal
,
by writing
type role Set nominal
For more details about this feature, please refer to Safe Coercions by Joachim Breitner, Richard A. Eisenberg, Simon Peyton Jones and Stephanie Weirich.
Since: ghc-prim-4.7.0.0
data Constraint #
The kind of constraints, like Show a
Proxy
is a type that holds no data, but has a phantom parameter of
arbitrary type (or even kind). Its use is to provide type information, even
though there is no value available of that type (or it may be too costly to
create one).
Historically,
is a safer alternative to the
Proxy
:: Proxy
a
idiom.undefined
:: a
>>>
Proxy :: Proxy (Void, Int -> Int)
Proxy
Proxy can even hold types of higher kinds,
>>>
Proxy :: Proxy Either
Proxy
>>>
Proxy :: Proxy Functor
Proxy
>>>
Proxy :: Proxy complicatedStructure
Proxy
Instances
Generic1 (Proxy :: k -> Type) | Since: base-4.6.0.0 |
Monad (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Functor (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Applicative (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Foldable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Defined in Data.Foldable fold :: Monoid m => Proxy m -> m # foldMap :: Monoid m => (a -> m) -> Proxy a -> m # foldMap' :: Monoid m => (a -> m) -> Proxy a -> m # foldr :: (a -> b -> b) -> b -> Proxy a -> b # foldr' :: (a -> b -> b) -> b -> Proxy a -> b # foldl :: (b -> a -> b) -> b -> Proxy a -> b # foldl' :: (b -> a -> b) -> b -> Proxy a -> b # foldr1 :: (a -> a -> a) -> Proxy a -> a # foldl1 :: (a -> a -> a) -> Proxy a -> a # elem :: Eq a => a -> Proxy a -> Bool # maximum :: Ord a => Proxy a -> a # minimum :: Ord a => Proxy a -> a # | |
Traversable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Contravariant (Proxy :: Type -> Type) | |
Eq1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Ord1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Read1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Show1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Alternative (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
MonadPlus (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
NFData1 (Proxy :: Type -> Type) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
Hashable1 (Proxy :: Type -> Type) | |
Defined in Data.Hashable.Class | |
Bounded (Proxy t) | Since: base-4.7.0.0 |
Enum (Proxy s) | Since: base-4.7.0.0 |
Eq (Proxy s) | Since: base-4.7.0.0 |
Data t => Data (Proxy t) | Since: base-4.7.0.0 |
Defined in Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Proxy t -> c (Proxy t) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Proxy t) # toConstr :: Proxy t -> Constr # dataTypeOf :: Proxy t -> DataType # dataCast1 :: Typeable t0 => (forall d. Data d => c (t0 d)) -> Maybe (c (Proxy t)) # dataCast2 :: Typeable t0 => (forall d e. (Data d, Data e) => c (t0 d e)) -> Maybe (c (Proxy t)) # gmapT :: (forall b. Data b => b -> b) -> Proxy t -> Proxy t # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Proxy t -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Proxy t -> r # gmapQ :: (forall d. Data d => d -> u) -> Proxy t -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Proxy t -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Proxy t -> m (Proxy t) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Proxy t -> m (Proxy t) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Proxy t -> m (Proxy t) # | |
Ord (Proxy s) | Since: base-4.7.0.0 |
Read (Proxy t) | Since: base-4.7.0.0 |
Show (Proxy s) | Since: base-4.7.0.0 |
Ix (Proxy s) | Since: base-4.7.0.0 |
Defined in Data.Proxy | |
Generic (Proxy t) | Since: base-4.6.0.0 |
Semigroup (Proxy s) | Since: base-4.9.0.0 |
Monoid (Proxy s) | Since: base-4.7.0.0 |
NFData (Proxy a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
Hashable (Proxy a) | |
Defined in Data.Hashable.Class | |
type Rep1 (Proxy :: k -> Type) | |
type Rep (Proxy t) | |
The class Typeable
allows a concrete representation of a type to
be calculated.
typeRep#
Since Void
values logically don't exist, this witnesses the
logical reasoning tool of "ex falso quodlibet".
>>>
let x :: Either Void Int; x = Right 5
>>>
:{
case x of Right r -> r Left l -> absurd l :} 5
Since: base-4.8.0.0
Uninhabited data type
Since: base-4.8.0.0
Instances
Eq Void | Since: base-4.8.0.0 |
Data Void | Since: base-4.8.0.0 |
Defined in Data.Void gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Void -> c Void # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Void # dataTypeOf :: Void -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Void) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Void) # gmapT :: (forall b. Data b => b -> b) -> Void -> Void # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Void -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Void -> r # gmapQ :: (forall d. Data d => d -> u) -> Void -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Void -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Void -> m Void # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Void -> m Void # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Void -> m Void # | |
Ord Void | Since: base-4.8.0.0 |
Read Void | Reading a Since: base-4.8.0.0 |
Show Void | Since: base-4.8.0.0 |
Ix Void | Since: base-4.8.0.0 |
Generic Void | Since: base-4.8.0.0 |
Semigroup Void | Since: base-4.9.0.0 |
Exception Void | Since: base-4.8.0.0 |
Defined in Data.Void toException :: Void -> SomeException # fromException :: SomeException -> Maybe Void # displayException :: Void -> String # | |
NFData Void | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
Hashable Void | |
Defined in Data.Hashable.Class | |
Lift Void | Since: template-haskell-2.15.0.0 |
type Rep Void | |
Basic type classes
seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b infixr 0 #
The value of seq a b
is bottom if a
is bottom, and
otherwise equal to b
. In other words, it evaluates the first
argument a
to weak head normal form (WHNF). seq
is usually
introduced to improve performance by avoiding unneeded laziness.
A note on evaluation order: the expression seq a b
does
not guarantee that a
will be evaluated before b
.
The only guarantee given by seq
is that the both a
and b
will be evaluated before seq
returns a value.
In particular, this means that b
may be evaluated before
a
. If you need to guarantee a specific order of evaluation,
you must use the function pseq
from the "parallel" package.
($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b infixr 0 #
Strict (call-by-value) application operator. It takes a function and an argument, evaluates the argument to weak head normal form (WHNF), then calls the function with that value.
Representable types of kind *
.
This class is derivable in GHC with the DeriveGeneric
flag on.
A Generic
instance must satisfy the following laws:
from
.to
≡id
to
.from
≡id
Instances
Conversion of values to readable String
s.
Derived instances of Show
have the following properties, which
are compatible with derived instances of Read
:
- The result of
show
is a syntactically correct Haskell expression containing only constants, given the fixity declarations in force at the point where the type is declared. It contains only the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used. - If the constructor is defined to be an infix operator, then
showsPrec
will produce infix applications of the constructor. - the representation will be enclosed in parentheses if the
precedence of the top-level constructor in
x
is less thand
(associativity is ignored). Thus, ifd
is0
then the result is never surrounded in parentheses; ifd
is11
it is always surrounded in parentheses, unless it is an atomic expression. - If the constructor is defined using record syntax, then
show
will produce the record-syntax form, with the fields given in the same order as the original declaration.
For example, given the declarations
infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a
the derived instance of Show
is equivalent to
instance (Show a) => Show (Tree a) where showsPrec d (Leaf m) = showParen (d > app_prec) $ showString "Leaf " . showsPrec (app_prec+1) m where app_prec = 10 showsPrec d (u :^: v) = showParen (d > up_prec) $ showsPrec (up_prec+1) u . showString " :^: " . showsPrec (up_prec+1) v where up_prec = 5
Note that right-associativity of :^:
is ignored. For example,
produces the stringshow
(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)"
.
Instances
GHC-specific functionality
This class gives the integer associated with a type-level natural. There are instances of the class for every concrete literal: 0, 1, 2, etc.
Since: base-4.7.0.0
natSing
(Kind) This is the kind of type-level natural numbers.
Instances
KnownNat n => HasResolution (n :: Nat) | For example, |
Defined in Data.Fixed resolution :: p n -> Integer # |
type family CmpNat (a :: Nat) (b :: Nat) :: Ordering where ... #
Comparison of type-level naturals, as a function.
Since: base-4.7.0.0
someNatVal :: Natural -> SomeNat #
Convert an integer into an unknown type-level natural.
Since: base-4.10.0.0
This type represents unknown type-level natural numbers.
Since: base-4.10.0.0
showStackTrace :: IO (Maybe String) #
Get a string representation of the current execution stack state.
getStackTrace :: IO (Maybe [Location]) #
Get a trace of the current execution stack state.
Returns Nothing
if stack trace support isn't available on host machine.
CallStack
s are a lightweight method of obtaining a
partial call-stack at any point in the program.
A function can request its call-site with the HasCallStack
constraint.
For example, we can define
putStrLnWithCallStack :: HasCallStack => String -> IO ()
as a variant of putStrLn
that will get its call-site and print it,
along with the string given as argument. We can access the
call-stack inside putStrLnWithCallStack
with callStack
.
putStrLnWithCallStack :: HasCallStack => String -> IO () putStrLnWithCallStack msg = do putStrLn msg putStrLn (prettyCallStack callStack)
Thus, if we call putStrLnWithCallStack
we will get a formatted call-stack
alongside our string.
>>>
putStrLnWithCallStack "hello"
hello CallStack (from HasCallStack): putStrLnWithCallStack, called at <interactive>:2:1 in interactive:Ghci1
GHC solves HasCallStack
constraints in three steps:
- If there is a
CallStack
in scope -- i.e. the enclosing function has aHasCallStack
constraint -- GHC will append the new call-site to the existingCallStack
. - If there is no
CallStack
in scope -- e.g. in the GHCi session above -- and the enclosing definition does not have an explicit type signature, GHC will infer aHasCallStack
constraint for the enclosing definition (subject to the monomorphism restriction). - If there is no
CallStack
in scope and the enclosing definition has an explicit type signature, GHC will solve theHasCallStack
constraint for the singletonCallStack
containing just the current call-site.
CallStack
s do not interact with the RTS and do not require compilation
with -prof
. On the other hand, as they are built up explicitly via the
HasCallStack
constraints, they will generally not contain as much
information as the simulated call-stacks maintained by the RTS.
A CallStack
is a [(String, SrcLoc)]
. The String
is the name of
function that was called, the SrcLoc
is the call-site. The list is
ordered with the most recently called function at the head.
NOTE: The intrepid user may notice that HasCallStack
is just an
alias for an implicit parameter ?callStack :: CallStack
. This is an
implementation detail and should not be considered part of the
CallStack
API, we may decide to change the implementation in the
future.
Since: base-4.8.1.0
withFrozenCallStack :: HasCallStack => (HasCallStack => a) -> a #
Perform some computation without adding new entries to the CallStack
.
Since: base-4.9.0.0
callStack :: HasCallStack => CallStack #
prettyCallStack :: CallStack -> String #
Pretty print a CallStack
.
Since: base-4.9.0.0
prettySrcLoc :: SrcLoc -> String #
Pretty print a SrcLoc
.
Since: base-4.9.0.0
currentCallStack :: IO [String] #
Returns a [String]
representing the current call stack. This
can be useful for debugging.
The implementation uses the call-stack simulation maintained by the
profiler, so it only works if the program was compiled with -prof
and contains suitable SCC annotations (e.g. by using -fprof-auto
).
Otherwise, the list returned is likely to be empty or
uninformative.
Since: base-4.5.0.0
getCallStack :: CallStack -> [([Char], SrcLoc)] #
Extract a list of call-sites from the CallStack
.
The list is ordered by most recent call.
Since: base-4.8.1.0
type HasCallStack = ?callStack :: CallStack #
Request a CallStack.
NOTE: The implicit parameter ?callStack :: CallStack
is an
implementation detail and should not be considered part of the
CallStack
API, we may decide to change the implementation in the
future.
Since: base-4.9.0.0