blob: 90011914ca1c342a191d8bc5a171573623ef6a53 (
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 exposing (..)
type alias IdGenerator =
{ counter : Id
}
initialIdGenerator =
{ counter = 1
}
getId : IdGenerator -> (Id, IdGenerator)
getId idGenerator =
( idGenerator.counter
, { idGenerator | counter <- idGenerator.counter + 1 }
)
|