diff options
Diffstat (limited to 'src/Id.hs')
-rw-r--r-- | src/Id.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Id.hs b/src/Id.hs new file mode 100644 index 0000000..adc7e2e --- /dev/null +++ b/src/Id.hs @@ -0,0 +1,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 |