repa-array-4.1.0.1: Bulk array representations and operators.

Safe HaskellNone
LanguageHaskell98

Data.Repa.Array.Auto.Convert

Contents

Synopsis

Int Conversion

readIntFromOffset :: Array Char -> Int -> Maybe (Int, Int) Source

Try to read an Int from the given offset in an array.

If the conversion succeeded then you get the value, along with the index of the next character, otherwise Nothing.

readIntFromOffset# :: Array Char -> Int# -> (#Int#, Int#, Int##) Source

Unboxed version of readIntFromOffset.

We still pay to unbox the input array, but avoid boxing the result by construction.

Double Conversion

Read and Show Doubles for a reasonable runtime cost.

readDouble :: Array Char -> Double Source

Convert a foreign vector of characters to a Double.

  • The standard Haskell Char type is four bytes in length. If you already have a vector of Word8 then use readDoubleFromBytes instead to avoid the conversion.

readDoubleFromBytes :: Array Word8 -> Double Source

Convert a foreign vector of bytes to a Double.

showDouble :: Double -> Array Char Source

Convert a Double to ASCII text packed into a foreign Vector.

showDoubleAsBytes :: Double -> Array Word8 Source

Convert a Double to ASCII text packed into a foreign Vector.

showDoubleFixed :: Int -> Double -> Array Char Source

Like showDouble, but use a fixed number of digits after the decimal point.

showDoubleFixedAsBytes :: Int -> Double -> Array Word8 Source

Like showDoubleAsBytes, but use a fixed number of digits after the decimal point.