blob: f3eefad5a5ab11c9cc4273882db8a9e13140294d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module Model.IdGenerator exposing
( IdGenerator
, initialIdGenerator
, getId
)
import Model.Id exposing (..)
type alias IdGenerator =
{ counter : Id
}
initialIdGenerator =
{ counter = 1
}
getId : IdGenerator -> (Id, IdGenerator)
getId idGenerator =
( idGenerator.counter
, { idGenerator | counter = idGenerator.counter + 1 }
)
|