summaryrefslogtreecommitdiff
path: root/src/Id.hs
blob: adc7e2e4cd7bdf69a988f3250e795f358afe055f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Id
( newId,
  nextId
) where

{- 
 -
 - Écrit par Hédy GIRAUDEAU
 - 27/07/17
 -
-}

import Data.IORef
import Data.Functor

type Id_number a = IORef a

newId = (newIORef 0)
nextId cnt = modifyIORef cnt (+1) >> (+0) <$> readIORef cnt