ghcjs-base-0.2.0.0: base library for GHCJS

Safe HaskellNone
LanguageHaskell98

Data.JSString.Read

Synopsis

Documentation

isInteger :: JSString -> Bool Source #

Returns whether the JSString represents an integer at base 10

isNatural :: JSString -> Bool Source #

Returns whether the JSString represents a natural number at base 10 (including 0)

readInt :: JSString -> Int Source #

Convert a JSString to an Int, throwing an exception if it cannot be converted. Leading spaces and trailing non-digit characters are not allowed.

readIntMaybe :: JSString -> Maybe Int Source #

Convert a JSString to an Int, returning Nothing if it cannot be converted. Leading spaces and trailing non-digit characters are not allowed.

lenientReadInt :: JSString -> Int Source #

Convert a JSString to an Int, throwing an exception if it cannot be converted. Leading spaces are allowed. The function ignores trailing non-digit characters.

readDouble :: JSString -> Double Source #

Convert a JSString to an Int, throwing an exception if it cannot be converted. Leading spaces are allowed. The function ignores trailing non-digit characters.

readDoubleMaybe :: JSString -> Maybe Double Source #

Convert a JSString to a Double, returning Nothing if it cannot be converted. Leading spaces are allowed. The function ignores trailing non-digit characters.