summaryrefslogtreecommitdiff
path: root/source/Serial.hs
diff options
context:
space:
mode:
Diffstat (limited to 'source/Serial.hs')
-rw-r--r--source/Serial.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/Serial.hs b/source/Serial.hs
new file mode 100644
index 0000000..5836afd
--- /dev/null
+++ b/source/Serial.hs
@@ -0,0 +1,18 @@
+module Serial (Serial, start, next) where
+
+import Data.Eq
+import Data.Hashable
+import Data.Ord
+import GHC.Generics as Export (Generic(..))
+import Numeric.Natural
+import Prelude (Num(..))
+import Text.Show
+
+
+newtype Serial = Serial Natural deriving (Show, Eq, Ord, Generic, Hashable)
+
+start :: Serial
+start = Serial 0
+
+next :: Serial -> Serial
+next (Serial k) = Serial (k + 1)