summaryrefslogtreecommitdiff
path: root/src/Id.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Id.hs')
-rw-r--r--src/Id.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Id.hs b/src/Id.hs
new file mode 100644
index 0000000..adc7e2e
--- /dev/null
+++ b/src/Id.hs
@@ -0,0 +1,19 @@
+module Id
+( newId,
+ nextId
+) where
+
+{-
+ -
+ - Écrit par Hédy GIRAUDEAU
+ - 27/07/17
+ -
+-}
+
+import Data.IORef
+import Data.Functor
+
+type Id_number a = IORef a
+
+newId = (newIORef 0)
+nextId cnt = modifyIORef cnt (+1) >> (+0) <$> readIORef cnt