Parsley provides conversions between OCaml's numeric types (float, int32, int64, native) while indicating if a loss of precision occured during the conversion. It uses the Result module of OCaml to do that as in the following example:
You can build locally the documentation by typing make doc
or consult the online documentation.
Parsley parses the string using arbitrary precision integers and rationals (using the Zarith library) and compares the result it obtains with the one obtained by OCaml's standard of_string utilities (int_of_string, float_of_string ...)
You can use Parsley's functionnalities on your OCaml source code using the ppx that goes with the library. It generates pretty warning messages using OCaml's warning styles as in the following examples.
- Zarith: https://github.com/ocaml/Zarith
- OCaml >= 4.08
This Library is distributed under the terms of the MIT license. See the LICENSE.md file for details.