diff --git a/scientific.cabal b/scientific.cabal
--- a/scientific.cabal
+++ b/scientific.cabal
@@ -1,5 +1,5 @@
 name:               scientific
-version:            0.3.8.0
+version:            0.3.8.1
 synopsis:           Numbers represented using scientific notation
 description:
   "Data.Scientific" provides the number type 'Scientific'. Scientific numbers are
@@ -49,13 +49,15 @@
    || ==9.0.2
    || ==9.2.8
    || ==9.4.8
-   || ==9.6.5
-   || ==9.8.2
-   || ==9.10.1
+   || ==9.6.6
+   || ==9.8.4
+   || ==9.10.3
+   || ==9.12.2
+   || ==9.14.1
 
 source-repository head
   type:     git
-  location: git://github.com/basvandijk/scientific.git
+  location: https://github.com/basvandijk/scientific.git
 
 flag integer-simple
   description: Use the integer-simple package instead of integer-gmp
@@ -78,15 +80,15 @@
 
   ghc-options:      -Wall
   build-depends:
-      base                >=4.5      && <4.21
+      base                >=4.12.0.0 && <4.23
     , binary              >=0.8.6.0  && <0.9
     , bytestring          >=0.10.8.2 && <0.13
-    , containers          >=0.6.0.1  && <0.8
+    , containers          >=0.6.0.1  && <0.9
     , deepseq             >=1.4.4.0  && <1.6
-    , hashable            >=1.4.4.0  && <1.5
+    , hashable            >=1.4.4.0  && <1.6
     , integer-logarithms  >=1.0.3.1  && <1.1
     , primitive           >=0.9.0.0  && <0.10
-    , template-haskell    >=2.14.0.0 && <2.23
+    , template-haskell    >=2.14.0.0 && <2.25
     , text                >=1.2.3.0  && <1.3  || >=2.0 && <2.2
 
   if impl(ghc >=9.0)
diff --git a/src/Data/ByteString/Builder/Scientific.hs b/src/Data/ByteString/Builder/Scientific.hs
--- a/src/Data/ByteString/Builder/Scientific.hs
+++ b/src/Data/ByteString/Builder/Scientific.hs
@@ -59,11 +59,10 @@
                 byteStringCopy (BC8.replicate dec' '0') <>
                 byteStringCopy "e0"
          _ ->
-          let
-           (ei,is') = roundTo (dec'+1) is
-           (d:ds') = map i2d (if ei > 0 then init is' else is')
-          in
-          char8 d <> char8 '.' <> string8 ds' <> char8 'e' <> intDec (e-1+ei)
+          let (ei,is') = roundTo (dec'+1) is
+          in case map i2d (if ei > 0 then init is' else is') of
+                [] -> mempty
+                d:ds' -> char8 d <> char8 '.' <> string8 ds' <> char8 'e' <> intDec (e-1+ei)
      Fixed ->
       let
        mk0 ls = case ls of { "" -> char8 '0' ; _ -> string8 ls}
@@ -89,8 +88,7 @@
          in
          mk0 ls <> (if null rs then mempty else char8 '.' <> string8 rs)
         else
-         let
-          (ei,is') = roundTo dec' (replicate (-e) 0 ++ is)
-          d:ds' = map i2d (if ei > 0 then is' else 0:is')
-         in
-         char8 d <> (if null ds' then mempty else char8 '.' <> string8 ds')
+         let (ei,is') = roundTo dec' (replicate (-e) 0 ++ is)
+         in case map i2d (if ei > 0 then is' else 0:is') of
+              [] -> mempty
+              d:ds' -> char8 d <> (if null ds' then mempty else char8 '.' <> string8 ds')
diff --git a/src/Data/Scientific.hs b/src/Data/Scientific.hs
--- a/src/Data/Scientific.hs
+++ b/src/Data/Scientific.hs
@@ -1036,11 +1036,10 @@
             case is of
              [0] -> '0' :'.' : take dec' (repeat '0') ++ "e0"
              _ ->
-              let
-               (ei,is') = roundTo (dec'+1) is
-               (d:ds') = map intToDigit (if ei > 0 then init is' else is')
-              in
-              d:'.':ds' ++ 'e':show (e-1+ei)
+              let (ei,is') = roundTo (dec'+1) is
+              in case map intToDigit (if ei > 0 then init is' else is') of
+                   [] -> ""
+                   d:ds' -> d:'.':ds' ++ 'e':show (e-1+ei)
 
     fmtAsFixedDecs :: Int -> ([Int], Int) -> String
     fmtAsFixedDecs dec (is, e) =
@@ -1052,11 +1051,10 @@
          in
          mk0 ls ++ (if null rs then "" else '.':rs)
         else
-         let
-          (ei,is') = roundTo dec' (replicate (-e) 0 ++ is)
-          d:ds' = map intToDigit (if ei > 0 then is' else 0:is')
-         in
-         d : (if null ds' then "" else '.':ds')
+         let (ei,is') = roundTo dec' (replicate (-e) 0 ++ is)
+         in case map intToDigit (if ei > 0 then is' else 0:is') of
+             [] -> ""
+             d:ds' -> d : (if null ds' then "" else '.':ds')
       where
         mk0 ls = case ls of { "" -> "0" ; _ -> ls}
 
diff --git a/src/Data/Text/Lazy/Builder/Scientific.hs b/src/Data/Text/Lazy/Builder/Scientific.hs
--- a/src/Data/Text/Lazy/Builder/Scientific.hs
+++ b/src/Data/Text/Lazy/Builder/Scientific.hs
@@ -55,11 +55,10 @@
         case is of
          [0] -> "0." <> fromText (T.replicate dec' "0") <> "e0"
          _ ->
-          let
-           (ei,is') = roundTo (dec'+1) is
-           (d:ds') = map i2d (if ei > 0 then init is' else is')
-          in
-          singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> decimal (e-1+ei)
+          let (ei,is') = roundTo (dec'+1) is
+          in case map i2d (if ei > 0 then init is' else is') of
+               [] -> mempty
+               d:ds' -> singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> decimal (e-1+ei)
      Fixed ->
       let
        mk0 ls = case ls of { "" -> "0" ; _ -> fromString ls}
@@ -83,8 +82,7 @@
          in
          mk0 ls <> (if null rs then "" else singleton '.' <> fromString rs)
         else
-         let
-          (ei,is') = roundTo dec' (replicate (-e) 0 ++ is)
-          d:ds' = map i2d (if ei > 0 then is' else 0:is')
-         in
-         singleton d <> (if null ds' then "" else singleton '.' <> fromString ds')
+         let (ei,is') = roundTo dec' (replicate (-e) 0 ++ is)
+         in case map i2d (if ei > 0 then is' else 0:is') of
+              [] -> mempty
+              d:ds' -> singleton d <> (if null ds' then "" else singleton '.' <> fromString ds')
