:: String -> Int -package:hledger-lib -package:speculate -package:express -package:dbus -package:ViennaRNAParser -package:base

Panics and asserts.
Panics and asserts.
Panics and asserts.
The function unsafeCoerce# allows you to side-step the typechecker entirely. That is, it allows you to coerce any type into any other type. If you use this function, you had better get it right, otherwise segmentation faults await. It is generally used when you want to write a program that you know is well-typed, but where Haskell's type system is not expressive enough to prove that it is well typed. The following uses of unsafeCoerce# are supposed to work (i.e. not lead to spurious compile-time or run-time crashes):
  • Casting any lifted type to Any
  • Casting Any back to the real type
  • Casting an unboxed type to another unboxed type of the same size. (Casting between floating-point and integral types does not work. See the GHC.Float module for functions to do work.)
  • Casting between two types that have the same runtime representation. One case is when the two types differ only in "phantom" type parameters, for example Ptr Int to Ptr Float, or [Int] to [Float] when the list is known to be empty. Also, a newtype of a type T has the same representation at runtime as T.
Other uses of unsafeCoerce# are undefined. In particular, you should not use unsafeCoerce# to cast a T to an algebraic data type D, unless T is also an algebraic data type. For example, do not cast Int->Int to Bool, even if you later cast that Bool back to Int->Int before applying it. The reasons have to do with GHC's internal representation details (for the cognoscenti, data values can be entered but function closures cannot). If you want a safe type to cast things to, use Any, which is not an algebraic data type. Warning: this can fail with an unchecked exception.
Warning: this can fail with an unchecked exception.
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.
a constant function, returning the number of digits of floatRadix in the significand
exponent corresponds to the second component of decodeFloat. exponent 0 = 0 and for finite nonzero x, exponent x = snd (decodeFloat x) + floatDigits x. If x is a finite floating-point number, it is equal in value to significand x * b ^^ exponent x, where b is the floating-point radix. The behaviour is unspecified on infinite or NaN values.
The read function reads input from a string, which must be completely consumed by the input process. read fails with an error if the parse is unsuccessful, and it is therefore discouraged from being used in real applications. Use readMaybe or readEither for safe alternatives.
>>> read "123" :: Int
123
>>> read "hello" :: Int
*** Exception: Prelude.read: no parse
Return the number of bits in the type of the argument. The actual value of the argument is ignored. The function bitSize is undefined for types that do not have a fixed bitsize, like Integer. Default implementation based upon bitSizeMaybe provided since 4.12.0.0.
Return the number of set bits in the argument. This number is known as the population count or the Hamming weight. Can be implemented using popCountDefault if a is also an instance of Num.
Return the number of bits in the type of the argument. The actual value of the argument is ignored. Moreover, finiteBitSize is total, in contrast to the deprecated bitSize function it replaces.
finiteBitSize = bitSize
bitSizeMaybe = Just . finiteBitSize
Count number of zero bits preceding the most significant set bit.
countLeadingZeros (zeroBits :: a) = finiteBitSize (zeroBits :: a)
countLeadingZeros can be used to compute log base 2 via
logBase2 x = finiteBitSize x - 1 - countLeadingZeros x
Note: The default implementation for this method is intentionally naive. However, the instances provided for the primitive integral types are implemented using CPU specific machine instructions.
Count number of zero bits following the least significant set bit.
countTrailingZeros (zeroBits :: a) = finiteBitSize (zeroBits :: a)
countTrailingZeros . negate = countTrailingZeros
The related find-first-set operation can be expressed in terms of countTrailingZeros as follows
findFirstSet x = 1 + countTrailingZeros x
Note: The default implementation for this method is intentionally naive. However, the instances provided for the primitive integral types are implemented using CPU specific machine instructions.
Computes the storage requirements (in bytes) of the argument. The value of the argument is not used.
Computes the alignment constraint of the argument. An alignment constraint x is fulfilled by any address divisible by x. The value of the argument is not used.
The number of days in this period.
Like hashWithSalt, but no salt is used. The default implementation uses hashWithSalt with some default salt. Instances might want to implement this method to provide a more efficient implementation than the default implementation.