Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Read functions.
- reads_to_read_precise :: ReadS t -> String -> Maybe t
- reads_to_read_precise_err :: String -> ReadS t -> String -> t
- read_maybe :: Read a => String -> Maybe a
- read_def :: Read a => a -> String -> a
- read_err :: Read a => String -> a
- reads_exact :: Read a => String -> Maybe a
- reads_exact_err :: Read a => String -> String -> a
- read_integral_allow_commas_maybe :: Read i => String -> Maybe i
- read_integral_allow_commas_err :: (Integral i, Read i) => String -> i
- read_int_allow_commas :: String -> Int
- read_ratio_with_div_err :: (Integral i, Read i) => String -> Ratio i
- read_ratio_allow_commas_err :: (Integral i, Read i) => String -> String -> Ratio i
- delete_trailing_point :: String -> String
- read_fractional_allow_trailing_point_err :: Read n => String -> n
- read_maybe_int :: String -> Maybe Int
- read_int :: String -> Int
- read_maybe_double :: String -> Maybe Double
- read_double :: String -> Double
- read_maybe_rational :: String -> Maybe Rational
- read_rational :: String -> Rational
- read_hex_err :: (Eq n, Num n) => String -> n
Documentation
reads_to_read_precise_err :: String -> ReadS t -> String -> t Source #
Error variant of reads_to_read_precise
.
read_maybe :: Read a => String -> Maybe a Source #
reads_to_read_precise
of reads
.
space character.
read_def :: Read a => a -> String -> a Source #
Variant of read_maybe
with default value.
map (read_def 0) ["2","2:","2\n"] == [2,0,2]
reads_exact :: Read a => String -> Maybe a Source #
Variant of reads
requiring exact match, no trailing white space.
map reads_exact ["1.5","2,5"] == [Just 1.5,Nothing]
reads_exact_err :: Read a => String -> String -> a Source #
Variant of reads_exact
that errors on failure.
Type specific variants
read_integral_allow_commas_maybe :: Read i => String -> Maybe i Source #
Allow commas as thousand separators.
let r = [Just 123456,Just 123456,Nothing,Just 123456789] in map read_integral_allow_commas_maybe ["123456","123,456","1234,56","123,456,789"]
read_int_allow_commas :: String -> Int Source #
read_ratio_with_div_err :: (Integral i, Read i) => String -> Ratio i Source #
Read a ratio where the division is given by /
instead of %
and the integers allow commas.
map read_ratio_with_div_err ["123,456/7","123,456,789"] == [123456/7,123456789]
read_ratio_allow_commas_err :: (Integral i, Read i) => String -> String -> Ratio i Source #
Read Ratio
, allow commas for thousand separators.
read_ratio_allow_commas_err "327,680" "177,147" == 327680 / 177147
read_fractional_allow_trailing_point_err :: Read n => String -> n Source #
read_err
disallows trailing decimal points.
map read_fractional_allow_trailing_point_err ["123.","123.4"] == [123.0,123.4]
Plain type specialisations
read_maybe_int :: String -> Maybe Int Source #
Type specialised read_maybe
.
map read_maybe_int ["2","2:","2\n"] == [Just 2,Nothing,Just 2]
read_maybe_double :: String -> Maybe Double Source #
Type specialised read_maybe
.
read_maybe_rational :: String -> Maybe Rational Source #
Type specialised read_maybe
.
map read_maybe_rational ["1","1%2","1/2"] == [Nothing,Just (1/2),Nothing]