aboutsummaryrefslogtreecommitdiff
path: root/src/std/atom.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'src/std/atom.gleam')
-rw-r--r--src/std/atom.gleam17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/std/atom.gleam b/src/std/atom.gleam
new file mode 100644
index 0000000..67d040d
--- /dev/null
+++ b/src/std/atom.gleam
@@ -0,0 +1,17 @@
+pub external type Atom;
+
+pub enum AtomNotLoaded =
+ | AtomNotLoaded
+
+pub external fn from_string(String) -> Result(Atom, AtomNotLoaded) =
+ "gleam__stdlib" "atom_from_string";
+
+// This function can create a new atom if one does not already exist for
+// the given string. Atoms are not garbage collected so this can result
+// in a memory leak if called over time on new values
+//
+pub external fn create_from_string(String) -> Atom =
+ "gleam__stdlib" "atom_create_from_string";
+
+pub external fn to_string(Atom) -> String =
+ "gleam__stdlib" "atom_to_string";