diff --git a/IPv6Addr.cabal b/IPv6Addr.cabal
--- a/IPv6Addr.cabal
+++ b/IPv6Addr.cabal
@@ -1,5 +1,5 @@
 name:                IPv6Addr
-version:             2.0.5.1
+version:             2.0.6
 synopsis:            Library to deal with IPv6 address text representations.
 description:         Library to deal with IPv6 address text representations, canonization and manipulations.
 homepage:            https://github.com/MichelBoucey/IPv6Addr
@@ -7,13 +7,13 @@
 license-file:        LICENSE
 author:              Michel Boucey
 maintainer:          michel.boucey@gmail.com
-copyright:           (c) 2011-2023 - Michel Boucey
+copyright:           (c) 2011-2024 - Michel Boucey
 category:            Network
 build-type:          Simple
 extra-source-files:  README.md
 cabal-version:       >=1.10
 
-Tested-With: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.5 || ==9.6.2
+Tested-With: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.3 || ==9.8.1
 
 Source-Repository head
   Type: git
@@ -23,12 +23,12 @@
   exposed-modules:  Text.IPv6Addr
   other-extensions: OverloadedStrings
   build-depends:    base         >=4.8 && < 5
-                  , text         >=1.1 && < 1.3 || == 2.0.*
+                  , text         >=1.1 && < 2.2
                   , iproute      >=1.3 && < 1.8
                   , network      >=2.5 && < 4
                   , random       >=1.0 && < 1.3
                   , attoparsec   >=0.12 && < 0.15
-                  , aeson        >= 0.8.0.2 && < 1.6 || >= 2.0 && < 2.3
+                  , aeson        >=0.8.0.2 && < 1.6 || >= 2.0 && < 2.3
                   , network-info >=0.2 && <=0.3
   default-language: Haskell2010
   GHC-Options:      -Wall
diff --git a/Text/IPv6Addr.hs b/Text/IPv6Addr.hs
--- a/Text/IPv6Addr.hs
+++ b/Text/IPv6Addr.hs
@@ -34,7 +34,7 @@
 import           Data.Char            (intToDigit, isDigit)
 import           Data.IP              (IPv6)
 import           Data.List            (elemIndex, elemIndices, foldl', group,
-                                       intersperse, isSuffixOf)
+                                       intersperse, isSuffixOf, uncons)
 import           Data.Maybe           (fromJust, isJust)
 
 #if !MIN_VERSION_base(4,11,0)
@@ -143,7 +143,7 @@
 
 -- | Given an 'IPv6Addr', returns the corresponding 'Data.IP.IPv6' address.
 toIPv6 :: IPv6Addr -> Data.IP.IPv6
-toIPv6 a = read (show a)
+toIPv6 = read . show
 
 -- | Returns 'Just' the canonized 'IPv6Addr' of the given local network interface,
 -- or 'Nothing'.
@@ -213,8 +213,8 @@
             _            -> (a,b)
     addColon ts =
       case last ts of
-        SixteenBit _ -> ts <> [Colon]
-        AllZeros     -> ts <> [Colon]
+        SixteenBit _ -> ts <> pure Colon
+        AllZeros     -> ts <> pure Colon
         _            -> ts
 
 
@@ -229,7 +229,7 @@
 --
 randIPv6AddrChunk :: String -> IO IPv6AddrToken
 randIPv6AddrChunk m =
-  mapM getHex m >>= \g -> return (SixteenBit $ T.dropWhile (=='0') $ T.pack g)
+  mapM getHex m >>= \h -> pure (SixteenBit $ T.dropWhile (=='0') $ T.pack h)
   where
     getHex c
       | c == '_'  = getDigit
@@ -291,7 +291,7 @@
 
 -- | Given an arbitrary list of 'IPv6AddrToken', returns the corresponding 'T.Text'.
 ipv6TokensToText :: [IPv6AddrToken] -> T.Text
-ipv6TokensToText l = T.concat (ipv6TokenToText <$> l)
+ipv6TokensToText = T.concat . fmap ipv6TokenToText
 
 -- | Returns the corresponding 'T.Text' of an IPv6 address token.
 ipv6TokenToText :: IPv6AddrToken -> T.Text
@@ -328,7 +328,7 @@
            diffNext [] = False
            diffNext [_] = True
            diffNext (t:ts) = do
-             let h = head ts
+             let h = justHead ts
              case t of
                DoubleColon ->
                  case h of
@@ -346,12 +346,12 @@
                    _            -> diffNext ts
                _            -> diffNext ts
            firstValidToken l =
-             case head l of
+             case justHead l of
                SixteenBit _ -> True
                DoubleColon  -> True
                AllZeros     -> True
                _            -> False
-           countDoubleColon l = length (elemIndices DoubleColon l)
+           countDoubleColon = length . elemIndices DoubleColon
 
 countIPv4Addr :: [IPv6AddrToken] -> Int
 countIPv4Addr =
@@ -367,36 +367,36 @@
 -- in conformation with RFC 5952, or 'Nothing'.
 maybeTokIPv6Addr :: T.Text -> Maybe [IPv6AddrToken]
 maybeTokIPv6Addr t = do
-  ltks <- maybeIPv6AddrTokens t
-  guard (isIPv6Addr ltks)
-  return (ipv4AddrReplacement . toDoubleColon . fromDoubleColon $ ltks)
+  tks <- maybeIPv6AddrTokens t
+  guard (isIPv6Addr tks)
+  return (ipv4AddrReplacement . toDoubleColon . fromDoubleColon $ tks)
   where
-    ipv4AddrReplacement ltks =
-      if ipv4AddrRewrite ltks
-        then init ltks <> ipv4AddrToIPv6AddrTokens (last ltks)
-        else ltks
+    ipv4AddrReplacement tks =
+      if ipv4AddrRewrite tks
+        then init tks <> ipv4AddrToIPv6AddrTokens (last tks)
+        else tks
 
 -- | Returns 'Just' the list of tokenized pure IPv6 address, always rewriting an
 -- embedded IPv4 address if present.
 maybeTokPureIPv6Addr :: T.Text -> Maybe [IPv6AddrToken]
 maybeTokPureIPv6Addr t = do
-  ltks <- maybeIPv6AddrTokens t
-  guard (isIPv6Addr ltks)
-  return (toDoubleColon . ipv4AddrReplacement . fromDoubleColon $ ltks)
+  tks <- maybeIPv6AddrTokens t
+  guard (isIPv6Addr tks)
+  return (toDoubleColon . ipv4AddrReplacement . fromDoubleColon $ tks)
   where
-    ipv4AddrReplacement ltks' =
-      init ltks' <> ipv4AddrToIPv6AddrTokens (last ltks')
+    ipv4AddrReplacement tks' =
+      init tks' <> ipv4AddrToIPv6AddrTokens (last tks')
 
 -- | Tokenize a 'T.Text' into 'Just' a list of 'IPv6AddrToken', or 'Nothing'.
 maybeIPv6AddrTokens :: T.Text -> Maybe [IPv6AddrToken]
-maybeIPv6AddrTokens s =
-  case readText s of
+maybeIPv6AddrTokens t =
+  case readText t of
     Done "" l -> Just l
     _         -> Nothing
   where
-    readText _s =
+    readText t' =
       feed
-        (parse (many1 $ ipv4Addr <|> sixteenBit <|> doubleColon <|> colon) _s)
+        (parse (many1 $ ipv4Addr <|> sixteenBit <|> doubleColon <|> colon) t')
         T.empty
 
 -- | An embedded IPv4 address have to be rewritten to output a pure IPv6 Address
@@ -463,16 +463,16 @@
     else do
       let s = splitAt (fromJust $ elemIndex DoubleColon tks) tks
           fsts = fst s
-          snds = if not (null (snd s)) then tail(snd s) else []
+          snds = if not (null (snd s)) then justTail(snd s) else []
           fste = if null fsts then [] else fsts <> [Colon]
           snde = if null snds then [] else Colon : snds
       fste <> allZerosTokensReplacement(quantityOfAllZerosTokenToReplace tks) <> snde
       where
         allZerosTokensReplacement x = intersperse Colon (replicate x AllZeros)
-        quantityOfAllZerosTokenToReplace _x =
-          ntks tks - foldl' (\c _x -> if (_x /= DoubleColon) && (_x /= Colon) then c+1 else c) 0 _x
+        quantityOfAllZerosTokenToReplace y =
+          ntks tks - foldl' (\c d -> if (d /= DoubleColon) && (d /= Colon) then c+1 else c) 0 y
           where
-            ntks _tks = if countIPv4Addr _tks == 1 then 7 else 8
+            ntks tks' = if countIPv4Addr tks' == 1 then 7 else 8
 
 toDoubleColon :: [IPv6AddrToken] -> [IPv6AddrToken]
 toDoubleColon tks =
@@ -493,18 +493,18 @@
         longestLengthZerosRun x =
           maximum (longest <$> x)
           where
-            longest _t =
-              case _t of
+            longest l' =
+              case l' of
                 (True,i) -> i
                 _        -> 0
     zerosRunsList x =
       helper <$> groupZerosRuns x
       where
-        helper h = (head h == AllZeros, lh) where lh = length h
+        helper h = (justHead h == AllZeros, lh) where lh = length h
         groupZerosRuns = group . filter (/= Colon)
 
 ipv6TokensToIPv6Addr :: [IPv6AddrToken] -> Maybe IPv6Addr
-ipv6TokensToIPv6Addr l = Just (IPv6Addr $ ipv6TokensToText l)
+ipv6TokensToIPv6Addr = Just . IPv6Addr . ipv6TokensToText
 
 networkInterfacesIPv6AddrList :: IO [(String,Network.Info.IPv6)]
 networkInterfacesIPv6AddrList =
@@ -569,4 +569,11 @@
 
 hexaChar :: Parser Char
 hexaChar = satisfy (inClass "0-9a-fA-F")
+
+-- Helper functions
+justHead :: [a] -> a
+justHead l = fst (fromJust $ uncons l)
+
+justTail :: [a] -> [a]
+justTail l = snd (fromJust $ uncons l)
 
