blob: 8bce44f0042855c2b480d6127d47b75362eb1748 (
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
( 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 }
)
|