aboutsummaryrefslogtreecommitdiff
path: root/src/Model/IdGenerator.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/Model/IdGenerator.elm')
-rw-r--r--src/Model/IdGenerator.elm21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Model/IdGenerator.elm b/src/Model/IdGenerator.elm
new file mode 100644
index 0000000..8bce44f
--- /dev/null
+++ b/src/Model/IdGenerator.elm
@@ -0,0 +1,21 @@
+module Model.IdGenerator
+ ( IdGenerator
+ , initialIdGenerator
+ , getId
+ ) where
+
+import Model.Id (..)
+
+type alias IdGenerator =
+ { counter : Id
+ }
+
+initialIdGenerator =
+ { counter = 0
+ }
+
+getId : IdGenerator -> (Id, IdGenerator)
+getId idGenerator =
+ ( idGenerator.counter
+ , { idGenerator | counter <- idGenerator.counter + 1 }
+ )