diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,10 @@
+# Changelog for unpacked-maybe-numeric
+
+## 0.1.3.1 -- 2024-02-14
+
+* Update package metadata.
+* Fix failing test suite.
+
+## 0.1.1.0 -- 2019-09-28
+
+* Add module for `Word128`-variant of `Maybe`.
diff --git a/Setup.hs b/Setup.hs
deleted file mode 100644
--- a/Setup.hs
+++ /dev/null
@@ -1,2 +0,0 @@
-import Distribution.Simple
-main = defaultMain
diff --git a/src/Data/Maybe/Unpacked/Numeric/Complex/Double.hs b/src/Data/Maybe/Unpacked/Numeric/Complex/Double.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Complex/Double.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Complex/Double.hs
@@ -1,20 +1,14 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
 
 module Data.Maybe.Unpacked.Numeric.Complex.Double
-  ( Complex(..)
+  ( Complex (..)
   , toBaseComplex
   , fromBaseComplex
-  
-  , Maybe(..)
+  , Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -22,20 +16,19 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where  
-  
-import Prelude hiding (Maybe,maybe)
+  ) where
 
+import Prelude hiding (Maybe, maybe)
+
 import qualified Data.Complex as C
 import GHC.Base (build)
-import GHC.Exts (Double#,Double(D#),(==##))
+import GHC.Exts (Double (D#), Double#, (==##))
 
-import GHC.Read (Read(readPrec), expectP)
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec), expectP)
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 import qualified Prelude as P
 
 data Complex = Complex Double# Double#
@@ -44,20 +37,20 @@
 toBaseComplex (Complex d1# d2#) = (D# d1#) C.:+ (D# d2#)
 
 fromBaseComplex :: C.Complex Double -> Complex
-fromBaseComplex ( (D# d1#) C.:+ (D# d2#) ) = Complex d1# d2#
+fromBaseComplex ((D# d1#) C.:+ (D# d2#)) = Complex d1# d2#
 
 instance Eq Complex where
   Complex a b == Complex c d =
     case a ==## c of
       1# -> case b ==## d of
         1# -> True
-        _   -> False
-      _   -> False
+        _ -> False
+      _ -> False
 
 instance Show Complex where
-  showsPrec p (Complex a b)
-    = showParen (p >= 11)
-        $ showString "Complex "
+  showsPrec p (Complex a b) =
+    showParen (p >= 11) $
+      showString "Complex "
         . showsPrec 11 (D# a)
         . showString " "
         . showsPrec 11 (D# b)
@@ -73,30 +66,33 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | c #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 c
+    (# | c #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 c
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Complex] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Complex]
 maybeToList = maybe [] (: [])
@@ -108,13 +104,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -148,4 +145,3 @@
 
 fromBaseMaybe :: P.Maybe Complex -> Maybe
 fromBaseMaybe = P.maybe nothing just
-
diff --git a/src/Data/Maybe/Unpacked/Numeric/Complex/Float.hs b/src/Data/Maybe/Unpacked/Numeric/Complex/Float.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Complex/Float.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Complex/Float.hs
@@ -1,20 +1,14 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
 
 module Data.Maybe.Unpacked.Numeric.Complex.Float
-  ( Complex(..)
+  ( Complex (..)
   , toBaseComplex
   , fromBaseComplex
-  
-  , Maybe(..)
+  , Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -22,20 +16,19 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where 
+  ) where
 
-import Prelude hiding (Maybe,maybe)
+import Prelude hiding (Maybe, maybe)
 
 import qualified Data.Complex as C
 import GHC.Base (build)
-import GHC.Exts (Float#,Float(F#),eqFloat#)
+import GHC.Exts (Float (F#), Float#, eqFloat#)
 
-import GHC.Read (Read(readPrec), expectP)
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec), expectP)
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 import qualified Prelude as P
 
 data Complex = Complex Float# Float#
@@ -44,20 +37,20 @@
 toBaseComplex (Complex d1# d2#) = (F# d1#) C.:+ (F# d2#)
 
 fromBaseComplex :: C.Complex Float -> Complex
-fromBaseComplex ( (F# d1#) C.:+ (F# d2#) ) = Complex d1# d2#
+fromBaseComplex ((F# d1#) C.:+ (F# d2#)) = Complex d1# d2#
 
 instance Eq Complex where
   Complex a b == Complex c d =
     case a `eqFloat#` c of
       1# -> case b `eqFloat#` d of
         1# -> True
-        _   -> False
-      _   -> False
+        _ -> False
+      _ -> False
 
 instance Show Complex where
-  showsPrec p (Complex a b)
-    = showParen (p >= 11)
-        $ showString "Complex "
+  showsPrec p (Complex a b) =
+    showParen (p >= 11) $
+      showString "Complex "
         . showsPrec 11 (F# a)
         . showString " "
         . showsPrec 11 (F# b)
@@ -73,30 +66,33 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | c #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 c
+    (# | c #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 c
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Complex] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Complex]
 maybeToList = maybe [] (: [])
@@ -108,13 +104,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -148,4 +145,3 @@
 
 fromBaseMaybe :: P.Maybe Complex -> Maybe
 fromBaseMaybe = P.maybe nothing just
-
diff --git a/src/Data/Maybe/Unpacked/Numeric/Double.hs b/src/Data/Maybe/Unpacked/Numeric/Double.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Double.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Double.hs
@@ -1,16 +1,11 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
 
 module Data.Maybe.Unpacked.Numeric.Double
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -18,52 +13,60 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where 
+  ) where
 
-import Prelude hiding (Maybe,maybe)
+import Prelude hiding (Maybe, maybe)
 
 import GHC.Base (build)
-import GHC.Exts (Double#,Double(D#))
+import GHC.Exts (Double (D#), Double#)
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 import qualified Prelude as P
 
 data Maybe = Maybe (# (# #) | Double# #)
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare (Maybe ma) (Maybe mb) = case ma of
+    (# (# #) | #) -> case mb of
+      (# (# #) | #) -> EQ
+      (# | _ #) -> LT
+    (# | a #) -> case mb of
+      (# (# #) | #) -> GT
+      (# | b #) -> compare (D# a) (D# b)
 
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | d #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 (D# d)
+    (# | d #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 (D# d)
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Double] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Double]
 maybeToList = maybe [] (: [])
@@ -75,13 +78,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
diff --git a/src/Data/Maybe/Unpacked/Numeric/Float.hs b/src/Data/Maybe/Unpacked/Numeric/Float.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Float.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Float.hs
@@ -1,16 +1,11 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
 
 module Data.Maybe.Unpacked.Numeric.Float
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -18,52 +13,60 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where 
+  ) where
 
-import Prelude hiding (Maybe,maybe)
+import Prelude hiding (Maybe, maybe)
 
 import GHC.Base (build)
-import GHC.Exts (Float#,Float(F#))
+import GHC.Exts (Float (F#), Float#)
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 import qualified Prelude as P
 
 data Maybe = Maybe (# (# #) | Float# #)
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare (Maybe ma) (Maybe mb) = case ma of
+    (# (# #) | #) -> case mb of
+      (# (# #) | #) -> EQ
+      (# | _ #) -> LT
+    (# | a #) -> case mb of
+      (# (# #) | #) -> GT
+      (# | b #) -> compare (F# a) (F# b)
 
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | d #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 (F# d)
+    (# | d #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 (F# d)
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Float] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Float]
 maybeToList = maybe [] (: [])
@@ -75,13 +78,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
diff --git a/src/Data/Maybe/Unpacked/Numeric/Int.hs b/src/Data/Maybe/Unpacked/Numeric/Int.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Int.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Int.hs
@@ -1,16 +1,11 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
 
 module Data.Maybe.Unpacked.Numeric.Int
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -18,20 +13,19 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where 
+  ) where
 
-import Prelude hiding (Maybe,maybe)
+import Prelude hiding (Maybe, maybe)
 
 import GHC.Base (build)
 import GHC.Exts (Int#)
-import GHC.Int (Int(I#))
+import GHC.Int (Int (I#))
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -39,33 +33,42 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare (Maybe ma) (Maybe mb) = case ma of
+    (# (# #) | #) -> case mb of
+      (# (# #) | #) -> EQ
+      (# | _ #) -> LT
+    (# | a #) -> case mb of
+      (# (# #) | #) -> GT
+      (# | b #) -> compare (I# a) (I# b)
 
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | i #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 (I# i)
+    (# | i #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 (I# i)
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Int] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Int]
 maybeToList = maybe [] (: [])
@@ -77,13 +80,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -117,4 +121,3 @@
 
 fromBaseMaybe :: P.Maybe Int -> Maybe
 fromBaseMaybe = P.maybe nothing just
-
diff --git a/src/Data/Maybe/Unpacked/Numeric/Int16.hs b/src/Data/Maybe/Unpacked/Numeric/Int16.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Int16.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Int16.hs
@@ -1,17 +1,14 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE PatternSynonyms #-}
 {-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE ViewPatterns #-}
 
 module Data.Maybe.Unpacked.Numeric.Int16
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -19,21 +16,23 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where    
-  
-import Prelude hiding (Maybe,maybe)
+    -- * Patterns
+  , pattern Nothing
+  , pattern Just
+  ) where
 
+import Prelude hiding (Just, Maybe, Nothing, maybe)
+
 import GHC.Base (build)
-import GHC.Exts (Int#, (>#), (<#))
+import GHC.Exts (Int#, (<#), (>#))
 import GHC.Int (Int16)
 import GHC.Int.Compat (pattern I16#)
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -41,35 +40,46 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare ma mb = case ma of
+    Just a -> case mb of
+      Just b -> compare a b
+      _ -> GT
+    _ -> case mb of
+      Just{} -> LT
+      _ -> EQ
 
 instance Show Maybe where
   showsPrec p m =
-    maybe (showString "nothing")
-      (\i -> showParen (p > 10)
-        $ showString "just "
-        . showsPrec 11 i
-      ) m
+    maybe
+      (showString "nothing")
+      ( \i ->
+          showParen (p > 10) $
+            showString "just "
+              . showsPrec 11 i
+      )
+      m
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Int16] -> Maybe
 {-# INLINE listToMaybe #-}
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Int16]
 maybeToList m = maybe [] (: []) m
@@ -81,13 +91,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -118,9 +129,9 @@
 {-# INLINE maybe #-}
 maybe a f (M m) = case m ># 32767# of
   1# -> a
-  _  -> case m <# -32768# of
+  _ -> case m <# -32768# of
     1# -> a
-    _  -> f (I16# m)
+    _ -> f (I16# m)
 
 toBaseMaybe :: Maybe -> P.Maybe Int16
 {-# INLINE toBaseMaybe #-}
@@ -130,3 +141,16 @@
 {-# INLINE fromBaseMaybe #-}
 fromBaseMaybe m = P.maybe nothing just m
 
+pattern Nothing :: Maybe
+pattern Nothing = M 32768#
+
+pattern Just :: Int16 -> Maybe
+pattern Just i <- (maybeInt16ToInt16 -> (# | i #))
+  where
+    Just (I16# i) = M i
+
+maybeInt16ToInt16 :: Maybe -> (# (# #) | Int16 #)
+{-# inline maybeInt16ToInt16 #-}
+maybeInt16ToInt16 (M i) = case i of
+  32768# -> (# (# #) | #)
+  _ -> (# | I16# i #)
diff --git a/src/Data/Maybe/Unpacked/Numeric/Int32.hs b/src/Data/Maybe/Unpacked/Numeric/Int32.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Int32.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Int32.hs
@@ -1,17 +1,14 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE PatternSynonyms #-}
 {-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE ViewPatterns #-}
 
 module Data.Maybe.Unpacked.Numeric.Int32
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -19,20 +16,22 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where 
- 
-import Prelude hiding (Maybe,maybe)
+    -- * Patterns
+  , pattern Nothing
+  , pattern Just
+  ) where
 
-import GHC.Exts 
+import Prelude hiding (Just, Maybe, Nothing, maybe)
+
+import GHC.Exts
 import GHC.Int (Int32)
 import GHC.Int.Compat (pattern I32#)
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -40,37 +39,47 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
   {-# INLINE (==) #-}
 
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
-  {-# INLINE compare #-}
+  compare ma mb = case ma of
+    Just a -> case mb of
+      Just b -> compare a b
+      _ -> GT
+    _ -> case mb of
+      Just{} -> LT
+      _ -> EQ
 
 instance Show Maybe where
   showsPrec p m =
-    maybe (showString "nothing")
-      (\i -> showParen (p > 10)
-        $ showString "just "
-        . showsPrec 11 i
-      ) m
+    maybe
+      (showString "nothing")
+      ( \i ->
+          showParen (p > 10) $
+            showString "just "
+              . showsPrec 11 i
+      )
+      m
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Int32] -> Maybe
 {-# INLINE listToMaybe #-}
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Int32]
 maybeToList m = maybe [] (: []) m
@@ -82,13 +91,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -119,9 +129,9 @@
 {-# INLINE maybe #-}
 maybe a f (M m) = case m ># 2147483647# of
   1# -> a
-  _  -> case m <# -2147483648# of
+  _ -> case m <# -2147483648# of
     1# -> a
-    _  -> f (I32# m)
+    _ -> f (I32# m)
 
 toBaseMaybe :: Maybe -> P.Maybe Int32
 {-# INLINE toBaseMaybe #-}
@@ -131,3 +141,16 @@
 {-# INLINE fromBaseMaybe #-}
 fromBaseMaybe m = P.maybe nothing just m
 
+pattern Nothing :: Maybe
+pattern Nothing = M 2147483648#
+
+pattern Just :: Int32 -> Maybe
+pattern Just i <- (maybeInt32ToInt32 -> (# | i #))
+  where
+    Just (I32# i) = M i
+
+maybeInt32ToInt32 :: Maybe -> (# (# #) | Int32 #)
+{-# inline maybeInt32ToInt32 #-}
+maybeInt32ToInt32 (M i) = case i of
+  2147483648# -> (# (# #) | #)
+  _ -> (# | I32# i #)
diff --git a/src/Data/Maybe/Unpacked/Numeric/Int64.hs b/src/Data/Maybe/Unpacked/Numeric/Int64.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Int64.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Int64.hs
@@ -1,16 +1,11 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
 
 module Data.Maybe.Unpacked.Numeric.Int64
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -18,20 +13,19 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where 
+  ) where
 
-import Prelude hiding (Maybe,maybe)
+import Prelude hiding (Maybe, maybe)
 
 import GHC.Base (build)
 import GHC.Exts (Int64#)
-import GHC.Int (Int64(I64#))
+import GHC.Int (Int64 (I64#))
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -39,33 +33,42 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare (Maybe ma) (Maybe mb) = case ma of
+    (# (# #) | #) -> case mb of
+      (# (# #) | #) -> EQ
+      (# | _ #) -> LT
+    (# | a #) -> case mb of
+      (# (# #) | #) -> GT
+      (# | b #) -> compare (I64# a) (I64# b)
 
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | i #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 (I64# i)
+    (# | i #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 (I64# i)
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Int64] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Int64]
 maybeToList = maybe [] (: [])
@@ -77,13 +80,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -117,4 +121,3 @@
 
 fromBaseMaybe :: P.Maybe Int64 -> Maybe
 fromBaseMaybe = P.maybe nothing just
-
diff --git a/src/Data/Maybe/Unpacked/Numeric/Int8.hs b/src/Data/Maybe/Unpacked/Numeric/Int8.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Int8.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Int8.hs
@@ -1,17 +1,14 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE PatternSynonyms #-}
 {-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE ViewPatterns #-}
 
 module Data.Maybe.Unpacked.Numeric.Int8
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -19,20 +16,22 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
+    -- * Patterns
+  , pattern Nothing
+  , pattern Just
   ) where
 
-import Prelude hiding (Maybe,maybe)
+import Prelude hiding (Just, Maybe, Nothing, maybe)
 
-import GHC.Exts 
+import GHC.Exts
 import GHC.Int (Int8)
 import GHC.Int.Compat (pattern I8#)
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -40,35 +39,46 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare ma mb = case ma of
+    Just a -> case mb of
+      Just b -> compare a b
+      _ -> GT
+    _ -> case mb of
+      Just{} -> LT
+      _ -> EQ
 
 instance Show Maybe where
   showsPrec p m =
-    maybe (showString "nothing")
-      (\i -> showParen (p > 10)
-        $ showString "just "
-        . showsPrec 11 i
-      ) m
+    maybe
+      (showString "nothing")
+      ( \i ->
+          showParen (p > 10) $
+            showString "just "
+              . showsPrec 11 i
+      )
+      m
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Int8] -> Maybe
 {-# INLINE listToMaybe #-}
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Int8]
 maybeToList m = maybe [] (: []) m
@@ -80,13 +90,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -117,9 +128,9 @@
 {-# INLINE maybe #-}
 maybe a f (M m) = case m ># 127# of
   1# -> a
-  _  -> case m <# -128# of
+  _ -> case m <# -128# of
     1# -> a
-    _  -> f (I8# m)
+    _ -> f (I8# m)
 
 toBaseMaybe :: Maybe -> P.Maybe Int8
 {-# INLINE toBaseMaybe #-}
@@ -129,3 +140,16 @@
 {-# INLINE fromBaseMaybe #-}
 fromBaseMaybe m = P.maybe nothing just m
 
+pattern Nothing :: Maybe
+pattern Nothing = M 128#
+
+pattern Just :: Int8 -> Maybe
+pattern Just i <- (maybeInt8ToInt8 -> (# | i #))
+  where
+    Just (I8# i) = M i
+
+maybeInt8ToInt8 :: Maybe -> (# (# #) | Int8 #)
+{-# inline maybeInt8ToInt8 #-}
+maybeInt8ToInt8 (M i) = case i of
+  128# -> (# (# #) | #)
+  _ -> (# | I8# i #)
diff --git a/src/Data/Maybe/Unpacked/Numeric/Word.hs b/src/Data/Maybe/Unpacked/Numeric/Word.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Word.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Word.hs
@@ -1,16 +1,11 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
 
 module Data.Maybe.Unpacked.Numeric.Word
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -18,20 +13,19 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where 
-  
-import Prelude hiding (Maybe,maybe)
+  ) where
 
+import Prelude hiding (Maybe, maybe)
+
 import GHC.Base (build)
 import GHC.Exts (Word#)
-import GHC.Word (Word(W#))
+import GHC.Word (Word (W#))
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -39,33 +33,42 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare (Maybe ma) (Maybe mb) = case ma of
+    (# (# #) | #) -> case mb of
+      (# (# #) | #) -> EQ
+      (# | _ #) -> LT
+    (# | a #) -> case mb of
+      (# (# #) | #) -> GT
+      (# | b #) -> compare (W# a) (W# b)
 
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | w #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 (W# w)
+    (# | w #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 (W# w)
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Word] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Word]
 maybeToList = maybe [] (: [])
@@ -77,13 +80,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -117,4 +121,3 @@
 
 fromBaseMaybe :: P.Maybe Word -> Maybe
 fromBaseMaybe = P.maybe nothing just
-
diff --git a/src/Data/Maybe/Unpacked/Numeric/Word128.hs b/src/Data/Maybe/Unpacked/Numeric/Word128.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Word128.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Word128.hs
@@ -1,16 +1,11 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
 
 module Data.Maybe.Unpacked.Numeric.Word128
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -18,21 +13,20 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where   
+  ) where
 
-import Prelude hiding (Maybe,maybe)
+import Prelude hiding (Maybe, maybe)
 
-import Data.WideWord (Word128(..))
+import Data.WideWord (Word128 (..))
 import GHC.Base (build)
 import GHC.Exts (Word64#)
-import GHC.Word (Word64(W64#))
+import GHC.Word (Word64 (W64#))
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -40,33 +34,36 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma
 
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | (# wa, wb #) #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 (Word128 (W64# wa) (W64# wb))
+    (# | (# wa, wb #) #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 (Word128 (W64# wa) (W64# wb))
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = prec 10 $ do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = prec 10 $ do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Word128] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Word128]
 maybeToList = maybe [] (: [])
@@ -78,13 +75,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -118,5 +116,3 @@
 
 fromBaseMaybe :: P.Maybe Word128 -> Maybe
 fromBaseMaybe = P.maybe nothing just
-
-
diff --git a/src/Data/Maybe/Unpacked/Numeric/Word16.hs b/src/Data/Maybe/Unpacked/Numeric/Word16.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Word16.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Word16.hs
@@ -1,17 +1,13 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE PatternSynonyms #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE ViewPatterns #-}
 
 module Data.Maybe.Unpacked.Numeric.Word16
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -19,21 +15,23 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where   
+    -- * Patterns
+  , pattern Nothing
+  , pattern Just
+  ) where
 
-import Prelude hiding (Maybe,maybe)
+import Prelude hiding (Just, Maybe, Nothing, maybe)
 
 import GHC.Base (build)
 import GHC.Exts (Word#)
 import GHC.Word (Word16)
 import GHC.Word.Compat (pattern W16#)
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -41,33 +39,42 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare ma mb = case ma of
+    Just a -> case mb of
+      Just b -> compare a b
+      _ -> GT
+    _ -> case mb of
+      Just{} -> LT
+      _ -> EQ
 
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | w #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 (W16# w)
+    (# | w #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 (W16# w)
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Word16] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Word16]
 maybeToList = maybe [] (: [])
@@ -79,13 +86,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -120,3 +128,12 @@
 fromBaseMaybe :: P.Maybe Word16 -> Maybe
 fromBaseMaybe = P.maybe nothing just
 
+pattern Nothing :: Maybe
+pattern Nothing = Maybe (# (# #) | #)
+
+pattern Just :: Word16 -> Maybe
+pattern Just i <- Maybe (# | (W16# -> i) #)
+  where
+    Just (W16# i) = Maybe (# | i #)
+
+{-# COMPLETE Nothing, Just #-}
diff --git a/src/Data/Maybe/Unpacked/Numeric/Word32.hs b/src/Data/Maybe/Unpacked/Numeric/Word32.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Word32.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Word32.hs
@@ -1,18 +1,13 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE PatternSynonyms #-}
-{-# LANGUAGE ViewPatterns #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE ViewPatterns #-}
 
 module Data.Maybe.Unpacked.Numeric.Word32
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -20,25 +15,24 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
 
     -- * Patterns
   , pattern Nothing
   , pattern Just
-  ) where   
+  ) where
 
-import Prelude hiding (Maybe,Nothing,Just,maybe)
+import Prelude hiding (Just, Maybe, Nothing, maybe)
 
 import GHC.Base (build)
 import GHC.Exts (Word#)
 import GHC.Word (Word32)
 import GHC.Word.Compat (pattern W32#)
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -49,39 +43,49 @@
 
 pattern Just :: Word32 -> Maybe
 pattern Just i <- Maybe (# | (W32# -> i) #)
-  where Just (W32# i) = Maybe (# | i #)
+  where
+    Just (W32# i) = Maybe (# | i #)
 
 {-# COMPLETE Nothing, Just #-}
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare ma mb = case ma of
+    Just a -> case mb of
+      Just b -> compare a b
+      _ -> GT
+    _ -> case mb of
+      Just{} -> LT
+      _ -> EQ
 
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | w #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 (W32# w)
+    (# | w #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 (W32# w)
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Word32] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Word32]
 maybeToList = maybe [] (: [])
@@ -93,13 +97,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -133,4 +138,3 @@
 
 fromBaseMaybe :: P.Maybe Word32 -> Maybe
 fromBaseMaybe = P.maybe nothing just
-
diff --git a/src/Data/Maybe/Unpacked/Numeric/Word64.hs b/src/Data/Maybe/Unpacked/Numeric/Word64.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Word64.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Word64.hs
@@ -1,16 +1,11 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
 
 module Data.Maybe.Unpacked.Numeric.Word64
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -18,20 +13,19 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where   
+  ) where
 
-import Prelude hiding (Maybe,maybe)
+import Prelude hiding (Maybe, maybe)
 
 import GHC.Base (build)
 import GHC.Exts (Word64#)
-import GHC.Word (Word64(W64#))
+import GHC.Word (Word64 (W64#))
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -39,33 +33,42 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare (Maybe ma) (Maybe mb) = case ma of
+    (# (# #) | #) -> case mb of
+      (# (# #) | #) -> EQ
+      (# | _ #) -> LT
+    (# | a #) -> case mb of
+      (# (# #) | #) -> GT
+      (# | b #) -> compare (W64# a) (W64# b)
 
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | w #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 (W64# w)
+    (# | w #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 (W64# w)
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Word64] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Word64]
 maybeToList = maybe [] (: [])
@@ -77,13 +80,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -117,4 +121,3 @@
 
 fromBaseMaybe :: P.Maybe Word64 -> Maybe
 fromBaseMaybe = P.maybe nothing just
-
diff --git a/src/Data/Maybe/Unpacked/Numeric/Word8.hs b/src/Data/Maybe/Unpacked/Numeric/Word8.hs
--- a/src/Data/Maybe/Unpacked/Numeric/Word8.hs
+++ b/src/Data/Maybe/Unpacked/Numeric/Word8.hs
@@ -1,17 +1,13 @@
-{-# LANGUAGE BangPatterns #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE PatternSynonyms #-}
-{-# LANGUAGE UnboxedSums #-}
 {-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE ViewPatterns #-}
 
 module Data.Maybe.Unpacked.Numeric.Word8
-  ( Maybe(..)
+  ( Maybe (..)
   , just
   , nothing
-
   , maybe
-
   , isJust
   , isNothing
   , fromMaybe
@@ -19,21 +15,23 @@
   , maybeToList
   , catMaybes
   , mapMaybe
-
   , toBaseMaybe
   , fromBaseMaybe
-  ) where  
+    -- * Patterns
+  , pattern Nothing
+  , pattern Just
+  ) where
 
-import Prelude hiding (Maybe,maybe)
+import Prelude hiding (Just, Maybe, Nothing, maybe)
 
 import GHC.Base (build)
 import GHC.Exts (Word#)
 import GHC.Word (Word8)
 import GHC.Word.Compat (pattern W8#)
 
-import GHC.Read (Read(readPrec))
-import Text.Read (parens, Lexeme(Ident), lexP, (+++))
+import GHC.Read (Read (readPrec))
 import Text.ParserCombinators.ReadPrec (prec, step)
+import Text.Read (Lexeme (Ident), lexP, parens, (+++))
 
 import qualified Prelude as P
 
@@ -41,33 +39,42 @@
 
 instance Eq Maybe where
   ma == mb =
-    maybe (isNothing mb)
-          (\a -> maybe False (\b -> a == b) mb) ma
-    
+    maybe
+      (isNothing mb)
+      (\a -> maybe False (\b -> a == b) mb)
+      ma
+
 instance Ord Maybe where
-  compare ma mb = maybe LT (\a -> maybe GT (compare a) mb) ma  
+  compare ma mb = case ma of
+    Just a -> case mb of
+      Just b -> compare a b
+      _ -> GT
+    _ -> case mb of
+      Just{} -> LT
+      _ -> EQ
 
 instance Show Maybe where
   showsPrec p (Maybe m) = case m of
     (# (# #) | #) -> showString "nothing"
-    (# | w #) -> showParen (p > 10)
-      $ showString "just "
-      . showsPrec 11 (W8# w)
+    (# | w #) ->
+      showParen (p > 10) $
+        showString "just "
+          . showsPrec 11 (W8# w)
 
 instance Read Maybe where
   readPrec = parens $ nothingP +++ justP
-    where
-      nothingP = do
-        Ident "nothing" <- lexP
-        return nothing
-      justP = prec 10 $ do
-        Ident "just" <- lexP
-        a <- step readPrec
-        return (just a)
+   where
+    nothingP = do
+      Ident "nothing" <- lexP
+      return nothing
+    justP = prec 10 $ do
+      Ident "just" <- lexP
+      a <- step readPrec
+      return (just a)
 
 listToMaybe :: [Word8] -> Maybe
 listToMaybe [] = nothing
-listToMaybe (x:_) = just x
+listToMaybe (x : _) = just x
 
 maybeToList :: Maybe -> [Word8]
 maybeToList = maybe [] (: [])
@@ -79,13 +86,14 @@
 mapMaybe _ [] = []
 mapMaybe f (a : as) =
   let ws = mapMaybe f as
-  in maybe ws (: ws) (f a)
+   in maybe ws (: ws) (f a)
 {-# NOINLINE [1] mapMaybe #-}
 
 {-# RULES
-"mapMaybe"     [~1] forall f xs. mapMaybe f xs
-                    = build (\c n -> foldr (mapMaybeFB c f) n xs)
-"mapMaybeList" [1]  forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
+"mapMaybe" [~1] forall f xs.
+  mapMaybe f xs =
+    build (\c n -> foldr (mapMaybeFB c f) n xs)
+"mapMaybeList" [1] forall f. foldr (mapMaybeFB (:) f) [] = mapMaybe f
   #-}
 
 {-# NOINLINE [0] mapMaybeFB #-}
@@ -120,3 +128,12 @@
 fromBaseMaybe :: P.Maybe Word8 -> Maybe
 fromBaseMaybe = P.maybe nothing just
 
+pattern Nothing :: Maybe
+pattern Nothing = Maybe (# (# #) | #)
+
+pattern Just :: Word8 -> Maybe
+pattern Just i <- Maybe (# | (W8# -> i) #)
+  where
+    Just (W8# i) = Maybe (# | i #)
+
+{-# COMPLETE Nothing, Just #-}
diff --git a/test/laws.hs b/test/laws.hs
--- a/test/laws.hs
+++ b/test/laws.hs
@@ -1,29 +1,29 @@
-{-# LANGUAGE MagicHash        #-}
-{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE MagicHash #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
 
-import Test.QuickCheck.Arbitrary
-import Test.QuickCheck.Gen
-import Test.QuickCheck.Classes
 import Data.Proxy (Proxy (Proxy))
 import GHC.Exts
+import Test.QuickCheck.Arbitrary
+import Test.QuickCheck.Classes
+import Test.QuickCheck.Gen
 
-import qualified Data.Maybe.Unpacked.Numeric.Complex.Float  as MComplexFloat
 import qualified Data.Maybe.Unpacked.Numeric.Complex.Double as MComplexDouble
+import qualified Data.Maybe.Unpacked.Numeric.Complex.Float as MComplexFloat
 
-import qualified Data.Maybe.Unpacked.Numeric.Float  as MFloat
 import qualified Data.Maybe.Unpacked.Numeric.Double as MDouble
+import qualified Data.Maybe.Unpacked.Numeric.Float as MFloat
 
-import qualified Data.Maybe.Unpacked.Numeric.Int    as MInt
-import qualified Data.Maybe.Unpacked.Numeric.Int8   as MInt8
-import qualified Data.Maybe.Unpacked.Numeric.Int16  as MInt16
-import qualified Data.Maybe.Unpacked.Numeric.Int32  as MInt32
-import qualified Data.Maybe.Unpacked.Numeric.Int64  as MInt64
+import qualified Data.Maybe.Unpacked.Numeric.Int as MInt
+import qualified Data.Maybe.Unpacked.Numeric.Int16 as MInt16
+import qualified Data.Maybe.Unpacked.Numeric.Int32 as MInt32
+import qualified Data.Maybe.Unpacked.Numeric.Int64 as MInt64
+import qualified Data.Maybe.Unpacked.Numeric.Int8 as MInt8
 
-import qualified Data.Maybe.Unpacked.Numeric.Word   as MWord
-import qualified Data.Maybe.Unpacked.Numeric.Word8  as MWord8
+import qualified Data.Maybe.Unpacked.Numeric.Word as MWord
 import qualified Data.Maybe.Unpacked.Numeric.Word16 as MWord16
 import qualified Data.Maybe.Unpacked.Numeric.Word32 as MWord32
 import qualified Data.Maybe.Unpacked.Numeric.Word64 as MWord64
+import qualified Data.Maybe.Unpacked.Numeric.Word8 as MWord8
 
 main :: IO ()
 main = lawsCheckMany allPropsApplied
@@ -34,17 +34,21 @@
   , Ord a
   , Show a
   , Read a
-  ) => Proxy a -> [Laws]
-allLaws p = map ($ p)
-  [ eqLaws, ordLaws, showReadLaws
-  ]
-
+  ) =>
+  Proxy a ->
+  [Laws]
+allLaws p =
+  map
+    ($ p)
+    [ eqLaws
+    , ordLaws
+    , showReadLaws
+    ]
 
 allPropsApplied :: [(String, [Laws])]
 allPropsApplied =
   [ ("Maybe (Complex Float)", map ($ (Proxy :: Proxy MComplexFloat.Maybe)) [eqLaws, showReadLaws])
   , ("Maybe (Complex Double)", map ($ (Proxy :: Proxy MComplexDouble.Maybe)) [eqLaws, showReadLaws])
-
   , ("Maybe Float", allLaws (Proxy :: Proxy MFloat.Maybe))
   , ("Maybe Double", allLaws (Proxy :: Proxy MDouble.Maybe))
   , ("Maybe Int8", allLaws (Proxy :: Proxy MInt8.Maybe))
@@ -78,16 +82,16 @@
     pure (MComplexDouble.Complex (unDouble x) (unDouble y))
 
 instance Arbitrary MComplexFloat.Maybe where
-  arbitrary = frequency [(1,pure MComplexFloat.nothing), (1, MComplexFloat.just <$> arbitrary)]
+  arbitrary = frequency [(1, pure MComplexFloat.nothing), (1, MComplexFloat.just <$> arbitrary)]
 
 instance Arbitrary MComplexDouble.Maybe where
-  arbitrary = frequency [(1,pure MComplexDouble.nothing), (1, MComplexDouble.just <$> arbitrary)]
+  arbitrary = frequency [(1, pure MComplexDouble.nothing), (1, MComplexDouble.just <$> arbitrary)]
 
 instance Arbitrary MFloat.Maybe where
-  arbitrary = frequency [(1,pure MFloat.nothing), (1, MFloat.just <$> arbitrary)]
+  arbitrary = frequency [(1, pure MFloat.nothing), (1, MFloat.just <$> arbitrary)]
 
 instance Arbitrary MDouble.Maybe where
-  arbitrary = frequency [(1,pure MDouble.nothing), (1, MDouble.just <$> arbitrary)]
+  arbitrary = frequency [(1, pure MDouble.nothing), (1, MDouble.just <$> arbitrary)]
 
 instance Arbitrary MWord8.Maybe where
   arbitrary = frequency [(1, pure MWord8.nothing), (1, MWord8.just <$> arbitrary)]
diff --git a/unpacked-maybe-numeric.cabal b/unpacked-maybe-numeric.cabal
--- a/unpacked-maybe-numeric.cabal
+++ b/unpacked-maybe-numeric.cabal
@@ -1,7 +1,7 @@
-cabal-version: 2.2
-name: unpacked-maybe-numeric
-version: 0.1.3.0
-synopsis: maybes of numeric values with fewer indirections
+cabal-version:   3.0
+name:            unpacked-maybe-numeric
+version:         0.1.3.1
+synopsis:        maybes of numeric values with fewer indirections
 description:
   This library provides one `Maybe` type per the usual numeric types:
   Float, Double, Complex {Float|Double}, Int{8|16|32|64}, and Word{8|16|32|64|128}
@@ -11,65 +11,73 @@
   the `Maybe` is just a wrapper around the underlying type, with out-of-bounds corresponding
   to the `Nothing` value. Thus, the use of these constructors is unsafe, as this is only
   checked internally.
-homepage: https://github.com/andrewthad/unpacked-maybe-numeric#readme
-bug-reports: https://github.com/andrewthad/unpacked-maybe-numeric/issues
-author: Andrew Martin, chessai
-maintainer: andrew.thaddeus@gmail.com, chessai1996@gmail.com
-category: Data
-copyright: 2018 Andrew Martin
-license: BSD-3-Clause
-license-file: LICENSE
-build-type: Simple
-extra-source-files: README.md
 
-source-repository head
-  type: git
-  location: https://github.com/andrewthad/unpacked-maybe-numeric
+homepage:        https://github.com/byteverse/unpacked-maybe-numeric
+bug-reports:     https://github.com/byteverse/unpacked-maybe-numeric/issues
+author:          Andrew Martin, chessai
+maintainer:      amartin@layer3com.com, chessai1996@gmail.com
+category:        Data
+copyright:       2018 Andrew Martin
+license:         BSD-3-Clause
+license-file:    LICENSE
+build-type:      Simple
+extra-doc-files:
+  CHANGELOG.md
+  README.md
 
+tested-with:     GHC ==9.4.8 || ==9.6.3 || ==9.8.1
+
+common build-settings
+  default-language: Haskell2010
+  ghc-options:      -Wall -Wunused-packages
+
 library
+  import:          build-settings
   exposed-modules:
-    Data.Maybe.Unpacked.Numeric.Complex.Float
     Data.Maybe.Unpacked.Numeric.Complex.Double
-    Data.Maybe.Unpacked.Numeric.Float
+    Data.Maybe.Unpacked.Numeric.Complex.Float
     Data.Maybe.Unpacked.Numeric.Double
+    Data.Maybe.Unpacked.Numeric.Float
     Data.Maybe.Unpacked.Numeric.Int
-    Data.Maybe.Unpacked.Numeric.Int8
     Data.Maybe.Unpacked.Numeric.Int16
     Data.Maybe.Unpacked.Numeric.Int32
     Data.Maybe.Unpacked.Numeric.Int64
+    Data.Maybe.Unpacked.Numeric.Int8
     Data.Maybe.Unpacked.Numeric.Word
-    Data.Maybe.Unpacked.Numeric.Word8
+    Data.Maybe.Unpacked.Numeric.Word128
     Data.Maybe.Unpacked.Numeric.Word16
     Data.Maybe.Unpacked.Numeric.Word32
     Data.Maybe.Unpacked.Numeric.Word64
-    Data.Maybe.Unpacked.Numeric.Word128
-  hs-source-dirs: src
+    Data.Maybe.Unpacked.Numeric.Word8
+
+  hs-source-dirs:  src
   build-depends:
-    , base >=4.17.1.0 && <5
-    , primitive >= 0.6.4
-    , wide-word >= 0.1.0.8 && < 0.2
-    , word-compat >= 0.0.4 && <0.1
-  ghc-options: -Wall -O2
-  default-language: Haskell2010
+    , base         >=4.17.1.0 && <5
+    , wide-word    >=0.1.0.8  && <0.2
+    , word-compat  >=0.0.4    && <0.1
 
+  ghc-options:     -O2
+
 test-suite spec
-  default-language: Haskell2010
-  ghc-options: -Wall
-  type: exitcode-stdio-1.0
-  main-is: spec.hs
+  import:         build-settings
+  type:           exitcode-stdio-1.0
+  main-is:        spec.hs
   hs-source-dirs: test
   build-depends:
     , base
     , unpacked-maybe-numeric
 
 test-suite laws
-  default-language: Haskell2010
-  ghc-options: -Wall
-  type: exitcode-stdio-1.0
-  main-is: laws.hs
+  import:         build-settings
+  type:           exitcode-stdio-1.0
+  main-is:        laws.hs
   hs-source-dirs: test
   build-depends:
-    , QuickCheck
     , base
+    , QuickCheck
     , quickcheck-classes
     , unpacked-maybe-numeric
+
+source-repository head
+  type:     git
+  location: git://github.com/byteverse/unpacked-maybe-numeric.git
