aboutsummaryrefslogtreecommitdiff
path: root/src/float.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'src/float.gleam')
-rw-r--r--src/float.gleam13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/float.gleam b/src/float.gleam
new file mode 100644
index 0000000..2d3ca3c
--- /dev/null
+++ b/src/float.gleam
@@ -0,0 +1,13 @@
+import iodata
+
+pub enum NotAFloat =
+ | NotAFloat
+
+pub external fn parse(String) -> Result(Float, NotAFloat) =
+ "gleam__stdlib" "parse_float";
+
+pub fn to_string(f) {
+ f
+ |> iodata:from_float
+ |> iodata:to_string
+}