aboutsummaryrefslogtreecommitdiff
path: root/src/Model/IdGenerator.elm
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-16 00:15:05 +0100
committerJoris Guyonvarch2015-03-16 00:15:05 +0100
commitcd3b37adebca99138fad1acca37908183036ace9 (patch)
treed566ae0564d82ab94901e4deda98f36abd22ad2d /src/Model/IdGenerator.elm
Initial commit, can create and name 5 minute timers, can toggle running state
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 }
+ )