diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,11 @@
 # Revision history for cborg
 
+## 0.2.10.0
+
+* Return `TypeUInt64` and `TypeNInt64` from `tokenType` when appropriate, fixing [#324](https://github.com/well-typed/cborg/issues/324)
+* Don't rely on `MonadFail Gen`
+* Support for GHC 9.8
+
 ## 0.2.9.0
 
 * Fix build with `base >= 4.17` on platforms without unaligned memory operations.
diff --git a/cborg.cabal b/cborg.cabal
--- a/cborg.cabal
+++ b/cborg.cabal
@@ -1,5 +1,5 @@
 name:                cborg
-version:             0.2.9.0
+version:             0.2.10.0
 synopsis:            Concise Binary Object Representation (CBOR)
 license:             BSD3
 license-file:        LICENSE.txt
@@ -90,14 +90,14 @@
 
   build-depends:
     array                   >= 0.4     && < 0.6,
-    base                    >= 4.11    && < 4.19,
-    bytestring              >= 0.10.4  && < 0.12,
-    containers              >= 0.5     && < 0.7,
-    deepseq                 >= 1.0     && < 1.5,
-    ghc-prim                >= 0.3.1.0 && < 0.11,
+    base                    >= 4.11    && < 4.20,
+    bytestring              >= 0.10.4  && < 0.13,
+    containers              >= 0.5     && < 0.8,
+    deepseq                 >= 1.0     && < 1.6,
+    ghc-prim                >= 0.3.1.0 && < 0.12,
     half                    >= 0.2.2.3 && < 0.4,
-    primitive               >= 0.5     && < 0.9,
-    text                    >= 1.1     && < 1.3 || >= 2.0 && <2.1
+    primitive               >= 0.5     && < 0.10,
+    text                    >= 1.1     && < 1.3 || >= 2.0 && <2.2
 
   if flag(optimize-gmp)
     cpp-options:            -DOPTIMIZE_GMP
@@ -148,21 +148,21 @@
 
   build-depends:
     array                   >= 0.4     && < 0.6,
-    base                    >= 4.11    && < 4.19,
+    base                    >= 4.11    && < 4.20,
     base-orphans,
-    bytestring              >= 0.10.4  && < 0.12,
-    text                    >= 1.1     && < 2.1,
-    primitive               >= 0.5     && < 0.9,
+    bytestring              >= 0.10.4  && < 0.13,
+    text                    >= 1.1     && < 2.2,
+    primitive               >= 0.5     && < 0.10,
     cborg,
-    aeson                   >= 0.7     && < 2.2,
+    aeson                   >= 0.7     && < 2.3,
     base64-bytestring       >= 1.0     && < 1.3,
     base16-bytestring       >= 1.0     && < 1.1,
-    deepseq                 >= 1.0     && < 1.5,
+    deepseq                 >= 1.0     && < 1.6,
     half                    >= 0.2.2.3 && < 0.4,
     QuickCheck              >= 2.9     && < 2.15,
     random,
     scientific              >= 0.3     && < 0.4,
-    tasty                   >= 0.11    && < 1.5,
+    tasty                   >= 0.11    && < 1.6,
     tasty-hunit             >= 0.9     && < 0.11,
     tasty-quickcheck        >= 0.8     && < 0.11,
     vector                  >= 0.10    && < 0.14
diff --git a/src/Codec/CBOR/FlatTerm.hs b/src/Codec/CBOR/FlatTerm.hs
--- a/src/Codec/CBOR/FlatTerm.hs
+++ b/src/Codec/CBOR/FlatTerm.hs
@@ -562,25 +562,28 @@
 -- | Map a 'TermToken' to the underlying CBOR 'TokenType'
 tokenTypeOf :: TermToken -> TokenType
 tokenTypeOf (TkInt n)
-    | n >= 0                = TypeUInt
-    | otherwise             = TypeNInt
-tokenTypeOf TkInteger{}     = TypeInteger
-tokenTypeOf TkBytes{}       = TypeBytes
-tokenTypeOf TkBytesBegin{}  = TypeBytesIndef
-tokenTypeOf TkString{}      = TypeString
-tokenTypeOf TkStringBegin{} = TypeStringIndef
-tokenTypeOf TkListLen{}     = TypeListLen
-tokenTypeOf TkListBegin{}   = TypeListLenIndef
-tokenTypeOf TkMapLen{}      = TypeMapLen
-tokenTypeOf TkMapBegin{}    = TypeMapLenIndef
-tokenTypeOf TkTag{}         = TypeTag
-tokenTypeOf TkBool{}        = TypeBool
-tokenTypeOf TkNull          = TypeNull
-tokenTypeOf TkBreak         = TypeBreak
-tokenTypeOf TkSimple{}      = TypeSimple
-tokenTypeOf TkFloat16{}     = TypeFloat16
-tokenTypeOf TkFloat32{}     = TypeFloat32
-tokenTypeOf TkFloat64{}     = TypeFloat64
+    | n >= 0                          = TypeUInt
+    | otherwise                       = TypeNInt
+tokenTypeOf (TkInteger n)   -- See https://github.com/well-typed/cborg/issues/324
+  | 0 <= n && n <= 0xffffffffffffffff = TypeUInt64 -- 0xffffffffffffffff == 2^64 - 1
+  | -0xffffffffffffffff <= n && n < 0 = TypeNInt64
+  | otherwise                         = TypeInteger
+tokenTypeOf TkBytes{}                 = TypeBytes
+tokenTypeOf TkBytesBegin{}            = TypeBytesIndef
+tokenTypeOf TkString{}                = TypeString
+tokenTypeOf TkStringBegin{}           = TypeStringIndef
+tokenTypeOf TkListLen{}               = TypeListLen
+tokenTypeOf TkListBegin{}             = TypeListLenIndef
+tokenTypeOf TkMapLen{}                = TypeMapLen
+tokenTypeOf TkMapBegin{}              = TypeMapLenIndef
+tokenTypeOf TkTag{}                   = TypeTag
+tokenTypeOf TkBool{}                  = TypeBool
+tokenTypeOf TkNull                    = TypeNull
+tokenTypeOf TkBreak                   = TypeBreak
+tokenTypeOf TkSimple{}                = TypeSimple
+tokenTypeOf TkFloat16{}               = TypeFloat16
+tokenTypeOf TkFloat32{}               = TypeFloat32
+tokenTypeOf TkFloat64{}               = TypeFloat64
 
 --------------------------------------------------------------------------------
 
diff --git a/tests/Tests/Properties.hs b/tests/Tests/Properties.hs
--- a/tests/Tests/Properties.hs
+++ b/tests/Tests/Properties.hs
@@ -1042,8 +1042,10 @@
 
         genByteArray :: Int -> Gen Prim.ByteArray
         genByteArray n = do
-                  SBS.SBS ba <- genShortByteString n
-                  pure (Prim.ByteArray ba)
+                  bss <- genShortByteString n
+                  case bss of
+                    SBS.SBS ba -> pure $ Prim.ByteArray ba
+
 --------------------------------------------------------------------------------
 -- TestTree API
 
