Safe Haskell | Unsafe |
---|---|
Language | Haskell2010 |
Synopsis
- (++) :: [a] -> [a] -> [a]
- seq :: forall (r :: RuntimeRep ) a (b :: TYPE r). a -> b -> b
- print :: Show a => a -> IO ()
- fromIntegral :: ( Integral a, Num b) => a -> b
- realToFrac :: ( Real a, Fractional b) => a -> b
- 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]
-
class
Fractional
a =>
Floating
a
where
- pi :: a
- exp :: a -> a
- log :: a -> a
- sqrt :: a -> a
- (**) :: a -> a -> a
- logBase :: a -> a -> a
- sin :: a -> a
- cos :: a -> a
- tan :: a -> a
- asin :: a -> a
- acos :: a -> a
- atan :: a -> a
- sinh :: a -> a
- cosh :: a -> a
- tanh :: a -> a
- asinh :: a -> a
- acosh :: a -> a
- atanh :: a -> a
- log1p :: a -> a
- expm1 :: a -> a
- log1pexp :: a -> a
- log1mexp :: a -> a
-
class
Num
a =>
Fractional
a
where
- (/) :: a -> a -> a
- recip :: a -> a
- fromRational :: Rational -> a
- class ( Real a, Enum a) => Integral a where
- class Num a where
-
class
(
Num
a,
Ord
a) =>
Real
a
where
- toRational :: a -> Rational
-
class
(
RealFrac
a,
Floating
a) =>
RealFloat
a
where
- floatRadix :: a -> Integer
- floatDigits :: a -> Int
- floatRange :: a -> ( Int , Int )
- decodeFloat :: a -> ( Integer , Int )
- encodeFloat :: Integer -> Int -> a
- exponent :: a -> Int
- significand :: a -> a
- scaleFloat :: Int -> a -> a
- isNaN :: a -> Bool
- isInfinite :: a -> Bool
- isDenormalized :: a -> Bool
- isNegativeZero :: a -> Bool
- isIEEE :: a -> Bool
- atan2 :: a -> a -> a
- class ( Real a, Fractional a) => RealFrac a where
- class Show a where
- class KnownNat (n :: Nat )
- class KnownSymbol (n :: Symbol )
-
class
IsLabel
(x ::
Symbol
) a
where
- fromLabel :: a
-
class
HasField
(x :: k) r a | x r -> a
where
- getField :: r -> a
- data Bool
- data Char
- data Double = D# Double#
- data Float = F# Float#
- data Int
- data Integer
- data Ordering
- data Ratio a
- type Rational = Ratio Integer
- data IO a
- data Word
- data Ptr a
- data FunPtr a
- type Type = Type
- data Constraint
- data Nat
- data Symbol
- type family CmpNat (a :: Nat ) (b :: Nat ) :: Ordering where ...
- class a ~R# b => Coercible (a :: k) (b :: k)
- data StaticPtr a
- data CallStack
- showStackTrace :: IO ( Maybe String )
- getStackTrace :: IO ( Maybe [ Location ])
- data SrcLoc = SrcLoc String Int Int
-
data
Location
=
Location
{
- objectName :: String
- functionName :: String
- srcLoc :: Maybe SrcLoc
- putStrLn :: String -> IO ()
- putStr :: String -> IO ()
- withFrozenCallStack :: HasCallStack => ( HasCallStack => a) -> a
- callStack :: HasCallStack => CallStack
- prettyCallStack :: CallStack -> String
- prettySrcLoc :: SrcLoc -> String
- someSymbolVal :: String -> SomeSymbol
- someNatVal :: Integer -> Maybe SomeNat
- symbolVal :: forall (n :: Symbol ) proxy. KnownSymbol n => proxy n -> String
- natVal :: forall (n :: Nat ) proxy. KnownNat n => proxy n -> Integer
- data SomeSymbol = KnownSymbol n => SomeSymbol ( Proxy n)
- data SomeNat = KnownNat n => SomeNat ( Proxy n)
- showSignedFloat :: RealFloat a => (a -> ShowS ) -> Int -> a -> ShowS
- showFloat :: RealFloat a => a -> ShowS
- integralEnumFromThenTo :: Integral a => a -> a -> a -> [a]
- integralEnumFromTo :: Integral a => a -> a -> [a]
- integralEnumFromThen :: ( Integral a, Bounded a) => a -> a -> [a]
- integralEnumFrom :: ( Integral a, Bounded a) => a -> [a]
- gcdWord' :: Word -> Word -> Word
- gcdInt' :: Int -> Int -> Int
- lcm :: Integral a => a -> a -> a
- gcd :: Integral a => a -> a -> a
- (^^%^^) :: Integral a => Rational -> a -> Rational
- (^%^) :: Integral a => Rational -> a -> Rational
- (^^) :: ( Fractional a, Integral b) => a -> b -> a
- (^) :: ( Num a, Integral b) => a -> b -> a
- odd :: Integral a => a -> Bool
- even :: Integral a => a -> Bool
- showSigned :: Real a => (a -> ShowS ) -> Int -> a -> ShowS
- numericEnumFromThenTo :: ( Ord a, Fractional a) => a -> a -> a -> [a]
- numericEnumFromTo :: ( Ord a, Fractional a) => a -> a -> [a]
- numericEnumFromThen :: Fractional a => a -> a -> [a]
- numericEnumFrom :: Fractional a => a -> [a]
- denominator :: Ratio a -> a
- numerator :: Ratio a -> a
- (%) :: Integral a => a -> a -> Ratio a
- reduce :: Integral a => a -> a -> Ratio a
- notANumber :: Rational
- infinity :: Rational
- ratioPrec1 :: Int
- ratioPrec :: Int
- underflowError :: a
- overflowError :: a
- ratioZeroDenominatorError :: a
- divZeroError :: a
- boundedEnumFromThen :: ( Enum a, Bounded a) => a -> a -> [a]
- boundedEnumFrom :: ( Enum a, Bounded a) => a -> [a]
- subtract :: Num a => a -> a -> a
- currentCallStack :: IO [ String ]
- asTypeOf :: a -> a -> a
- until :: (a -> Bool ) -> (a -> a) -> a -> a
- maxInt :: Int
- minInt :: Int
- ord :: Char -> Int
- getCallStack :: CallStack -> [([ Char ], SrcLoc )]
- type HasCallStack = ?callStack :: CallStack
- ($!) :: (a -> b) -> a -> b
Documentation
(++) :: [a] -> [a] -> [a] infixr 5 Source #
Append two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn] [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.
seq :: forall (r :: RuntimeRep ) a (b :: TYPE r). a -> b -> b infixr 0 Source #
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.
print :: Show a => a -> IO () Source #
The
print
function outputs a value of any printable type to the
standard output device.
Printable types are those that are instances of class
Show
;
print
converts values to strings for output using the
show
operation and
adds a newline.
For example, a program to print the first 20 integers and their powers of 2 could be written as:
main = print ([(n, 2^n) | n <- [0..19]])
fromIntegral :: ( Integral a, Num b) => a -> b Source #
general coercion from integral types
realToFrac :: ( Real a, Fractional b) => a -> b Source #
general coercion to fractional types
class Bounded a where Source #
The
Bounded
class is used to name the upper and lower limits of a
type.
Ord
is not a superclass of
Bounded
since types that are not
totally ordered may also have upper and lower bounds.
The
Bounded
class may be derived for any enumeration type;
minBound
is the first constructor listed in the
data
declaration
and
maxBound
is the last.
Bounded
may also be derived for single-constructor datatypes whose
constituent types are in
Bounded
.
Instances
Bounded Bool |
Since: base-2.1 |
Bounded Char |
Since: base-2.1 |
Bounded Int |
Since: base-2.1 |
Bounded Int8 |
Since: base-2.1 |
Bounded Int16 |
Since: base-2.1 |
Bounded Int32 |
Since: base-2.1 |
Bounded Int64 |
Since: base-2.1 |
Bounded Ordering |
Since: base-2.1 |
Bounded Word |
Since: base-2.1 |
Bounded Word8 |
Since: base-2.1 |
Bounded Word16 |
Since: base-2.1 |
Bounded Word32 |
Since: base-2.1 |
Bounded Word64 |
Since: base-2.1 |
Bounded VecCount |
Since: base-4.10.0.0 |
Bounded VecElem |
Since: base-4.10.0.0 |
Bounded () |
Since: base-2.1 |
Bounded CDev | |
Bounded CIno | |
Bounded CMode | |
Bounded COff | |
Bounded CPid | |
Bounded CSsize | |
Bounded CGid | |
Bounded CNlink | |
Bounded CUid | |
Bounded CTcflag | |
Bounded CRLim | |
Bounded CBlkSize | |
Bounded CBlkCnt | |
Bounded CClockId | |
Bounded CFsBlkCnt | |
Bounded CFsFilCnt | |
Bounded CId | |
Bounded CKey | |
Bounded CSocklen | |
Bounded CNfds | |
Bounded Fd | |
Bounded All |
Since: base-2.1 |
Bounded Any |
Since: base-2.1 |
Bounded Associativity |
Since: base-4.9.0.0 |
Defined in GHC.Generics |
|
Bounded SourceUnpackedness |
Since: base-4.9.0.0 |
Defined in GHC.Generics |
|
Bounded SourceStrictness |
Since: base-4.9.0.0 |
Defined in GHC.Generics |
|
Bounded DecidedStrictness |
Since: base-4.9.0.0 |
Defined in GHC.Generics |
|
Bounded CChar | |
Bounded CSChar | |
Bounded CUChar | |
Bounded CShort | |
Bounded CUShort | |
Bounded CInt | |
Bounded CUInt | |
Bounded CLong | |
Bounded CULong | |
Bounded CLLong | |
Bounded CULLong | |
Bounded CBool | |
Bounded CPtrdiff | |
Bounded CSize | |
Bounded CWchar | |
Bounded CSigAtomic | |
Defined in Foreign.C.Types |
|
Bounded CIntPtr | |
Bounded CUIntPtr | |
Bounded CIntMax | |
Bounded CUIntMax | |
Bounded WordPtr | |
Bounded IntPtr | |
Bounded GeneralCategory |
Since: base-2.1 |
Defined in GHC.Unicode |
|
Bounded Leniency Source # | |
Bounded a => Bounded ( Min a) |
Since: base-4.9.0.0 |
Bounded a => Bounded ( Max a) |
Since: base-4.9.0.0 |
Bounded a => Bounded ( First a) |
Since: base-4.9.0.0 |
Bounded a => Bounded ( Last a) |
Since: base-4.9.0.0 |
Bounded m => Bounded ( WrappedMonoid m) |
Since: base-4.9.0.0 |
Defined in Data.Semigroup minBound :: WrappedMonoid m Source # maxBound :: WrappedMonoid m Source # |
|
Bounded a => Bounded ( Identity a) |
Since: base-4.9.0.0 |
Bounded a => Bounded ( Dual a) |
Since: base-2.1 |
Bounded a => Bounded ( Sum a) |
Since: base-2.1 |
Bounded a => Bounded ( Product a) |
Since: base-2.1 |
Bounded a => Bounded ( Down a) |
Since: base-4.14.0.0 |
( Bounded a, Bounded b) => Bounded (a, b) |
Since: base-2.1 |
Bounded ( Proxy t) |
Since: base-4.7.0.0 |
( Bounded a, Bounded b, Bounded c) => Bounded (a, b, c) |
Since: base-2.1 |
Bounded a => Bounded ( Const a b) |
Since: base-4.9.0.0 |
( Applicative f, Bounded a) => Bounded ( Ap f a) |
Since: base-4.12.0.0 |
Coercible a b => Bounded ( Coercion a b) |
Since: base-4.7.0.0 |
a ~ b => Bounded (a :~: b) |
Since: base-4.7.0.0 |
( Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a, b, c, d) |
Since: base-2.1 |
a ~~ b => Bounded (a :~~: b) |
Since: base-4.10.0.0 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a, b, c, d, e) |
Since: base-2.1 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f) => Bounded (a, b, c, d, e, f) |
Since: base-2.1 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g) => Bounded (a, b, c, d, e, f, g) |
Since: base-2.1 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h) => Bounded (a, b, c, d, e, f, g, h) |
Since: base-2.1 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i) => Bounded (a, b, c, d, e, f, g, h, i) |
Since: base-2.1 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j) => Bounded (a, b, c, d, e, f, g, h, i, j) |
Since: base-2.1 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k) => Bounded (a, b, c, d, e, f, g, h, i, j, k) |
Since: base-2.1 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l) |
Since: base-2.1 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m) |
Since: base-2.1 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n) |
Since: base-2.1 |
( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n, Bounded o) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) |
Since: base-2.1 |
Class
Enum
defines operations on sequentially ordered types.
The
enumFrom
... methods are used in Haskell's translation of
arithmetic sequences.
Instances of
Enum
may be derived for any enumeration type (types
whose constructors have no fields). The nullary constructors are
assumed to be numbered left-to-right by
fromEnum
from
0
through
n-1
.
See Chapter 10 of the
Haskell Report
for more details.
For any type that is an instance of class
Bounded
as well as
Enum
,
the following should hold:
-
The calls
succ
maxBound
pred
minBound
-
fromEnum
andtoEnum
should give a runtime error if the result value is not representable in the result type. For example,toEnum
7 ::Bool
-
enumFrom
andenumFromThen
should be defined with an implicit bound, thus:
enumFrom x = enumFromTo x maxBound enumFromThen x y = enumFromThenTo x y bound where bound | fromEnum y >= fromEnum x = maxBound | otherwise = minBound
the successor of a value. For numeric types,
succ
adds 1.
the predecessor of a value. For numeric types,
pred
subtracts 1.
Convert from an
Int
.
Convert to an
Int
.
It is implementation-dependent what
fromEnum
returns when
applied to a value that is too large to fit in an
Int
.
Used in Haskell's translation of
[n..]
with
[n..] = enumFrom n
,
a possible implementation being
enumFrom n = n : enumFrom (succ n)
.
For example:
-
enumFrom 4 :: [Integer] = [4,5,6,7,...]
-
enumFrom 6 :: [Int] = [6,7,8,9,...,maxBound :: Int]
enumFromThen :: a -> a -> [a] Source #
Used in Haskell's translation of
[n,n'..]
with
[n,n'..] = enumFromThen n n'
, a possible implementation being
enumFromThen n n' = n : n' : worker (f x) (f x n')
,
worker s v = v : worker s (s v)
,
x = fromEnum n' - fromEnum n
and
f n y
| n > 0 = f (n - 1) (succ y)
| n < 0 = f (n + 1) (pred y)
| otherwise = y
For example:
-
enumFromThen 4 6 :: [Integer] = [4,6,8,10...]
-
enumFromThen 6 2 :: [Int] = [6,2,-2,-6,...,minBound :: Int]
enumFromTo :: a -> a -> [a] Source #
Used in Haskell's translation of
[n..m]
with
[n..m] = enumFromTo n m
, a possible implementation being
enumFromTo n m
| n <= m = n : enumFromTo (succ n) m
| otherwise = []
.
For example:
-
enumFromTo 6 10 :: [Int] = [6,7,8,9,10]
-
enumFromTo 42 1 :: [Integer] = []
enumFromThenTo :: a -> a -> a -> [a] Source #
Used in Haskell's translation of
[n,n'..m]
with
[n,n'..m] = enumFromThenTo n n' m
, a possible implementation
being
enumFromThenTo n n' m = worker (f x) (c x) n m
,
x = fromEnum n' - fromEnum n
,
c x = bool (>=) (
(x
0)
f n y
| n > 0 = f (n - 1) (succ y)
| n < 0 = f (n + 1) (pred y)
| otherwise = y
and
worker s c v m
| c v m = v : worker s c (s v) m
| otherwise = []
For example:
-
enumFromThenTo 4 2 -6 :: [Integer] = [4,2,0,-2,-4,-6]
-
enumFromThenTo 6 8 2 :: [Int] = []
Instances
class Fractional a => Floating a where Source #
Trigonometric and hyperbolic functions and related functions.
The Haskell Report defines no laws for
Floating
. However,
(
,
+
)
(
and
*
)
exp
are customarily expected to define an exponential field and have
the following properties:
-
exp (a + b)
=exp a * exp b
-
exp (fromInteger 0)
=fromInteger 1
(**) :: a -> a -> a infixr 8 Source #
logBase :: a -> a -> a Source #
computes
log1p
x
, but provides more precise
results for small (absolute) values of
log
(1 + x)
x
if possible.
Since: base-4.9.0.0
computes
expm1
x
, but provides more precise
results for small (absolute) values of
exp
x - 1
x
if possible.
Since: base-4.9.0.0
computes
log1pexp
x
, but provides more
precise results if possible.
log
(1 +
exp
x)
Examples:
-
if
x
is a large negative number,log
(1 +exp
x)log1p
. -
if
exp
x-1
,log
(1 +exp
x)expm1
.
Since: base-4.9.0.0
computes
log1mexp
x
, but provides more
precise results if possible.
log
(1 -
exp
x)
Examples:
-
if
x
is a large negative number,log
(1 -exp
x)log1p
. -
if
exp
x1
,log
(1 -exp
x)expm1
.
Since: base-4.9.0.0
Instances
class Num a => Fractional a where Source #
Fractional numbers, supporting real division.
The Haskell Report defines no laws for
Fractional
. However,
(
and
+
)
(
are customarily expected to define a division ring and have the
following properties:
*
)
-
recip
gives the multiplicative inverse -
x * recip x
=recip x * x
=fromInteger 1
Note that it
isn't
customarily expected that a type instance of
Fractional
implement a field. However, all instances in
base
do.
fromRational , ( recip | (/) )
(/) :: a -> a -> a infixl 7 Source #
Fractional division.
Reciprocal fraction.
fromRational :: Rational -> a Source #
Conversion from a
Rational
(that is
).
A floating literal stands for an application of
Ratio
Integer
fromRational
to a value of type
Rational
, so such literals have type
(
.
Fractional
a) => a
Instances
Fractional CFloat | |
Fractional CDouble | |
Integral a => Fractional ( Ratio a) |
Since: base-2.0.1 |
RealFloat a => Fractional ( Complex a) |
Since: base-2.1 |
Fractional a => Fractional ( Identity a) |
Since: base-4.9.0.0 |
Fractional a => Fractional ( Down a) |
Since: base-4.14.0.0 |
Fractional a => Fractional ( Const a b) |
Since: base-4.9.0.0 |
class ( Real a, Enum a) => Integral a where Source #
Integral numbers, supporting integer division.
The Haskell Report defines no laws for
Integral
. However,
Integral
instances are customarily expected to define a Euclidean domain and have the
following properties for the
div
/
mod
and
quot
/
rem
pairs, given
suitable Euclidean functions
f
and
g
:
-
x
=y * quot x y + rem x y
withrem x y
=fromInteger 0
org (rem x y)
<g y
-
x
=y * div x y + mod x y
withmod x y
=fromInteger 0
orf (mod x y)
<f y
An example of a suitable Euclidean function, for
Integer
's instance, is
abs
.
quot :: a -> a -> a infixl 7 Source #
integer division truncated toward zero
rem :: a -> a -> a infixl 7 Source #
integer remainder, satisfying
(x `quot` y)*y + (x `rem` y) == x
div :: a -> a -> a infixl 7 Source #
integer division truncated toward negative infinity
mod :: a -> a -> a infixl 7 Source #
integer modulus, satisfying
(x `div` y)*y + (x `mod` y) == x
quotRem :: a -> a -> (a, a) Source #
divMod :: a -> a -> (a, a) Source #
toInteger :: a -> Integer Source #
conversion to
Integer
Instances
Basic numeric class.
The Haskell Report defines no laws for
Num
. However,
(
and
+
)
(
are
customarily expected to define a ring and have the following properties:
*
)
-
Associativity of
(
+
) -
(x + y) + z
=x + (y + z)
-
Commutativity of
(
+
) -
x + y
=y + x
-
fromInteger
0 -
x + fromInteger 0
=x
-
negate
gives the additive inverse -
x + negate x
=fromInteger 0
-
Associativity of
(
*
) -
(x * y) * z
=x * (y * z)
-
fromInteger
1 -
x * fromInteger 1
=x
andfromInteger 1 * x
=x
-
Distributivity of
(
with respect to*
)(
+
) -
a * (b + c)
=(a * b) + (a * c)
and(b + c) * a
=(b * a) + (c * a)
Note that it
isn't
customarily expected that a type instance of both
Num
and
Ord
implement an ordered ring. Indeed, in
base
only
Integer
and
Rational
do.
(+) :: a -> a -> a infixl 6 Source #
(-) :: a -> a -> a infixl 6 Source #
(*) :: a -> a -> a infixl 7 Source #
Unary negation.
Absolute value.
Sign of a number.
The functions
abs
and
signum
should satisfy the law:
abs x * signum x == x
For real numbers, the
signum
is either
-1
(negative),
0
(zero)
or
1
(positive).
fromInteger :: Integer -> a Source #
Conversion from an
Integer
.
An integer literal represents the application of the function
fromInteger
to the appropriate value of type
Integer
,
so such literals have type
(
.
Num
a) => a
Instances
class ( Num a, Ord a) => Real a where Source #
toRational :: a -> Rational Source #
the rational equivalent of its real argument with full precision
Instances
class ( RealFrac a, Floating a) => RealFloat a where Source #
Efficient, machine-independent access to the components of a floating-point number.
floatRadix , floatDigits , floatRange , decodeFloat , encodeFloat , isNaN , isInfinite , isDenormalized , isNegativeZero , isIEEE
floatRadix :: a -> Integer Source #
a constant function, returning the radix of the representation
(often
2
)
floatDigits :: a -> Int Source #
a constant function, returning the number of digits of
floatRadix
in the significand
floatRange :: a -> ( Int , Int ) Source #
a constant function, returning the lowest and highest values the exponent may assume
decodeFloat :: a -> ( Integer , Int ) Source #
The function
decodeFloat
applied to a real floating-point
number returns the significand expressed as an
Integer
and an
appropriately scaled exponent (an
Int
). If
yields
decodeFloat
x
(m,n)
, then
x
is equal in value to
m*b^^n
, where
b
is the floating-point radix, and furthermore, either
m
and
n
are both zero or else
b^(d-1) <=
, where
abs
m < b^d
d
is
the value of
.
In particular,
floatDigits
x
. If the type
contains a negative zero, also
decodeFloat
0 = (0,0)
.
The result of
decodeFloat
(-0.0) = (0,0)
is unspecified if either of
decodeFloat
x
or
isNaN
x
is
isInfinite
x
True
.
encodeFloat :: Integer -> Int -> a Source #
encodeFloat
performs the inverse of
decodeFloat
in the
sense that for finite
x
with the exception of
-0.0
,
.
uncurry
encodeFloat
(
decodeFloat
x) = x
is one of the two closest representable
floating-point numbers to
encodeFloat
m n
m*b^^n
(or
±Infinity
if overflow
occurs); usually the closer, but if
m
contains too many bits,
the result may be rounded in the wrong direction.
exponent
corresponds to the second component of
decodeFloat
.
and for finite nonzero
exponent
0 = 0
x
,
.
If
exponent
x = snd (
decodeFloat
x) +
floatDigits
x
x
is a finite floating-point number, it is equal in value to
, where
significand
x * b ^^
exponent
x
b
is the
floating-point radix.
The behaviour is unspecified on infinite or
NaN
values.
significand :: a -> a Source #
The first component of
decodeFloat
, scaled to lie in the open
interval (
-1
,
1
), either
0.0
or of absolute value
>= 1/b
,
where
b
is the floating-point radix.
The behaviour is unspecified on infinite or
NaN
values.
scaleFloat :: Int -> a -> a Source #
multiplies a floating-point number by an integer power of the radix
True
if the argument is an IEEE "not-a-number" (NaN) value
isInfinite :: a -> Bool Source #
True
if the argument is an IEEE infinity or negative infinity
isDenormalized :: a -> Bool Source #
True
if the argument is too small to be represented in
normalized format
isNegativeZero :: a -> Bool Source #
True
if the argument is an IEEE negative zero
True
if the argument is an IEEE floating point number
a version of arctangent taking two real floating-point arguments.
For real floating
x
and
y
,
computes the angle
(from the positive x-axis) of the vector from the origin to the
point
atan2
y x
(x,y)
.
returns a value in the range [
atan2
y x
-pi
,
pi
]. It follows the Common Lisp semantics for the origin when
signed zeroes are supported.
, with
atan2
y 1
y
in a type
that is
RealFloat
, should return the same value as
.
A default definition of
atan
y
atan2
is provided, but implementors
can provide a more accurate implementation.
Instances
class ( Real a, Fractional a) => RealFrac a where Source #
Extracting components of fractions.
properFraction :: Integral b => a -> (b, a) Source #
The function
properFraction
takes a real fractional number
x
and returns a pair
(n,f)
such that
x = n+f
, and:
-
n
is an integral number with the same sign asx
; and -
f
is a fraction with the same type and sign asx
, and with absolute value less than1
.
The default definitions of the
ceiling
,
floor
,
truncate
and
round
functions are in terms of
properFraction
.
truncate :: Integral b => a -> b Source #
returns the integer nearest
truncate
x
x
between zero and
x
round :: Integral b => a -> b Source #
returns the nearest integer to
round
x
x
;
the even integer if
x
is equidistant between two integers
ceiling :: Integral b => a -> b Source #
returns the least integer not less than
ceiling
x
x
floor :: Integral b => a -> b Source #
returns the greatest integer not greater than
floor
x
x
Instances
RealFrac CFloat | |
RealFrac CDouble | |
Integral a => RealFrac ( Ratio a) |
Since: base-2.0.1 |
RealFrac a => RealFrac ( Identity a) |
Since: base-4.9.0.0 |
Defined in Data.Functor.Identity |
|
RealFrac a => RealFrac ( Down a) |
Since: base-4.14.0.0 |
RealFrac a => RealFrac ( Const a b) |
Since: base-4.9.0.0 |
Defined in Data.Functor.Const |
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,
-
show
(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)"
.
:: Int |
the operator precedence of the enclosing
context (a number from
|
-> a |
the value to be converted to a
|
-> ShowS |
Convert a value to a readable
String
.
showsPrec
should satisfy the law
showsPrec d x r ++ s == showsPrec d x (r ++ s)
Derived instances of
Read
and
Show
satisfy the following:
That is,
readsPrec
parses the string produced by
showsPrec
, and delivers the value that
showsPrec
started with.
Instances
Show Bool |
Since: base-2.1 |
Show Char |
Since: base-2.1 |
Show Int |
Since: base-2.1 |
Show Int8 |
Since: base-2.1 |
Show Int16 |
Since: base-2.1 |
Show Int32 |
Since: base-2.1 |
Show Int64 |
Since: base-2.1 |
Show Integer |
Since: base-2.1 |
Show Natural |
Since: base-4.8.0.0 |
Show Ordering |
Since: base-2.1 |
Show Word |
Since: base-2.1 |
Show Word8 |
Since: base-2.1 |
Show Word16 |
Since: base-2.1 |
Show Word32 |
Since: base-2.1 |
Show Word64 |
Since: base-2.1 |
Show RuntimeRep |
Since: base-4.11.0.0 |
Show VecCount |
Since: base-4.11.0.0 |
Show VecElem |
Since: base-4.11.0.0 |
Show CallStack |
Since: base-4.9.0.0 |
Show SomeTypeRep |
Since: base-4.10.0.0 |
Defined in Data.Typeable.Internal |
|
Show () |
Since: base-2.1 |
Show TyCon |
Since: base-2.1 |
Show Module |
Since: base-4.9.0.0 |
Show TrName |
Since: base-4.9.0.0 |
Show KindRep | |
Show TypeLitSort |
Since: base-4.11.0.0 |
Show Handle |
Since: base-4.1.0.0 |
Show ThreadId |
Since: base-4.2.0.0 |
Show AsyncCancelled | |
Defined in Control.Concurrent.Async |
|
Show ExceptionInLinkedThread | |
Defined in Control.Concurrent.Async |
|
Show Void |
Since: base-4.8.0.0 |
Show StaticPtrInfo |
Since: base-4.8.0.0 |
Defined in GHC.StaticPtr |
|
Show PatternMatchFail |
Since: base-4.0 |
Defined in Control.Exception.Base |
|
Show RecSelError |
Since: base-4.0 |
Defined in Control.Exception.Base |
|
Show RecConError |
Since: base-4.0 |
Defined in Control.Exception.Base |
|
Show RecUpdError |
Since: base-4.0 |
Defined in Control.Exception.Base |
|
Show NoMethodError |
Since: base-4.0 |
Defined in Control.Exception.Base |
|
Show TypeError |
Since: base-4.9.0.0 |
Show NonTermination |
Since: base-4.0 |
Defined in Control.Exception.Base |
|
Show NestedAtomically |
Since: base-4.0 |
Defined in Control.Exception.Base |
|
Show BlockReason |
Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync |
|
Show ThreadStatus |
Since: base-4.3.0.0 |
Defined in GHC.Conc.Sync |
|
Show CDev | |
Show CIno | |
Show CMode | |
Show COff | |
Show CPid | |
Show CSsize | |
Show CGid | |
Show CNlink | |
Show CUid | |
Show CCc | |
Show CSpeed | |
Show CTcflag | |
Show CRLim | |
Show CBlkSize | |
Show CBlkCnt | |
Show CClockId | |
Show CFsBlkCnt | |
Show CFsFilCnt | |
Show CId | |
Show CKey | |
Show CSocklen | |
Show CNfds | |
Show Fd | |
Show BlockedIndefinitelyOnMVar |
Since: base-4.1.0.0 |
Defined in GHC.IO.Exception |
|
Show BlockedIndefinitelyOnSTM |
Since: base-4.1.0.0 |
Defined in GHC.IO.Exception |
|
Show Deadlock |
Since: base-4.1.0.0 |
Show AllocationLimitExceeded |
Since: base-4.7.1.0 |
Defined in GHC.IO.Exception |
|
Show CompactionFailed |
Since: base-4.10.0.0 |
Defined in GHC.IO.Exception |
|
Show AssertionFailed |
Since: base-4.1.0.0 |
Defined in GHC.IO.Exception |
|
Show SomeAsyncException |
Since: base-4.7.0.0 |
Defined in GHC.IO.Exception |
|
Show AsyncException |
Since: base-4.1.0.0 |
Defined in GHC.IO.Exception |
|
Show ArrayException |
Since: base-4.1.0.0 |
Defined in GHC.IO.Exception |
|
Show FixIOException |
Since: base-4.11.0.0 |
Defined in GHC.IO.Exception |
|
Show ExitCode | |
Show IOErrorType |
Since: base-4.1.0.0 |
Defined in GHC.IO.Exception |
|
Show HandleType |
Since: base-4.1.0.0 |
Defined in GHC.IO.Handle.Types |
|
Show BufferMode |
Since: base-4.2.0.0 |
Defined in GHC.IO.Handle.Types |
|
Show Newline |
Since: base-4.3.0.0 |
Show NewlineMode |
Since: base-4.3.0.0 |
Defined in GHC.IO.Handle.Types |
|
Show MaskingState |
Since: base-4.3.0.0 |
Show IOException |
Since: base-4.1.0.0 |
Defined in GHC.IO.Exception |
|
Show ErrorCall |
Since: base-4.0.0.0 |
Show ArithException |
Since: base-4.0.0.0 |
Defined in GHC.Exception.Type |
|
Show All |
Since: base-2.1 |
Show Any |
Since: base-2.1 |
Show Fixity |
Since: base-4.6.0.0 |
Show Associativity |
Since: base-4.6.0.0 |
Defined in GHC.Generics |
|
Show SourceUnpackedness |
Since: base-4.9.0.0 |
Defined in GHC.Generics |
|
Show SourceStrictness |
Since: base-4.9.0.0 |
Defined in GHC.Generics |
|
Show DecidedStrictness |
Since: base-4.9.0.0 |
Defined in GHC.Generics |
|
Show SomeSymbol |
Since: base-4.7.0.0 |
Defined in GHC.TypeLits |
|
Show SomeNat |
Since: base-4.7.0.0 |
Show CChar | |
Show CSChar | |
Show CUChar | |
Show CShort | |
Show CUShort | |
Show CInt | |
Show CUInt | |
Show CLong | |
Show CULong | |
Show CLLong | |
Show CULLong | |
Show CBool | |
Show CFloat | |
Show CDouble | |
Show CPtrdiff | |
Show CSize | |
Show CWchar | |
Show CSigAtomic | |
Defined in Foreign.C.Types |
|
Show CClock | |
Show CTime | |
Show CUSeconds | |
Show CSUSeconds | |
Defined in Foreign.C.Types |
|
Show CIntPtr | |
Show CUIntPtr | |
Show CIntMax | |
Show CUIntMax | |
Show WordPtr | |
Show IntPtr | |
Show IOMode |
Since: base-4.2.0.0 |
Show Lexeme |
Since: base-2.1 |
Show Number |
Since: base-4.6.0.0 |
Show GeneralCategory |
Since: base-2.1 |
Defined in GHC.Unicode |
|
Show SrcLoc |
Since: base-4.9.0.0 |
Show SomeException |
Since: base-3.0 |
Defined in GHC.Exception.Type |
|
Show ByteString | |
Defined in Data.ByteString.Lazy.Internal |
|
Show ByteString | |
Defined in Data.ByteString.Internal |
|
Show IntSet | |
Show Decoding | |
Show UnicodeException | |
Defined in Data.Text.Encoding.Error |
|
Show CodePoint | |
Show DecoderState | |
Show Leniency Source # | |
Show FatalError Source # | |
Defined in Protolude.Panic |
|
Show a => Show [a] |
Since: base-2.1 |
Show a => Show ( Maybe a) |
Since: base-2.1 |
Show a => Show ( Ratio a) |
Since: base-2.0.1 |
Show ( Ptr a) |
Since: base-2.1 |
Show ( FunPtr a) |
Since: base-2.1 |
Show p => Show ( Par1 p) |
Since: base-4.7.0.0 |
Show a => Show ( Complex a) |
Since: base-2.1 |
Show a => Show ( Min a) |
Since: base-4.9.0.0 |
Show a => Show ( Max a) |
Since: base-4.9.0.0 |
Show a => Show ( First a) |
Since: base-4.9.0.0 |
Show a => Show ( Last a) |
Since: base-4.9.0.0 |
Show m => Show ( WrappedMonoid m) |
Since: base-4.9.0.0 |
Defined in Data.Semigroup |
|
Show a => Show ( Option a) |
Since: base-4.9.0.0 |
Show a => Show ( ZipList a) |
Since: base-4.7.0.0 |
Show a => Show ( Identity a) |
This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 |
Show a => Show ( First a) |
Since: base-2.1 |
Show a => Show ( Last a) |
Since: base-2.1 |
Show a => Show ( Dual a) |
Since: base-2.1 |
Show a => Show ( Sum a) |
Since: base-2.1 |
Show a => Show ( Product a) |
Since: base-2.1 |
Show a => Show ( Down a) |
This instance would be equivalent to the derived instances of the
Since: base-4.7.0.0 |
Show a => Show ( NonEmpty a) |
Since: base-4.11.0.0 |
Show a => Show ( IntMap a) | |
Show a => Show ( Seq a) | |
Show a => Show ( ViewL a) | |
Show a => Show ( ViewR a) | |
Show a => Show ( Set a) | |
Show a => Show ( Hashed a) | |
( Show a, Show b) => Show ( Either a b) |
Since: base-3.0 |
Show ( V1 p) |
Since: base-4.9.0.0 |
Show ( U1 p) |
Since: base-4.9.0.0 |
Show ( TypeRep a) | |
( Show a, Show b) => Show (a, b) |
Since: base-2.1 |
Show ( ST s a) |
Since: base-2.1 |
( Ix a, Show a, Show b) => Show ( Array a b) |
Since: base-2.1 |
( Show a, Show b) => Show ( Arg a b) |
Since: base-4.9.0.0 |
Show ( Proxy s) |
Since: base-4.7.0.0 |
( Show k, Show a) => Show ( Map k a) | |
( Show1 m, Show a) => Show ( ListT m a) | |
( Show1 m, Show a) => Show ( MaybeT m a) | |
Show (f p) => Show ( Rec1 f p) |
Since: base-4.7.0.0 |
Show ( URec Char p) |
Since: base-4.9.0.0 |
Show ( URec Double p) |
Since: base-4.9.0.0 |
Show ( URec Float p) | |
Show ( URec Int p) |
Since: base-4.9.0.0 |
Show ( URec Word p) |
Since: base-4.9.0.0 |
( Show a, Show b, Show c) => Show (a, b, c) |
Since: base-2.1 |
Show a => Show ( Const a b) |
This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 |
Show (f a) => Show ( Ap f a) |
Since: base-4.12.0.0 |
Show (f a) => Show ( Alt f a) |
Since: base-4.8.0.0 |
Show ( Coercion a b) |
Since: base-4.7.0.0 |
Show (a :~: b) |
Since: base-4.7.0.0 |
( Show1 f, Show a) => Show ( IdentityT f a) | |
( Show e, Show1 m, Show a) => Show ( ErrorT e m a) | |
( Show e, Show1 m, Show a) => Show ( ExceptT e m a) | |
( Show w, Show1 m, Show a) => Show ( WriterT w m a) | |
( Show w, Show1 m, Show a) => Show ( WriterT w m a) | |
Show c => Show ( K1 i c p) |
Since: base-4.7.0.0 |
( Show (f p), Show (g p)) => Show ((f :+: g) p) |
Since: base-4.7.0.0 |
( Show (f p), Show (g p)) => Show ((f :*: g) p) |
Since: base-4.7.0.0 |
( Show a, Show b, Show c, Show d) => Show (a, b, c, d) |
Since: base-2.1 |
( Show1 f, Show1 g, Show a) => Show ( Product f g a) |
Since: base-4.9.0.0 |
( Show1 f, Show1 g, Show a) => Show ( Sum f g a) |
Since: base-4.9.0.0 |
Show (a :~~: b) |
Since: base-4.10.0.0 |
Show (f p) => Show ( M1 i c f p) |
Since: base-4.7.0.0 |
Show (f (g p)) => Show ((f :.: g) p) |
Since: base-4.7.0.0 |
( Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) |
Since: base-2.1 |
( Show1 f, Show1 g, Show a) => Show ( Compose f g a) |
Since: base-4.9.0.0 |
( Show a, Show b, Show c, Show d, Show e, Show f) => Show (a, b, c, d, e, f) |
Since: base-2.1 |
( Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (a, b, c, d, e, f, g) |
Since: base-2.1 |
( Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) => Show (a, b, c, d, e, f, g, h) |
Since: base-2.1 |
( Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) => Show (a, b, c, d, e, f, g, h, i) |
Since: base-2.1 |
( Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) => Show (a, b, c, d, e, f, g, h, i, j) |
Since: base-2.1 |
( Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) => Show (a, b, c, d, e, f, g, h, i, j, k) |
Since: base-2.1 |
( Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) => Show (a, b, c, d, e, f, g, h, i, j, k, l) |
Since: base-2.1 |
( Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m) |
Since: base-2.1 |
( Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n) |
Since: base-2.1 |
( Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) |
Since: base-2.1 |
class KnownNat (n :: Nat ) Source #
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
class KnownSymbol (n :: Symbol ) Source #
This class gives the string associated with a type-level symbol. There are instances of the class for every concrete literal: "hello", etc.
Since: base-4.7.0.0
symbolSing
class HasField (x :: k) r a | x r -> a where Source #
Constraint representing the fact that the field
x
belongs to
the record type
r
and has field type
a
. This will be solved
automatically, but manual instances may be provided as well.
Instances
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
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.
Instances
Eq Double |
Note that due to the presence of
Also note that
|
Floating Double |
Since: base-2.1 |
Defined in GHC.Float exp :: Double -> Double Source # log :: Double -> Double Source # sqrt :: Double -> Double Source # (**) :: Double -> Double -> Double Source # logBase :: Double -> Double -> Double Source # sin :: Double -> Double Source # cos :: Double -> Double Source # tan :: Double -> Double Source # asin :: Double -> Double Source # acos :: Double -> Double Source # atan :: Double -> Double Source # sinh :: Double -> Double Source # cosh :: Double -> Double Source # tanh :: Double -> Double Source # asinh :: Double -> Double Source # acosh :: Double -> Double Source # atanh :: Double -> Double Source # log1p :: Double -> Double Source # expm1 :: Double -> Double Source # |
|
Ord Double |
Note that due to the presence of
Also note that, due to the same,
|
Read Double |
Since: base-2.1 |
RealFloat Double |
Since: base-2.1 |
Defined in GHC.Float floatRadix :: Double -> Integer Source # floatDigits :: Double -> Int Source # floatRange :: Double -> ( Int , Int ) Source # decodeFloat :: Double -> ( Integer , Int ) Source # encodeFloat :: Integer -> Int -> Double Source # exponent :: Double -> Int Source # significand :: Double -> Double Source # scaleFloat :: Int -> Double -> Double Source # isNaN :: Double -> Bool Source # isInfinite :: Double -> Bool Source # isDenormalized :: Double -> Bool Source # isNegativeZero :: Double -> Bool Source # |
|
Storable Double |
Since: base-2.1 |
Defined in Foreign.Storable sizeOf :: Double -> Int Source # alignment :: Double -> Int Source # peekElemOff :: Ptr Double -> Int -> IO Double Source # pokeElemOff :: Ptr Double -> Int -> Double -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Double Source # pokeByteOff :: Ptr b -> Int -> Double -> IO () Source # |
|
NFData Double | |
Defined in Control.DeepSeq |
|
Hashable Double |
Note
: prior to
The
Since: hashable-1.3.0.0 |
Generic1 ( URec Double :: k -> Type ) |
Since: base-4.9.0.0 |
Foldable ( UDouble :: Type -> Type ) |
Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => UDouble m -> m Source # foldMap :: Monoid m => (a -> m) -> UDouble a -> m Source # foldMap' :: Monoid m => (a -> m) -> UDouble a -> m Source # foldr :: (a -> b -> b) -> b -> UDouble a -> b Source # foldr' :: (a -> b -> b) -> b -> UDouble a -> b Source # foldl :: (b -> a -> b) -> b -> UDouble a -> b Source # foldl' :: (b -> a -> b) -> b -> UDouble a -> b Source # foldr1 :: (a -> a -> a) -> UDouble a -> a Source # foldl1 :: (a -> a -> a) -> UDouble a -> a Source # toList :: UDouble a -> [a] Source # null :: UDouble a -> Bool Source # length :: UDouble a -> Int Source # elem :: Eq a => a -> UDouble a -> Bool Source # maximum :: Ord a => UDouble a -> a Source # minimum :: Ord a => UDouble a -> a Source # |
|
Traversable ( UDouble :: Type -> Type ) |
Since: base-4.9.0.0 |
Defined in Data.Traversable |
|
Functor ( URec Double :: Type -> Type ) |
Since: base-4.9.0.0 |
Eq ( URec Double 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 Source # (<) :: URec Double p -> URec Double p -> Bool Source # (<=) :: URec Double p -> URec Double p -> Bool Source # (>) :: URec Double p -> URec Double p -> Bool Source # (>=) :: URec Double p -> URec Double p -> Bool Source # max :: URec Double p -> URec Double p -> URec Double p Source # min :: URec Double p -> URec Double p -> URec Double p Source # |
|
Show ( URec Double p) |
Since: base-4.9.0.0 |
Generic ( URec Double p) |
Since: base-4.9.0.0 |
data URec Double (p :: k) |
Used for marking occurrences of
Since: base-4.9.0.0 |
type Rep1 ( URec Double :: k -> Type ) | |
Defined in GHC.Generics |
|
type Rep ( URec Double p) | |
Defined in GHC.Generics |
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.
Instances
Eq Float |
Note that due to the presence of
Also note that
|
Floating Float |
Since: base-2.1 |
Defined in GHC.Float exp :: Float -> Float Source # log :: Float -> Float Source # sqrt :: Float -> Float Source # (**) :: Float -> Float -> Float Source # logBase :: Float -> Float -> Float Source # sin :: Float -> Float Source # cos :: Float -> Float Source # tan :: Float -> Float Source # asin :: Float -> Float Source # acos :: Float -> Float Source # atan :: Float -> Float Source # sinh :: Float -> Float Source # cosh :: Float -> Float Source # tanh :: Float -> Float Source # asinh :: Float -> Float Source # acosh :: Float -> Float Source # atanh :: Float -> Float Source # log1p :: Float -> Float Source # expm1 :: Float -> Float Source # |
|
Ord Float |
Note that due to the presence of
Also note that, due to the same,
|
Defined in GHC.Classes |
|
Read Float |
Since: base-2.1 |
RealFloat Float |
Since: base-2.1 |
Defined in GHC.Float floatRadix :: Float -> Integer Source # floatDigits :: Float -> Int Source # floatRange :: Float -> ( Int , Int ) Source # decodeFloat :: Float -> ( Integer , Int ) Source # encodeFloat :: Integer -> Int -> Float Source # exponent :: Float -> Int Source # significand :: Float -> Float Source # scaleFloat :: Int -> Float -> Float Source # isNaN :: Float -> Bool Source # isInfinite :: Float -> Bool Source # isDenormalized :: Float -> Bool Source # isNegativeZero :: Float -> Bool Source # |
|
Storable Float |
Since: base-2.1 |
Defined in Foreign.Storable sizeOf :: Float -> Int Source # alignment :: Float -> Int Source # peekElemOff :: Ptr Float -> Int -> IO Float Source # pokeElemOff :: Ptr Float -> Int -> Float -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Float Source # pokeByteOff :: Ptr b -> Int -> Float -> IO () Source # |
|
NFData Float | |
Defined in Control.DeepSeq |
|
Hashable Float |
Note
: prior to
The
Since: hashable-1.3.0.0 |
Generic1 ( URec Float :: k -> Type ) |
Since: base-4.9.0.0 |
Foldable ( UFloat :: Type -> Type ) |
Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => UFloat m -> m Source # foldMap :: Monoid m => (a -> m) -> UFloat a -> m Source # foldMap' :: Monoid m => (a -> m) -> UFloat a -> m Source # foldr :: (a -> b -> b) -> b -> UFloat a -> b Source # foldr' :: (a -> b -> b) -> b -> UFloat a -> b Source # foldl :: (b -> a -> b) -> b -> UFloat a -> b Source # foldl' :: (b -> a -> b) -> b -> UFloat a -> b Source # foldr1 :: (a -> a -> a) -> UFloat a -> a Source # foldl1 :: (a -> a -> a) -> UFloat a -> a Source # toList :: UFloat a -> [a] Source # null :: UFloat a -> Bool Source # length :: UFloat a -> Int Source # elem :: Eq a => a -> UFloat a -> Bool Source # maximum :: Ord a => UFloat a -> a Source # minimum :: Ord a => UFloat a -> a Source # |
|
Traversable ( UFloat :: Type -> Type ) |
Since: base-4.9.0.0 |
Defined in Data.Traversable |
|
Functor ( URec Float :: Type -> Type ) |
Since: base-4.9.0.0 |
Eq ( URec Float p) | |
Ord ( URec Float p) | |
Defined in GHC.Generics compare :: URec Float p -> URec Float p -> Ordering Source # (<) :: URec Float p -> URec Float p -> Bool Source # (<=) :: URec Float p -> URec Float p -> Bool Source # (>) :: URec Float p -> URec Float p -> Bool Source # (>=) :: URec Float p -> URec Float p -> Bool Source # max :: URec Float p -> URec Float p -> URec Float p Source # min :: URec Float p -> URec Float p -> URec Float p Source # |
|
Show ( URec Float p) | |
Generic ( URec Float p) | |
data URec Float (p :: k) |
Used for marking occurrences of
Since: base-4.9.0.0 |
type Rep1 ( URec Float :: k -> Type ) | |
Defined in GHC.Generics |
|
type Rep ( URec Float p) | |
Defined in GHC.Generics |
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
minBound
and
maxBound
from the
Bounded
class.
Instances
Bounded Int |
Since: base-2.1 |
Enum Int |
Since: base-2.1 |
Eq Int | |
Integral Int |
Since: base-2.0.1 |
Num Int |
Since: base-2.1 |
Ord Int | |
Read Int |
Since: base-2.1 |
Real Int |
Since: base-2.0.1 |
Show Int |
Since: base-2.1 |
Ix Int |
Since: base-2.1 |
Storable Int |
Since: base-2.1 |
Bits Int |
Since: base-2.1 |
Defined in Data.Bits (.&.) :: Int -> Int -> Int Source # (.|.) :: Int -> Int -> Int Source # xor :: Int -> Int -> Int Source # complement :: Int -> Int Source # shift :: Int -> Int -> Int Source # rotate :: Int -> Int -> Int Source # setBit :: Int -> Int -> Int Source # clearBit :: Int -> Int -> Int Source # complementBit :: Int -> Int -> Int Source # testBit :: Int -> Int -> Bool Source # bitSizeMaybe :: Int -> Maybe Int Source # bitSize :: Int -> Int Source # isSigned :: Int -> Bool Source # shiftL :: Int -> Int -> Int Source # unsafeShiftL :: Int -> Int -> Int Source # shiftR :: Int -> Int -> Int Source # unsafeShiftR :: Int -> Int -> Int Source # rotateL :: Int -> Int -> Int Source # |
|
FiniteBits Int |
Since: base-4.6.0.0 |
NFData Int | |
Defined in Control.DeepSeq |
|
Hashable Int | |
Generic1 ( URec Int :: k -> Type ) |
Since: base-4.9.0.0 |
Foldable ( UInt :: Type -> Type ) |
Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => UInt m -> m Source # foldMap :: Monoid m => (a -> m) -> UInt a -> m Source # foldMap' :: Monoid m => (a -> m) -> UInt a -> m Source # foldr :: (a -> b -> b) -> b -> UInt a -> b Source # foldr' :: (a -> b -> b) -> b -> UInt a -> b Source # foldl :: (b -> a -> b) -> b -> UInt a -> b Source # foldl' :: (b -> a -> b) -> b -> UInt a -> b Source # foldr1 :: (a -> a -> a) -> UInt a -> a Source # foldl1 :: (a -> a -> a) -> UInt a -> a Source # toList :: UInt a -> [a] Source # null :: UInt a -> Bool Source # length :: UInt a -> Int Source # elem :: Eq a => a -> UInt a -> Bool Source # maximum :: Ord a => UInt a -> a Source # minimum :: Ord a => UInt a -> a Source # |
|
Traversable ( UInt :: Type -> Type ) |
Since: base-4.9.0.0 |
Functor ( URec Int :: Type -> Type ) |
Since: base-4.9.0.0 |
Eq ( URec Int p) |
Since: base-4.9.0.0 |
Ord ( URec Int p) |
Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: URec Int p -> URec Int p -> Ordering Source # (<) :: URec Int p -> URec Int p -> Bool Source # (<=) :: URec Int p -> URec Int p -> Bool Source # (>) :: URec Int p -> URec Int p -> Bool Source # (>=) :: URec Int p -> URec Int p -> Bool Source # |
|
Show ( URec Int p) |
Since: base-4.9.0.0 |
Generic ( URec Int p) |
Since: base-4.9.0.0 |
data URec Int (p :: k) |
Used for marking occurrences of
Since: base-4.9.0.0 |
type Rep1 ( URec Int :: k -> Type ) | |
Defined in GHC.Generics |
|
type Rep ( URec Int p) | |
Defined in GHC.Generics |
Arbitrary precision integers. In contrast with fixed-size integral types
such as
Int
, the
Integer
type represents the entire infinite range of
integers.
For more information about this type's representation, see the comments in its implementation.
Instances
Instances
Rational numbers, with numerator and denominator of some
Integral
type.
Note that
Ratio
's instances inherit the deficiencies from the type
parameter's. For example,
Ratio Natural
's
Num
instance has similar
problems to
Natural
's.
Instances
NFData1 Ratio |
Available on
Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq |
|
Integral a => Enum ( Ratio a) |
Since: base-2.0.1 |
Defined in GHC.Real succ :: Ratio a -> Ratio a Source # pred :: Ratio a -> Ratio a Source # toEnum :: Int -> Ratio a Source # fromEnum :: Ratio a -> Int Source # enumFrom :: Ratio a -> [ Ratio a] Source # enumFromThen :: Ratio a -> Ratio a -> [ Ratio a] Source # enumFromTo :: Ratio a -> Ratio a -> [ Ratio a] Source # enumFromThenTo :: Ratio a -> Ratio a -> Ratio a -> [ Ratio a] Source # |
|
Eq a => Eq ( Ratio a) |
Since: base-2.1 |
Integral a => Fractional ( Ratio a) |
Since: base-2.0.1 |
Integral a => Num ( Ratio a) |
Since: base-2.0.1 |
Defined in GHC.Real |
|
Integral a => Ord ( Ratio a) |
Since: base-2.0.1 |
( Integral a, Read a) => Read ( Ratio a) |
Since: base-2.1 |
Integral a => Real ( Ratio a) |
Since: base-2.0.1 |
Integral a => RealFrac ( Ratio a) |
Since: base-2.0.1 |
Show a => Show ( Ratio a) |
Since: base-2.0.1 |
( Storable a, Integral a) => Storable ( Ratio a) |
Since: base-4.8.0.0 |
Defined in Foreign.Storable sizeOf :: Ratio a -> Int Source # alignment :: Ratio a -> Int Source # peekElemOff :: Ptr ( Ratio a) -> Int -> IO ( Ratio a) Source # pokeElemOff :: Ptr ( Ratio a) -> Int -> Ratio a -> IO () Source # peekByteOff :: Ptr b -> Int -> IO ( Ratio a) Source # pokeByteOff :: Ptr b -> Int -> Ratio a -> IO () Source # |
|
NFData a => NFData ( Ratio a) | |
Defined in Control.DeepSeq |
|
Hashable a => Hashable ( Ratio a) | |
A value of type
is a computation which, when performed,
does some I/O before returning a value of type
IO
a
a
.
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
Monad IO |
Since: base-2.1 |
Functor IO |
Since: base-2.1 |
MonadFail IO |
Since: base-4.9.0.0 |
Applicative IO |
Since: base-2.1 |
MonadIO IO |
Since: base-4.9.0.0 |
Alternative IO |
Since: base-4.9.0.0 |
MonadPlus IO |
Since: base-4.9.0.0 |
MonadError IOException IO | |
Defined in Control.Monad.Error.Class throwError :: IOException -> IO a Source # catchError :: IO a -> ( IOException -> IO a) -> IO a Source # |
|
Semigroup a => Semigroup ( IO a) |
Since: base-4.10.0.0 |
Monoid a => Monoid ( IO a) |
Since: base-4.9.0.0 |
Instances
Bounded Word |
Since: base-2.1 |
Enum Word |
Since: base-2.1 |
Eq Word | |
Integral Word |
Since: base-2.1 |
Defined in GHC.Real |
|
Num Word |
Since: base-2.1 |
Ord Word | |
Read Word |
Since: base-4.5.0.0 |
Real Word |
Since: base-2.1 |
Show Word |
Since: base-2.1 |
Ix Word |
Since: base-4.6.0.0 |
Defined in GHC.Ix |
|
Storable Word |
Since: base-2.1 |
Defined in Foreign.Storable sizeOf :: Word -> Int Source # alignment :: Word -> Int Source # peekElemOff :: Ptr Word -> Int -> IO Word Source # pokeElemOff :: Ptr Word -> Int -> Word -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Word Source # pokeByteOff :: Ptr b -> Int -> Word -> IO () Source # |
|
Bits Word |
Since: base-2.1 |
Defined in Data.Bits (.&.) :: Word -> Word -> Word Source # (.|.) :: Word -> Word -> Word Source # xor :: Word -> Word -> Word Source # complement :: Word -> Word Source # shift :: Word -> Int -> Word Source # rotate :: Word -> Int -> Word Source # setBit :: Word -> Int -> Word Source # clearBit :: Word -> Int -> Word Source # complementBit :: Word -> Int -> Word Source # testBit :: Word -> Int -> Bool Source # bitSizeMaybe :: Word -> Maybe Int Source # bitSize :: Word -> Int Source # isSigned :: Word -> Bool Source # shiftL :: Word -> Int -> Word Source # unsafeShiftL :: Word -> Int -> Word Source # shiftR :: Word -> Int -> Word Source # unsafeShiftR :: Word -> Int -> Word Source # rotateL :: Word -> Int -> Word Source # |
|
FiniteBits Word |
Since: base-4.6.0.0 |
NFData Word | |
Defined in Control.DeepSeq |
|
Hashable Word | |
Generic1 ( URec Word :: k -> Type ) |
Since: base-4.9.0.0 |
Foldable ( UWord :: Type -> Type ) |
Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => UWord m -> m Source # foldMap :: Monoid m => (a -> m) -> UWord a -> m Source # foldMap' :: Monoid m => (a -> m) -> UWord a -> m Source # foldr :: (a -> b -> b) -> b -> UWord a -> b Source # foldr' :: (a -> b -> b) -> b -> UWord a -> b Source # foldl :: (b -> a -> b) -> b -> UWord a -> b Source # foldl' :: (b -> a -> b) -> b -> UWord a -> b Source # foldr1 :: (a -> a -> a) -> UWord a -> a Source # foldl1 :: (a -> a -> a) -> UWord a -> a Source # toList :: UWord a -> [a] Source # null :: UWord a -> Bool Source # length :: UWord a -> Int Source # elem :: Eq a => a -> UWord a -> Bool Source # maximum :: Ord a => UWord a -> a Source # minimum :: Ord a => UWord a -> a Source # |
|
Traversable ( UWord :: Type -> Type ) |
Since: base-4.9.0.0 |
Functor ( URec Word :: Type -> Type ) |
Since: base-4.9.0.0 |
Eq ( URec Word p) |
Since: base-4.9.0.0 |
Ord ( URec Word p) |
Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: URec Word p -> URec Word p -> Ordering Source # (<) :: URec Word p -> URec Word p -> Bool Source # (<=) :: URec Word p -> URec Word p -> Bool Source # (>) :: URec Word p -> URec Word p -> Bool Source # (>=) :: URec Word p -> URec Word p -> Bool Source # |
|
Show ( URec Word p) |
Since: base-4.9.0.0 |
Generic ( URec Word p) |
Since: base-4.9.0.0 |
data URec Word (p :: k) |
Used for marking occurrences of
Since: base-4.9.0.0 |
type Rep1 ( URec Word :: k -> Type ) | |
Defined in GHC.Generics |
|
type Rep ( URec Word p) | |
Defined in GHC.Generics |
A value of type
represents a pointer to an object, or an
array of objects, which may be marshalled to or from Haskell values
of type
Ptr
a
a
.
The type
a
will often be an instance of class
Storable
which provides the marshalling operations.
However this is not essential, and you can provide your own operations
to access the pointer. For example you might write small foreign
functions to get or set the fields of a C
struct
.
Instances
NFData1 Ptr |
Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq |
|
Generic1 ( URec ( Ptr ()) :: k -> Type ) |
Since: base-4.9.0.0 |
Eq ( Ptr a) |
Since: base-2.1 |
Ord ( Ptr a) |
Since: base-2.1 |
Defined in GHC.Ptr |
|
Show ( Ptr a) |
Since: base-2.1 |
Foldable ( UAddr :: Type -> Type ) |
Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => UAddr m -> m Source # foldMap :: Monoid m => (a -> m) -> UAddr a -> m Source # foldMap' :: Monoid m => (a -> m) -> UAddr a -> m Source # foldr :: (a -> b -> b) -> b -> UAddr a -> b Source # foldr' :: (a -> b -> b) -> b -> UAddr a -> b Source # foldl :: (b -> a -> b) -> b -> UAddr a -> b Source # foldl' :: (b -> a -> b) -> b -> UAddr a -> b Source # foldr1 :: (a -> a -> a) -> UAddr a -> a Source # foldl1 :: (a -> a -> a) -> UAddr a -> a Source # toList :: UAddr a -> [a] Source # null :: UAddr a -> Bool Source # length :: UAddr a -> Int Source # elem :: Eq a => a -> UAddr a -> Bool Source # maximum :: Ord a => UAddr a -> a Source # minimum :: Ord a => UAddr a -> a Source # |
|
Traversable ( UAddr :: Type -> Type ) |
Since: base-4.9.0.0 |
Storable ( Ptr a) |
Since: base-2.1 |
Defined in Foreign.Storable sizeOf :: Ptr a -> Int Source # alignment :: Ptr a -> Int Source # peekElemOff :: Ptr ( Ptr a) -> Int -> IO ( Ptr a) Source # pokeElemOff :: Ptr ( Ptr a) -> Int -> Ptr a -> IO () Source # peekByteOff :: Ptr b -> Int -> IO ( Ptr a) Source # pokeByteOff :: Ptr b -> Int -> Ptr a -> IO () Source # |
|
NFData ( Ptr a) |
Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq |
|
Hashable ( Ptr a) | |
Functor ( URec ( Ptr ()) :: Type -> Type ) |
Since: base-4.9.0.0 |
Eq ( URec ( Ptr ()) p) |
Since: base-4.9.0.0 |
Ord ( URec ( Ptr ()) p) |
Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: URec ( Ptr ()) p -> URec ( Ptr ()) p -> Ordering Source # (<) :: URec ( Ptr ()) p -> URec ( Ptr ()) p -> Bool Source # (<=) :: URec ( Ptr ()) p -> URec ( Ptr ()) p -> Bool Source # (>) :: URec ( Ptr ()) p -> URec ( Ptr ()) p -> Bool Source # (>=) :: URec ( Ptr ()) p -> URec ( Ptr ()) p -> Bool Source # max :: URec ( Ptr ()) p -> URec ( Ptr ()) p -> URec ( Ptr ()) p Source # min :: URec ( Ptr ()) p -> URec ( Ptr ()) p -> URec ( Ptr ()) p Source # |
|
Generic ( URec ( Ptr ()) p) |
Since: base-4.9.0.0 |
data URec ( Ptr ()) (p :: k) |
Used for marking occurrences of
Since: base-4.9.0.0 |
type Rep1 ( URec ( Ptr ()) :: k -> Type ) | |
Defined in GHC.Generics |
|
type Rep ( URec ( Ptr ()) p) | |
Defined in GHC.Generics |
A value of type
is a pointer to a function callable
from foreign code. The type
FunPtr
a
a
will normally be a
foreign type
,
a function type with zero or more arguments where
-
the argument types are
marshallable foreign types
,
i.e.
Char
,Int
,Double
,Float
,Bool
,Int8
,Int16
,Int32
,Int64
,Word8
,Word16
,Word32
,Word64
,Ptr
aFunPtr
aStablePtr
anewtype
. -
the return type is either a marshallable foreign type or has the form
IO
tt
is a marshallable foreign type or()
.
A value of type
may be a pointer to a foreign function,
either returned by another foreign function or imported with a
a static address import like
FunPtr
a
foreign import ccall "stdlib.h &free" p_free :: FunPtr (Ptr a -> IO ())
or a pointer to a Haskell function created using a
wrapper
stub
declared to produce a
FunPtr
of the correct type. For example:
type Compare = Int -> Int -> Bool foreign import ccall "wrapper" mkCompare :: Compare -> IO (FunPtr Compare)
Calls to wrapper stubs like
mkCompare
allocate storage, which
should be released with
freeHaskellFunPtr
when no
longer required.
To convert
FunPtr
values to corresponding Haskell functions, one
can define a
dynamic
stub for the specific foreign type, e.g.
type IntFunction = CInt -> IO () foreign import ccall "dynamic" mkFun :: FunPtr IntFunction -> IntFunction
Instances
NFData1 FunPtr |
Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq |
|
Eq ( FunPtr a) | |
Ord ( FunPtr a) | |
Defined in GHC.Ptr |
|
Show ( FunPtr a) |
Since: base-2.1 |
Storable ( FunPtr a) |
Since: base-2.1 |
Defined in Foreign.Storable sizeOf :: FunPtr a -> Int Source # alignment :: FunPtr a -> Int Source # peekElemOff :: Ptr ( FunPtr a) -> Int -> IO ( FunPtr a) Source # pokeElemOff :: Ptr ( FunPtr a) -> Int -> FunPtr a -> IO () Source # peekByteOff :: Ptr b -> Int -> IO ( FunPtr a) Source # pokeByteOff :: Ptr b -> Int -> FunPtr a -> IO () Source # |
|
NFData ( FunPtr a) |
Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq |
|
Hashable ( FunPtr a) | |
data Constraint Source #
The kind of constraints, like
Show a
(Kind) This is the kind of type-level symbols. Declared here because class IP needs it
Instances
SingKind Symbol |
Since: base-4.9.0.0 |
Defined in GHC.Generics type DemoteRep Symbol |
|
KnownSymbol a => SingI (a :: Symbol ) |
Since: base-4.9.0.0 |
Defined in GHC.Generics sing :: Sing a |
|
type DemoteRep Symbol | |
Defined in GHC.Generics |
|
data Sing (s :: Symbol ) | |
Defined in GHC.Generics |
type family CmpNat (a :: Nat ) (b :: Nat ) :: Ordering where ... Source #
Comparison of type-level naturals, as a function.
Since: base-4.7.0.0
class a ~R# b => Coercible (a :: k) (b :: k) Source #
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
A reference to a value of type
a
.
Instances
IsStatic StaticPtr |
Since: base-4.9.0.0 |
Defined in GHC.StaticPtr fromStaticPtr :: StaticPtr a -> StaticPtr a Source # |
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
showStackTrace :: IO ( Maybe String ) Source #
Get a string representation of the current execution stack state.
getStackTrace :: IO ( Maybe [ Location ]) Source #
Get a trace of the current execution stack state.
Returns
Nothing
if stack trace support isn't available on host machine.
Location information about an address from a backtrace.
Location | |
|
withFrozenCallStack :: HasCallStack => ( HasCallStack => a) -> a Source #
Perform some computation without adding new entries to the
CallStack
.
Since: base-4.9.0.0
callStack :: HasCallStack => CallStack Source #
someSymbolVal :: String -> SomeSymbol Source #
Convert a string into an unknown type-level symbol.
Since: base-4.7.0.0
someNatVal :: Integer -> Maybe SomeNat Source #
Convert an integer into an unknown type-level natural.
Since: base-4.7.0.0
symbolVal :: forall (n :: Symbol ) proxy. KnownSymbol n => proxy n -> String Source #
Since: base-4.7.0.0
data SomeSymbol Source #
This type represents unknown type-level symbols.
KnownSymbol n => SomeSymbol ( Proxy n) |
Since: base-4.7.0.0 |
Instances
Eq SomeSymbol |
Since: base-4.7.0.0 |
Defined in GHC.TypeLits (==) :: SomeSymbol -> SomeSymbol -> Bool Source # (/=) :: SomeSymbol -> SomeSymbol -> Bool Source # |
|
Ord SomeSymbol |
Since: base-4.7.0.0 |
Defined in GHC.TypeLits compare :: SomeSymbol -> SomeSymbol -> Ordering Source # (<) :: SomeSymbol -> SomeSymbol -> Bool Source # (<=) :: SomeSymbol -> SomeSymbol -> Bool Source # (>) :: SomeSymbol -> SomeSymbol -> Bool Source # (>=) :: SomeSymbol -> SomeSymbol -> Bool Source # max :: SomeSymbol -> SomeSymbol -> SomeSymbol Source # min :: SomeSymbol -> SomeSymbol -> SomeSymbol Source # |
|
Read SomeSymbol |
Since: base-4.7.0.0 |
Defined in GHC.TypeLits readsPrec :: Int -> ReadS SomeSymbol Source # readList :: ReadS [ SomeSymbol ] Source # readPrec :: ReadPrec SomeSymbol Source # readListPrec :: ReadPrec [ SomeSymbol ] Source # |
|
Show SomeSymbol |
Since: base-4.7.0.0 |
Defined in GHC.TypeLits |
This type represents unknown type-level natural numbers.
Since: base-4.10.0.0
Instances
Eq SomeNat |
Since: base-4.7.0.0 |
Ord SomeNat |
Since: base-4.7.0.0 |
Read SomeNat |
Since: base-4.7.0.0 |
Show SomeNat |
Since: base-4.7.0.0 |
showFloat :: RealFloat a => a -> ShowS Source #
Show a signed
RealFloat
value to full precision
using standard decimal notation for arguments whose absolute value lies
between
0.1
and
9,999,999
, and scientific notation otherwise.
integralEnumFromThenTo :: Integral a => a -> a -> a -> [a] Source #
integralEnumFromTo :: Integral a => a -> a -> [a] Source #
integralEnumFromThen :: ( Integral a, Bounded a) => a -> a -> [a] Source #
integralEnumFrom :: ( Integral a, Bounded a) => a -> [a] Source #
lcm :: Integral a => a -> a -> a Source #
is the smallest positive integer that both
lcm
x y
x
and
y
divide.
gcd :: Integral a => a -> a -> a Source #
is the non-negative factor of both
gcd
x y
x
and
y
of which
every common factor of
x
and
y
is also a factor; for example
,
gcd
4 2 = 2
,
gcd
(-4) 6 = 2
=
gcd
0 4
4
.
=
gcd
0 0
0
.
(That is, the common divisor that is "greatest" in the divisibility
preordering.)
Note: Since for signed fixed-width integer types,
,
the result may be negative if one of the arguments is
abs
minBound
< 0
(and
necessarily is if the other is
minBound
0
or
) for such types.
minBound
(^^) :: ( Fractional a, Integral b) => a -> b -> a infixr 8 Source #
raise a number to an integral power
(^) :: ( Num a, Integral b) => a -> b -> a infixr 8 Source #
raise a number to a non-negative integral power
:: Real a | |
=> (a -> ShowS ) |
a function that can show unsigned values |
-> Int |
the precedence of the enclosing context |
-> a |
the value to show |
-> ShowS |
Converts a possibly-negative
Real
value to a string.
numericEnumFromThenTo :: ( Ord a, Fractional a) => a -> a -> a -> [a] Source #
numericEnumFromTo :: ( Ord a, Fractional a) => a -> a -> [a] Source #
numericEnumFromThen :: Fractional a => a -> a -> [a] Source #
numericEnumFrom :: Fractional a => a -> [a] Source #
denominator :: Ratio a -> a Source #
Extract the denominator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.
numerator :: Ratio a -> a Source #
Extract the numerator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.
reduce :: Integral a => a -> a -> Ratio a Source #
reduce
is a subsidiary function used only in this module.
It normalises a ratio by dividing both numerator and denominator by
their greatest common divisor.
ratioPrec1 :: Int Source #
underflowError :: a Source #
overflowError :: a Source #
divZeroError :: a Source #
boundedEnumFromThen :: ( Enum a, Bounded a) => a -> a -> [a] Source #
boundedEnumFrom :: ( Enum a, Bounded a) => a -> [a] Source #
currentCallStack :: IO [ String ] Source #
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
until :: (a -> Bool ) -> (a -> a) -> a -> a Source #
yields the result of applying
until
p f
f
until
p
holds.
getCallStack :: CallStack -> [([ Char ], SrcLoc )] Source #
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 Source #
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