HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulebase-prelude-1.6.1.1Haskell2010

BasePrelude.DataTypes

A module that reexports only the data types defined across various modules of the "base" package.

By data types we mean that it is the ones we use to define data structures. It is not abstraction integration wrappers, like First. It is not resource types like System.IO.Handle.

  • 22 types

From Prelude

8 declarations
datadata Bool
#
Instances18Bounded, Enum, Eq, Data, Ord, Read, …
  • Bounded BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Enum
  • Enum BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Enum
  • Eq BoolDefined in ghc-prim-0.12.0 · GHC.Classes
  • Data BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Ord BoolDefined in ghc-prim-0.12.0 · GHC.Classes
  • Read BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Read
  • Show BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Show
  • Ix BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Ix
  • Generic BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Bits BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Bits

    Interpret Bool as 1-bit bit-field

  • FiniteBits BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Bits
  • Storable BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • SingKind BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • SingI 'FalseDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • SingI 'TrueDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • type Rep Bool = D1 ('MetaData "Bool" "GHC.Types" "ghc-prim" 'False) (C1 ('MetaCons "False" 'PrefixI 'False) U1 :+: C1 ('MetaCons "True" 'PrefixI 'False) U1)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • type DemoteRep Bool = BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • data Sing
    • STrue :: R:SingBoola 'True
    • SFalse :: R:SingBoola 'False
    Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
datadata Char
#

The character type Char represents Unicode codespace and its elements are code points as in definitions D9 and D10 of the Unicode Standard.

Character literals in Haskell are single-quoted: 'Q', 'Я' or 'Ω'. To represent a single quote itself use '\'', and to represent a backslash use '\\'. The full grammar can be found in the section 2.6 of the Haskell 2010 Language Report.

To specify a character by its code point one can use decimal, hexadecimal or octal notation: '\65', '\x41' and '\o101' are all alternative forms of 'A'. The largest code point is '\x10ffff'.

There is a special escape syntax for ASCII control characters:

Escape

Alternatives

Meaning

'\NUL'

'\0'

null character

'\SOH'

'\1'

start of heading

'\STX'

'\2'

start of text

'\ETX'

'\3'

end of text

'\EOT'

'\4'

end of transmission

'\ENQ'

'\5'

enquiry

'\ACK'

'\6'

acknowledge

'\BEL'

'\7'

,

'\a'

bell (alert)

'\BS'

'\8'

,

'\b'

backspace

'\HT'

'\9'

,

'\t'

horizontal tab

'\LF'

'\10'

,

'\n'

line feed (new line)

'\VT'

'\11'

,

'\v'

vertical tab

'\FF'

'\12'

,

'\f'

form feed

'\CR'

'\13'

,

'\r'

carriage return

'\SO'

'\14'

shift out

'\SI'

'\15'

shift in

'\DLE'

'\16'

data link escape

'\DC1'

'\17'

device control 1

'\DC2'

'\18'

device control 2

'\DC3'

'\19'

device control 3

'\DC4'

'\20'

device control 4

'\NAK'

'\21'

negative acknowledge

'\SYN'

'\22'

synchronous idle

'\ETB'

'\23'

end of transmission block

'\CAN'

'\24'

cancel

'\EM'

'\25'

end of medium

'\SUB'

'\26'

substitute

'\ESC'

'\27'

escape

'\FS'

'\28'

file separator

'\GS'

'\29'

group separator

'\RS'

'\30'

record separator

'\US'

'\31'

unit separator

'\SP'

'\32'

,

' '

space

'\DEL'

'\127'

delete

Data.Char provides utilities to work with Char.

Instances25Bounded, Enum, Data, Read, Ix, Storable, …
datadata Double
#

Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.

Instances25Enum, Floating, Fractional, Data, Num, Read, …
  • Enum DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan

    fromEnum just truncates its argument, beware of all sorts of overflows.

    List generators have extremely peculiar behavior, mandated by Haskell Report 2010:

    Example1 expression
    [0..1.5][0.0,1.0,2.0]
  • Eq DoubleDefined in ghc-prim-0.12.0 · GHC.Classes

    Note that due to the presence of NaN, Double's Eq instance does not satisfy reflexivity.

    Example1 expression
    0/0 == (0/0 :: Double)False

    Also note that Double's Eq instance does not satisfy substitutivity:

    Example2 expressions
    0 == (-0 :: Double)Truerecip 0 == recip (-0 :: Double)False
  • Floating DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float
  • Fractional DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan

    This instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero.

    Example4 expressions
    0 == (-0 :: Double)Truerecip 0 == recip (-0 :: Double)Falsemap (/ 0) [-1, 0, 1][-Infinity,NaN,Infinity]map (* 0) $ map (/ 0) [-1, 0, 1][NaN,NaN,NaN]
  • Data DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan

    This instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero. Neither addition nor multiplication are associative or distributive:

    Example3 expressions
    (0.1 + 0.1) + 0.4 == 0.1 + (0.1 + 0.4)False(0.1 + 0.2) * 0.3 == 0.1 * 0.3 + 0.2 * 0.3False(0.1 * 0.1) * 0.3 == 0.1 * (0.1 * 0.3)False
  • Ord DoubleDefined in ghc-prim-0.12.0 · GHC.Classes

    IEEE 754 Double-precision type includes not only numbers, but also positive and negative infinities and a special element called NaN (which can be quiet or signal).

    IEEE 754-2008, section 5.11 requires that if at least one of arguments of <=, <, >, >= is NaN then the result of the comparison is False, and instance Ord Double complies with this requirement. This violates the reflexivity: both NaN <= NaN and NaN >= NaN are False.

    IEEE 754-2008, section 5.10 defines totalOrder predicate. Unfortunately, compare on Doubles violates the IEEE standard and does not define a total order. More specifically, both compare NaN x and compare x NaN always return GT.

    Thus, users must be extremely cautious when using instance Ord Double. For instance, one should avoid ordered containers with keys represented by Double, because data loss and corruption may happen. An IEEE-compliant compare is available in fp-ieee package as TotallyOrdered newtype.

    Moving further, the behaviour of min and max with regards to NaN is also non-compliant. IEEE 754-2008, section 5.3.1 defines that quiet NaN should be treated as a missing data by minNum and maxNum functions, for example, minNum(NaN, 1) = minNum(1, NaN) = 1. Some languages such as Java deviate from the standard implementing minNum(NaN, 1) = minNum(1, NaN) = NaN. However, min / max in base are even worse: min NaN 1 is 1, but min 1 NaN is NaN.

    IEEE 754-2008 compliant min / max can be found in ieee754 package under minNum / maxNum names. Implementations compliant with minimumNumber / maximumNumber from a newer IEEE 754-2019, section 9.6 are available from fp-ieee package.

  • Read DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Read
  • Real DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan

    Beware that toRational generates garbage for non-finite arguments:

    Example2 expressions
    toRational (1/0)179769313 (and 300 more digits...) % 1toRational (0/0)269653970 (and 300 more digits...) % 1
  • RealFloat DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float
  • RealFrac DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan

    Beware that results for non-finite arguments are garbage:

    Example2 expressions
    [ f x | f <- [round, floor, ceiling], x <- [-1/0, 0/0, 1/0] ] :: [Int][0,0,0,0,0,0,0,0,0]map properFraction [-1/0, 0/0, 1/0] :: [(Int, Double)][(0,0.0),(0,0.0),(0,0.0)]

    and get even more non-sensical if you ask for Integer instead of Int.

  • Show DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan
  • Storable DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • PrintfArg DoubleDefined in base-4.20.2.0 · Text.Printf
  • Generic1 (URec Double)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Foldable UDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Foldable
  • Traversable UDoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Traversable
  • Functor (URec Double)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Eq (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Ord (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Show (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • type Rep (URec Double p) = D1 ('MetaData "URec" "GHC.Internal.Generics" "ghc-internal" 'False) (C1 ('MetaCons "UDouble" 'PrefixI 'True) (S1 ('MetaSel ('Just "uDouble#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UDouble))Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • type Rep1 (URec Double) = D1 ('MetaData "URec" "GHC.Internal.Generics" "ghc-internal" 'False) (C1 ('MetaCons "UDouble" 'PrefixI 'True) (S1 ('MetaSel ('Just "uDouble#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UDouble))Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • data URec DoubleDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics

    Used for marking occurrences of Double#

datadata Either a b
#

The Either type represents values with two possibilities: a value of type Either a b is either Left a or Right b.

The Either type is sometimes used to represent a value which is either correct or an error; by convention, the Left constructor is used to hold an error value and the Right constructor is used to hold a correct value (mnemonic: "right" also means "correct").

Examples

The type Either String Int is the type of values which can be either a String or an Int. The Left constructor can be used only on Strings, and the Right constructor can be used only on Ints:

Example6 expressions
let s = Left "foo" :: Either String IntsLeft "foo"let n = Right 3 :: Either String IntnRight 3:type ss :: Either String Int:type nn :: Either String Int

The fmap from our Functor instance will ignore Left values, but will apply the supplied function to values contained in a Right:

Example4 expressions
let s = Left "foo" :: Either String Intlet n = Right 3 :: Either String Intfmap (*2) sLeft "foo"fmap (*2) nRight 6

The Monad instance for Either allows us to chain together multiple actions which may fail, and fail overall if any of the individual steps failed. First we'll write a function that can either parse an Int from a Char, or fail.

Example3 expressions
import Data.Char ( digitToInt, isDigit ):{    let parseEither :: Char -> Either String Int        parseEither c          | isDigit c = Right (digitToInt c)          | otherwise = Left "parse error":}

The following should work, since both '1' and '2' can be parsed as Ints.

Example2 expressions
:{    let parseMultiple :: Either String Int        parseMultiple = do          x <- parseEither '1'          y <- parseEither '2'          return (x + y):}
Example1 expression
parseMultipleRight 3

But the following should fail overall, since the first operation where we attempt to parse 'm' as an Int will fail:

Example2 expressions
:{    let parseMultiple :: Either String Int        parseMultiple = do          x <- parseEither 'm'          y <- parseEither '2'          return (x + y):}
Example1 expression
parseMultipleLeft "parse error"

Constructors

Instances28Bifoldable, Bifoldable1, Bifunctor, Bitraversable, Eq2, Ord2, …
datadata Float
#

Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.

Instances25Enum, Floating, Fractional, Data, Num, Read, …
  • Enum FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan

    fromEnum just truncates its argument, beware of all sorts of overflows.

    List generators have extremely peculiar behavior, mandated by Haskell Report 2010:

    Example1 expression
    [0..1.5 :: Float][0.0,1.0,2.0]
  • Eq FloatDefined in ghc-prim-0.12.0 · GHC.Classes

    Note that due to the presence of NaN, Float's Eq instance does not satisfy reflexivity.

    Example1 expression
    0/0 == (0/0 :: Float)False

    Also note that Float's Eq instance does not satisfy extensionality:

    Example2 expressions
    0 == (-0 :: Float)Truerecip 0 == recip (-0 :: Float)False
  • Floating FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float
  • Fractional FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan

    This instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero.

    Example4 expressions
    0 == (-0 :: Float)Truerecip 0 == recip (-0 :: Float)Falsemap (/ 0) [-1, 0, 1 :: Float][-Infinity,NaN,Infinity]map (* 0) $ map (/ 0) [-1, 0, 1 :: Float][NaN,NaN,NaN]
  • Data FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan

    This instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero. Neither addition nor multiplication are associative or distributive:

    Example3 expressions
    (0.1 + 0.1 :: Float) + 0.5 == 0.1 + (0.1 + 0.5)False(0.1 + 0.2 :: Float) * 0.9 == 0.1 * 0.9 + 0.2 * 0.9False(0.1 * 0.1 :: Float) * 0.9 == 0.1 * (0.1 * 0.9)False
  • Ord FloatDefined in ghc-prim-0.12.0 · GHC.Classes

    See instance Ord Double for discussion of deviations from IEEE 754 standard.

  • Read FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Read
  • Real FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan

    Beware that toRational generates garbage for non-finite arguments:

    Example2 expressions
    toRational (1/0 :: Float)340282366920938463463374607431768211456 % 1toRational (0/0 :: Float)510423550381407695195061911147652317184 % 1
  • RealFloat FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float
  • RealFrac FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan

    Beware that results for non-finite arguments are garbage:

    Example2 expressions
    [ f x | f <- [round, floor, ceiling], x <- [-1/0, 0/0, 1/0 :: Float] ] :: [Int][0,0,0,0,0,0,0,0,0]map properFraction [-1/0, 0/0, 1/0] :: [(Int, Float)][(0,0.0),(0,0.0),(0,0.0)]

    and get even more non-sensical if you ask for Integer instead of Int.

  • Show FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Float · orphan
  • Storable FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • PrintfArg FloatDefined in base-4.20.2.0 · Text.Printf
  • Generic1 (URec Float)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Foldable UFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Foldable
  • Traversable UFloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Traversable
  • Functor (URec Float)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Eq (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Ord (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Show (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • type Rep (URec Float p) = D1 ('MetaData "URec" "GHC.Internal.Generics" "ghc-internal" 'False) (C1 ('MetaCons "UFloat" 'PrefixI 'True) (S1 ('MetaSel ('Just "uFloat#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UFloat))Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • type Rep1 (URec Float) = D1 ('MetaData "URec" "GHC.Internal.Generics" "ghc-internal" 'False) (C1 ('MetaCons "UFloat" 'PrefixI 'True) (S1 ('MetaSel ('Just "uFloat#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UFloat))Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • data URec FloatDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics

    Used for marking occurrences of Float#

datadata Integer
#

Arbitrary precision integers. In contrast with fixed-size integral types such as Int, the Integer type represents the entire infinite range of integers.

Integers are stored in a kind of sign-magnitude form, hence do not expect two's complement form when using bit operations.

If the value is small (i.e., fits into an Int), the IS constructor is used. Otherwise IP and IN constructors are used to store a BigNat representing the positive or the negative value magnitude, respectively.

Invariant: IP and IN are used iff the value does not fit in IS.

Instances12Enum, Eq, Integral, Data, Num, Ord, …
  • Enum IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.Enum
  • Eq IntegerDefined in ghc-bignum-1.3 · GHC.Num.Integer
  • Integral IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.Real
  • Data IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.Num
  • Ord IntegerDefined in ghc-bignum-1.3 · GHC.Num.Integer
  • Read IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.Read
  • Real IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.Real
  • Show IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.Show
  • Ix IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.Ix
  • Bits IntegerDefined in ghc-internal-9.1003.0 · GHC.Internal.Bits
  • PrintfArg IntegerDefined in base-4.20.2.0 · Text.Printf
datadata Maybe a
#

The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as Just a), or it is empty (represented as Nothing). Using Maybe is a good way to deal with errors or exceptional cases without resorting to drastic measures such as error.

The Maybe type is also a monad. It is a simple kind of error monad, where all errors are represented by Nothing. A richer error monad can be built using the Either type.

Constructors

Instances30Monad, Functor, MonadFix, MonadFail, Applicative, Foldable, …
typetype String = [Char]
#

String is an alias for a list of characters.

String constants in Haskell are values of type String. That means if you write a string literal like "hello world", it will have the type [Char], which is the same as String.

Note: You can ask the compiler to automatically infer different types with the -XOverloadedStrings language extension, for example "hello world" :: Text. See IsString for more information.

Because String is just a list of characters, you can use normal list functions to do basic string manipulation. See Data.List for operations on lists.

Performance considerations

[Char] is a relatively memory-inefficient type. It is a linked list of boxed word-size characters, internally it looks something like:

╭─────┬───┬──╮  ╭─────┬───┬──╮  ╭─────┬───┬──╮  ╭────╮
│ (:) │   │ ─┼─>│ (:) │   │ ─┼─>│ (:) │   │ ─┼─>│ [] │
╰─────┴─┼─┴──╯  ╰─────┴─┼─┴──╯  ╰─────┴─┼─┴──╯  ╰────╯
        v               v               v
       'a'             'b'             'c'

The String "abc" will use 5*3+1 = 16 (in general 5n+1) words of space in memory.

Furthermore, operations like (++) (string concatenation) are O(n) (in the left argument).

For historical reasons, the base library uses String in a lot of places for the conceptual simplicity, but library code dealing with user-data should use the text package for Unicode text, or the the bytestring package for binary data.

From Data.Int

5 declarations
datadata Int
#

A fixed-precision integer type with at least the range [-2^29 .. 2^29-1]. The exact range for a given implementation can be determined by using Prelude.minBound and Prelude.maxBound from the Prelude.Bounded class.

Instances26Bounded, Enum, Integral, Data, Num, Read, …
datadata Int8
#

8-bit signed integer type

Instances15Bounded, Enum, Eq, Integral, Data, Num, …
  • Bounded Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Enum Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Eq Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Integral Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Data Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Ord Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Read Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Real Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Show Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Ix Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Bits Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • FiniteBits Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Storable Int8Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • PrintfArg Int8Defined in base-4.20.2.0 · Text.Printf
datadata Int16
#

16-bit signed integer type

Instances15Bounded, Enum, Eq, Integral, Data, Num, …
  • Bounded Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Enum Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Eq Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Integral Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Data Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Ord Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Read Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Real Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Show Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Ix Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Bits Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • FiniteBits Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Storable Int16Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • PrintfArg Int16Defined in base-4.20.2.0 · Text.Printf
datadata Int32
#

32-bit signed integer type

Instances15Bounded, Enum, Eq, Integral, Data, Num, …
  • Bounded Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Enum Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Eq Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Integral Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Data Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Ord Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Read Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Real Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Show Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Ix Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Bits Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • FiniteBits Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Storable Int32Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • PrintfArg Int32Defined in base-4.20.2.0 · Text.Printf
datadata Int64
#

64-bit signed integer type

Instances15Bounded, Enum, Eq, Integral, Data, Num, …
  • Bounded Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Enum Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Eq Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Integral Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Data Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Ord Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Read Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Real Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Show Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Ix Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Bits Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • FiniteBits Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Int
  • Storable Int64Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • PrintfArg Int64Defined in base-4.20.2.0 · Text.Printf

From Data.Word

5 declarations
datadata Word
#

A Word is an unsigned integral type, with the same size as Int.

Instances26Bounded, Enum, Integral, Data, Num, Read, …
datadata Word8
#

8-bit unsigned integer type

Instances15Bounded, Enum, Eq, Integral, Data, Num, …
  • Bounded Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Enum Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Eq Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Integral Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Data Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Ord Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Read Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Read
  • Real Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Show Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Ix Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Bits Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • FiniteBits Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Storable Word8Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • PrintfArg Word8Defined in base-4.20.2.0 · Text.Printf
datadata Word16
#

16-bit unsigned integer type

Instances15Bounded, Enum, Eq, Integral, Data, Num, …
  • Bounded Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Enum Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Eq Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Integral Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Data Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Ord Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Read Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Read
  • Real Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Show Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Ix Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Bits Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • FiniteBits Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Storable Word16Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • PrintfArg Word16Defined in base-4.20.2.0 · Text.Printf
datadata Word32
#

32-bit unsigned integer type

Instances15Bounded, Enum, Eq, Integral, Data, Num, …
  • Bounded Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Enum Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Eq Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Integral Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Data Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Ord Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Read Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Read
  • Real Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Show Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Ix Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Bits Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • FiniteBits Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Storable Word32Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • PrintfArg Word32Defined in base-4.20.2.0 · Text.Printf
datadata Word64
#

64-bit unsigned integer type

Instances15Bounded, Enum, Eq, Integral, Data, Num, …
  • Bounded Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Enum Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Eq Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Integral Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Data Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Ord Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Read Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Read
  • Real Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Show Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Ix Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Bits Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • FiniteBits Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Word
  • Storable Word64Defined in ghc-internal-9.1003.0 · GHC.Internal.Foreign.Storable
  • PrintfArg Word64Defined in base-4.20.2.0 · Text.Printf

From Data.Complex

1 declaration
datadata Complex a
#

A data type representing complex numbers.

You can read about complex numbers on wikipedia.

In haskell, complex numbers are represented as a :+ b which can be thought of as representing a + bi. For a complex number z, abs z is a number with the magnitude of z, but oriented in the positive real direction, whereas signum z has the phase of z, but unit magnitude. Apart from the loss of precision due to IEEE754 floating point numbers, it holds that z == abs z * signum z.

Note that Complex's instances inherit the deficiencies from the type parameter's. For example, Complex Float's Ord instance has similar problems to Float's.

As can be seen in the examples, the Foldable and Traversable instances traverse the real part first.

Examples
Example1 expression
(5.0 :+ 2.5) + 6.511.5 :+ 2.5
Example1 expression
abs (1.0 :+ 1.0) - sqrt 2.00.0 :+ 0.0
Example1 expression
abs (signum (4.0 :+ 3.0))1.0 :+ 0.0
Example1 expression
foldr (:) [] (1 :+ 2)[1,2]
Example1 expression
mapM print (1 :+ 2)12

Constructors

  • a :+ ainfix 6

    forms a complex number from its real and imaginary rectangular components.

Instances23Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …

From Data.Ratio

1 declaration
typetype Rational = Ratio Integer
#

Arbitrary-precision rational numbers, represented as a ratio of two Integer values. A rational number may be constructed using the % operator.

From Numeric.Natural

1 declaration
datadata Natural
#

Natural number

Invariant: numbers <= 0xffffffffffffffff use the NS constructor

Instances15Enum, Eq, Integral, Data, Num, Ord, …
  • Enum NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.Enum
  • Eq NaturalDefined in ghc-bignum-1.3 · GHC.Num.Natural
  • Integral NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.Real
  • Data NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Num NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.Num

    Note that Natural's Num instance isn't a ring: no element but 0 has an additive inverse. It is a semiring though.

  • Ord NaturalDefined in ghc-bignum-1.3 · GHC.Num.Natural
  • Read NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.Read
  • Real NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.Real
  • Show NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.Show
  • Ix NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.Ix
  • Bits NaturalDefined in ghc-internal-9.1003.0 · GHC.Internal.Bits
  • PrintfArg NaturalDefined in base-4.20.2.0 · Text.Printf
  • TestCoercion SNatDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeNats
  • TestEquality SNatDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeNats
  • type Compare a b = CmpNat a bDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Ord

From Data.List.NonEmpty

1 declaration
datadata NonEmpty a
#

Non-empty (and non-strict) list type.

Constructors

  • a :| [a]infixr 5
Instances24Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …