diff options
| author | adelon <22380201+adelon@users.noreply.github.com> | 2024-02-10 02:22:14 +0100 |
|---|---|---|
| committer | adelon <22380201+adelon@users.noreply.github.com> | 2024-02-10 02:22:14 +0100 |
| commit | 442d732696ad431b84f6e5c72b6ee785be4fd968 (patch) | |
| tree | b476f395e7e91d67bacb6758bc84914b8711593f /source/Serial.hs | |
Initial commit
Diffstat (limited to 'source/Serial.hs')
| -rw-r--r-- | source/Serial.hs | 18 |
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) |
