Hoogle Search

Within LTS Haskell 24.32 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. readUnalignedByteArray :: (PrimMonad m, PrimUnaligned a, Bytes a) => MutableByteArray (PrimState m) -> Int -> m a

    byte-order Data.Primitive.ByteArray.LittleEndian

    Read a primitive value from the byte array, interpreting the first byte as the least significant one. The offset is given in bytes rather than in elements of type a.

  2. readOffPtr :: (PrimMonad m, Prim a, Bytes a) => Ptr a -> Int -> m a

    byte-order Data.Primitive.Ptr.BigEndian

    Read a primitive value from the pointer, interpreting the first byte as the most significant one. The offset is given in elements of type a rather than in bytes.

  3. readDecimal :: Fractional a => ByteString -> Maybe (a, ByteString)

    bytestring-lexing Data.ByteString.Lex.Fractional

    Read an unsigned/non-negative fractional value in ASCII decimal format; that is, anything matching the regex \d+(\.\d+)?. Returns Nothing if there is no such number at the beginning of the string, otherwise returns Just the number read and the remainder of the string. N.B., see readDecimalLimited if your fractional type has limited precision and you expect your inputs to have greater precision than can be represented. Even for types with unlimited precision (e.g., Rational), you may want to check out readDecimalLimited.

  4. readDecimalLimited :: Fractional a => Int -> ByteString -> Maybe (a, ByteString)

    bytestring-lexing Data.ByteString.Lex.Fractional

    A variant of readDecimal which only reads up to some limited precision. The first argument gives the number of decimal digits at which to limit the precision. For types with inherently limited precision (e.g., Float and Double), when you pass in the precision limit (cf., decimalPrecision) this is far more efficient than readDecimal. However, passing in a precision limit which is greater than the type's inherent limitation will degrate performance compared to readDecimal. For types with unlimited precision (e.g., Rational) this may still be far more efficient than readDecimal (it is for Rational, in fact). The reason being that it delays the scaling the significand/mantissa by the exponent, thus allowing you to further adjust the exponent before computing the final value (e.g., as in readExponentialLimited). This avoids the need to renormalize intermediate results, and allows faster computation of the scaling factor by doing it all at once.

  5. readExponential :: Fractional a => ByteString -> Maybe (a, ByteString)

    bytestring-lexing Data.ByteString.Lex.Fractional

    Read an unsigned/non-negative fractional value in ASCII exponential format; that is, anything matching the regex \d+(\.\d+)?([eE][\+\-]?\d+)?. Returns Nothing if there is no such number at the beginning of the string, otherwise returns Just the number read and the remainder of the string. N.B., the current implementation assumes the exponent is small enough to fit into an Int. This gives a significant performance increase for a ~ Float and a ~ Double and agrees with the RealFloat class which has exponent returning an Int. If you need a larger exponent, contact the maintainer. N.B., see readExponentialLimited if your fractional type has limited precision and you expect your inputs to have greater precision than can be represented. Even for types with unlimited precision, you may want to check out readExponentialLimited.

  6. readExponentialLimited :: Fractional a => Int -> ByteString -> Maybe (a, ByteString)

    bytestring-lexing Data.ByteString.Lex.Fractional

    A variant of readExponential which only reads up to some limited precision. The first argument gives the number of decimal digits at which to limit the precision. See readDecimalLimited for more discussion of the performance benefits of using this function.

  7. readHexadecimal :: Fractional a => ByteString -> Maybe (a, ByteString)

    bytestring-lexing Data.ByteString.Lex.Fractional

    Read a non-negative integral value in ASCII hexadecimal format. Returns Nothing if there is no integer at the beginning of the string, otherwise returns Just the integer read and the remainder of the string. This function does not recognize the various hexadecimal sigils like "0x", but because there are so many different variants, those are best handled by helper functions which then use this function for the actual numerical parsing. This function recognizes both upper-case, lower-case, and mixed-case hexadecimal. This is just a thin wrapper around readHexadecimal.

  8. readOctal :: Fractional a => ByteString -> Maybe (a, ByteString)

    bytestring-lexing Data.ByteString.Lex.Fractional

    Read a non-negative integral value in ASCII octal format. Returns Nothing if there is no integer at the beginning of the string, otherwise returns Just the integer read and the remainder of the string. This function does not recognize the various octal sigils like "0o", but because there are different variants, those are best handled by helper functions which then use this function for the actual numerical parsing. This is just a thin wrapper around readOctal.

  9. readSigned :: Num a => (ByteString -> Maybe (a, ByteString)) -> ByteString -> Maybe (a, ByteString)

    bytestring-lexing Data.ByteString.Lex.Fractional

    Adjust a reading function to recognize an optional leading sign. As with the other functions, we assume an ASCII-compatible encoding of the sign characters.

  10. readDecimal :: Integral a => ByteString -> Maybe (a, ByteString)

    bytestring-lexing Data.ByteString.Lex.Integral

    Read an unsigned/non-negative integral value in ASCII decimal format. Returns Nothing if there is no integer at the beginning of the string, otherwise returns Just the integer read and the remainder of the string. If you are extremely concerned with performance, then it is more performant to use this function at Int or Word and then to call fromIntegral to perform the conversion at the end. However, doing this will make your code succeptible to overflow bugs if the target type is larger than Int.

Page 220 of many | Previous | Next