Module Numeric

Library with some functions for reading and converting numeric tokens.

Author: Michael Hanus, Frank Huch, Bjoern Peemoeller

Version: November 2016

Summary of exported operations:

readInt :: String -> [(Int,String)]  Deterministic 
Read a (possibly negative) integer as a first token in a string.
readNat :: String -> [(Int,String)]  Deterministic 
Read a natural number as a first token in a string.
readHex :: String -> [(Int,String)]  Deterministic 
Read a hexadecimal number as a first token in a string.
readOct :: String -> [(Int,String)]  Deterministic 
Read an octal number as a first token in a string.
readBin :: String -> [(Int,String)]  Deterministic 
Read a binary number as a first token in a string.

Exported operations:

readInt :: String -> [(Int,String)]  Deterministic 

Read a (possibly negative) integer as a first token in a string. The string might contain leadings blanks and the integer is read up to the first non-digit. On success returns [(v,s)], where v is the value of the integer and s is the remaing string without the integer token.

readNat :: String -> [(Int,String)]  Deterministic 

Read a natural number as a first token in a string. The string might contain leadings blanks and the number is read up to the first non-digit. On success returns [(v,s)], where v is the value of the number and s is the remaing string without the number token.

readHex :: String -> [(Int,String)]  Deterministic 

Read a hexadecimal number as a first token in a string. The string might contain leadings blanks and the number is read up to the first non-hexadecimal digit. On success returns [(v,s)], where v is the value of the number and s is the remaing string without the number token.

readOct :: String -> [(Int,String)]  Deterministic 

Read an octal number as a first token in a string. The string might contain leadings blanks and the number is read up to the first non-octal digit. On success returns [(v,s)], where v is the value of the number and s is the remaing string without the number token.

readBin :: String -> [(Int,String)]  Deterministic 

Read a binary number as a first token in a string. The string might contain leadings blanks and the number is read up to the first non-binary digit. On success returns [(v,s)], where v is the value of the number and s is the remaing string without the number token.