Copyright | (c) 2016 Stephen Diehl (c) 2016-2018 Serokell (c) 2018-2020 Kowainik |
---|---|
License | MIT |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Stability | Stable |
Portability | Portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Relude.Base
Description
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 a
- data IO a
- data Handle
- withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r
- stderr :: Handle
- stdin :: Handle
- stdout :: Handle
- type FilePath = String
- data IOMode
- coerce :: 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 :: a -> b -> b
- asTypeOf :: a -> a -> a
- ($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- ord :: Char -> Int
- class Bounded 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]
- boundedEnumFromThen :: (Enum a, Bounded a) => a -> a -> [a]
- boundedEnumFrom :: (Enum a, Bounded a) => a -> [a]
- 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 Methods 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 |
Lift Char | |
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 # | |
ConvertUtf8 String ShortByteString Source # | Since: 0.6.0.0 |
Defined in Relude.String.Conversion Methods encodeUtf8 :: String -> ShortByteString Source # decodeUtf8 :: ShortByteString -> String Source # decodeUtf8Strict :: ShortByteString -> Either UnicodeException String Source # | |
ConvertUtf8 String ByteString Source # | |
Defined in Relude.String.Conversion Methods encodeUtf8 :: String -> ByteString Source # decodeUtf8 :: ByteString -> String Source # decodeUtf8Strict :: ByteString -> Either UnicodeException String Source # | |
ConvertUtf8 String LByteString Source # | Converting |
Defined in Relude.String.Conversion Methods encodeUtf8 :: String -> LByteString Source # decodeUtf8 :: LByteString -> String Source # decodeUtf8Strict :: LByteString -> Either UnicodeException String Source # | |
Generic1 (URec Char :: k -> Type) | Since: base-4.9.0.0 |
Functor (URec Char :: Type -> Type) | Since: base-4.9.0.0 |
Foldable (URec Char :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable Methods fold :: Monoid m => URec Char m -> m # foldMap :: Monoid m => (a -> m) -> URec Char a -> m # foldMap' :: Monoid m => (a -> m) -> URec Char a -> m # foldr :: (a -> b -> b) -> b -> URec Char a -> b # foldr' :: (a -> b -> b) -> b -> URec Char a -> b # foldl :: (b -> a -> b) -> b -> URec Char a -> b # foldl' :: (b -> a -> b) -> b -> URec Char a -> b # foldr1 :: (a -> a -> a) -> URec Char a -> a # foldl1 :: (a -> a -> a) -> URec Char a -> a # toList :: URec Char a -> [a] # length :: URec Char a -> Int # elem :: Eq a => a -> URec Char a -> Bool # maximum :: Ord a => URec Char a -> a # minimum :: Ord a => URec Char a -> a # | |
Traversable (URec Char :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Traversable | |
Eq (URec Char p) | Since: base-4.9.0.0 |
Ord (URec Char p) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
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 | |
Eq Exp | |
Eq Match | |
Eq Clause | |
Eq Pat | |
Eq Type | |
Eq Dec | |
Eq Name | |
Eq FunDep | |
Eq InjectivityAnn | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: InjectivityAnn -> InjectivityAnn -> Bool # (/=) :: InjectivityAnn -> InjectivityAnn -> Bool # | |
Eq Overlap | |
Eq () | |
Eq TyCon | |
Eq Module | |
Eq TrName | |
Eq Handle | Since: base-4.1.0.0 |
Eq BigNat | |
Eq Void | Since: base-4.8.0.0 |
Eq SpecConstrAnnotation | Since: base-4.3.0.0 |
Defined in GHC.Exts Methods (==) :: 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 ThreadId | Since: base-4.2.0.0 |
Eq BlockReason | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync | |
Eq ThreadStatus | Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync | |
Eq AsyncException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception Methods (==) :: AsyncException -> AsyncException -> Bool # (/=) :: AsyncException -> AsyncException -> Bool # | |
Eq ArrayException | Since: base-4.2.0.0 |
Defined in GHC.IO.Exception Methods (==) :: ArrayException -> ArrayException -> Bool # (/=) :: ArrayException -> ArrayException -> Bool # | |
Eq ExitCode | |
Eq IOErrorType | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception | |
Eq BufferMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types | |
Eq Newline | Since: base-4.2.0.0 |
Eq NewlineMode | Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types | |
Eq MaskingState | Since: base-4.3.0.0 |
Defined in GHC.IO | |
Eq IOException | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception | |
Eq ErrorCall | Since: base-4.7.0.0 |
Eq ArithException | Since: base-3.0 |
Defined in GHC.Exception.Type Methods (==) :: 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 Methods (==) :: Associativity -> Associativity -> Bool # (/=) :: Associativity -> Associativity -> Bool # | |
Eq SourceUnpackedness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # | |
Eq SourceStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods (==) :: SourceStrictness -> SourceStrictness -> Bool # (/=) :: SourceStrictness -> SourceStrictness -> Bool # | |
Eq DecidedStrictness | Since: base-4.9.0.0 |
Defined in GHC.Generics Methods (==) :: DecidedStrictness -> DecidedStrictness -> Bool # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool # | |
Eq SomeSymbol | Since: base-4.7.0.0 |
Defined in GHC.TypeLits | |
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 | |
Eq CClock | |
Eq CTime | |
Eq CUSeconds | |
Eq CSUSeconds | |
Defined in Foreign.C.Types | |
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 | |
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 Methods (==) :: ShortByteString -> ShortByteString -> Bool # (/=) :: ShortByteString -> ShortByteString -> Bool # | |
Eq ByteString | |
Defined in Data.ByteString.Lazy.Internal | |
Eq ByteString | |
Defined in Data.ByteString.Internal | |
Eq IntSet | |
Eq Extension | |
Eq ForeignSrcLang | |
Defined in GHC.ForeignSrcLang.Type Methods (==) :: ForeignSrcLang -> ForeignSrcLang -> Bool # (/=) :: ForeignSrcLang -> ForeignSrcLang -> Bool # | |
Eq ModName | |
Eq PkgName | |
Eq Module | |
Eq OccName | |
Eq NameFlavour | |
Defined in Language.Haskell.TH.Syntax | |
Eq NameSpace | |
Eq Loc | |
Eq Info | |
Eq ModuleInfo | |
Defined in Language.Haskell.TH.Syntax | |
Eq Fixity | |
Eq FixityDirection | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: FixityDirection -> FixityDirection -> Bool # (/=) :: FixityDirection -> FixityDirection -> Bool # | |
Eq Lit | |
Eq Body | |
Eq Guard | |
Eq Stmt | |
Eq Range | |
Eq DerivClause | |
Defined in Language.Haskell.TH.Syntax | |
Eq DerivStrategy | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: DerivStrategy -> DerivStrategy -> Bool # (/=) :: DerivStrategy -> DerivStrategy -> Bool # | |
Eq TypeFamilyHead | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: 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 Methods (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # | |
Eq SourceStrictness | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: SourceStrictness -> SourceStrictness -> Bool # (/=) :: SourceStrictness -> SourceStrictness -> Bool # | |
Eq DecidedStrictness | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: DecidedStrictness -> DecidedStrictness -> Bool # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool # | |
Eq Con | |
Eq Bang | |
Eq PatSynDir | |
Eq PatSynArgs | |
Defined in Language.Haskell.TH.Syntax | |
Eq TyVarBndr | |
Eq FamilyResultSig | |
Defined in Language.Haskell.TH.Syntax Methods (==) :: FamilyResultSig -> FamilyResultSig -> Bool # (/=) :: FamilyResultSig -> FamilyResultSig -> Bool # | |
Eq TyLit | |
Eq Role | |
Eq AnnLookup | |
Eq UnicodeException | |
Defined in Data.Text.Encoding.Error Methods (==) :: 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 (Fixed 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 Methods (==) :: 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 | |
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 a => Eq (HashSet a) | |
Eq (TMVar a) | |
(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 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) | |
(Eq k, Eq v) => Eq (Leaf k v) | |
(Eq k, Eq v) => Eq (HashMap k v) | |
(Eq1 m, Eq a) => Eq (MaybeT m a) | |
(Eq e, Eq a) => Eq (Validation e a) Source # | |
Defined in Relude.Extra.Validation Methods (==) :: Validation e a -> Validation e a -> Bool # (/=) :: Validation e a -> Validation e a -> Bool # | |
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
Minimal complete definition: either compare
or <=
.
Using compare
can be more efficient for complex types.
Methods
compare :: a -> a -> Ordering #
(<) :: a -> a -> Bool infix 4 #
(<=) :: a -> a -> Bool infix 4 #
(>) :: a -> a -> Bool infix 4 #