Hoogle Search
Within LTS Haskell 24.42 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
readInt64 :: ByteString -> Maybe (Int64, ByteString)bytestring Data.ByteString.Lazy.Char8 readInt8 :: ByteString -> Maybe (Int8, ByteString)bytestring Data.ByteString.Lazy.Char8 readInteger :: ByteString -> Maybe (Integer, ByteString)bytestring Data.ByteString.Lazy.Char8 readInteger reads an Integer from the beginning of the ByteString. If there is no Integer at the beginning of the string, it returns Nothing, otherwise it just returns the Integer read, and the rest of the string. readInteger does not ignore leading whitespace, the value must start immediately at the beginning of the input string.
Examples
>>> readInteger "-000111222333444555666777888999 all done" Just (-111222333444555666777888999," all done") >>> readInteger "+1: readInteger also accepts a leading '+'" Just (1, ": readInteger also accepts a leading '+'") >>> readInteger "not a decimal number" Nothing
readNatural :: ByteString -> Maybe (Natural, ByteString)bytestring Data.ByteString.Lazy.Char8 readNatural reads a Natural number from the beginning of the ByteString. If there is no Natural number at the beginning of the string, it returns Nothing, otherwise it just returns the number read, and the rest of the string. readNatural does not ignore leading whitespace, the value must start with a decimal digit immediately at the beginning of the input string. Leading + signs are not accepted.
Examples
>>> readNatural "000111222333444555666777888999 all done" Just (111222333444555666777888999," all done") >>> readNatural "+000111222333444555666777888999 explicit sign" Nothing >>> readNatural "not a decimal number" Nothing
readWord :: ByteString -> Maybe (Word, ByteString)bytestring Data.ByteString.Lazy.Char8 Try to read a Word value from the ByteString, returning Just (val, str) on success, where val is the value read and str is the rest of the input string. If the sequence of digits decodes to a value larger than can be represented by a Word, the returned value will be Nothing. readWord does not ignore leading whitespace, the value must start with a decimal digit immediately at the beginning of the input string. Leading + signs are not accepted.
Examples
>>> readWord "1729 sum of cubes" Just (1729," sum of cubes") >>> readWord "+1729 has an explicit sign" Nothing >>> readWord "not a decimal number" Nothing >>> readWord "98765432109876543210 overflows maxBound" Nothing
readWord16 :: ByteString -> Maybe (Word16, ByteString)bytestring Data.ByteString.Lazy.Char8 readWord32 :: ByteString -> Maybe (Word32, ByteString)bytestring Data.ByteString.Lazy.Char8 readWord64 :: ByteString -> Maybe (Word64, ByteString)bytestring Data.ByteString.Lazy.Char8 readWord8 :: ByteString -> Maybe (Word8, ByteString)bytestring Data.ByteString.Lazy.Char8 readFile :: FilePath -> IO Texttext Data.Text.IO The readFile function reads a file and returns the contents of the file as a string. The entire file is read strictly, as with getContents. Beware that this function (similarly to readFile) is locale-dependent. Unexpected system locale may cause your application to read corrupted data or throw runtime exceptions about "invalid argument (invalid byte sequence)" or "invalid argument (invalid character)". This is also slow, because GHC first converts an entire input to UTF-32, which is afterwards converted to UTF-8. If your data is UTF-8, using decodeUtf8 . readFile is a much faster and safer alternative.