From 442d732696ad431b84f6e5c72b6ee785be4fd968 Mon Sep 17 00:00:00 2001 From: adelon <22380201+adelon@users.noreply.github.com> Date: Sat, 10 Feb 2024 02:22:14 +0100 Subject: Initial commit --- source/Serial.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 source/Serial.hs (limited to 'source/Serial.hs') 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) -- cgit v1.2.3