Skip to content

Std\Convert

Lawful total conversions, checked numeric conversions, and strict parsing.

Generic dispatch is target-witness directed: convert "" 42, tryConvert 0 1.0, and parse 0 "42". The named helpers below make common concrete conversions concise while retaining the same trait contracts.

parseInt : String -> Result (Int, ParseError)

Section titled “parseInt : String -> Result (Int, ParseError)”

parseFloat : String -> Result (Float, ParseError)

Section titled “parseFloat : String -> Result (Float, ParseError)”

parseBool : String -> Result (Bool, ParseError)

Section titled “parseBool : String -> Result (Bool, ParseError)”

parseString : String -> Result (String, ParseError)

Section titled “parseString : String -> Result (String, ParseError)”

intToFloat : Int -> Result (Float, ConvertError)

Section titled “intToFloat : Int -> Result (Float, ConvertError)”

floatToInt : Float -> Result (Int, ConvertError)

Section titled “floatToInt : Float -> Result (Int, ConvertError)”

decodeUtf8 : ByteArray -> Result (String, ConvertError)

Section titled “decodeUtf8 : ByteArray -> Result (String, ConvertError)”