From cd3b37adebca99138fad1acca37908183036ace9 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Mon, 16 Mar 2015 00:15:05 +0100 Subject: Initial commit, can create and name 5 minute timers, can toggle running state --- src/Model/IdGenerator.elm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/Model/IdGenerator.elm (limited to 'src/Model/IdGenerator.elm') 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 } + ) -- cgit v1.2.3