diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
 For the package version policy (PVP), see  http://pvp.haskell.org/faq .
 
+### 1.3.1.3
+
+_2022-07-14, Andreas Abel_
+
+- Fix an `undefined` in `Show PatternSet` [#37](https://github.com/haskell-hvr/regex-tdfa/issues/37))
+- Document POSIX character classes (e.g. `[[:digit:]]`)
+
+### 1.3.1.2 Revision 1
+
+_2022-05-25, Andreas Abel_
+
+- Allow `base >= 4.17` (GHC 9.4)
+
 ### 1.3.1.2
 
 _2022-02-19, Andreas Abel_
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@
 λ> "alexis-de-tocqueville" =~ "[a-z]+" :: String
 >>> "alexis"
 
-λ> "alexis-de-tocqueville" =~ "[0-9]+" :: String
+λ> "alexis-de-tocqueville" =~ "[[:digit:]]+" :: String
 >>> ""
 ```
 
@@ -103,7 +103,7 @@
 λ> getAllTextMatches ("john anne yifan" =~ "[a-z]+") :: [String]
 >>> ["john","anne","yifan"]
 
-λ> getAllTextMatches ("0a0b0" =~ "0[a-z]0") :: [String]
+λ> getAllTextMatches ("0a0b0" =~ "0[[:lower:]]0") :: [String]
 >>> ["0a0"]
 ```
 Note that `"0b0"` is not included in the result since it overlaps with `"0a0"`.
@@ -120,6 +120,17 @@
 * `\b` &mdash; Match beginning or end of word
 * `\B` &mdash; Match neither beginning nor end of word
 
+While shorthands like `\d` (for digit) are not recognized, one can use the respective
+POSIX character class inside `[...]`.  E.g., `[[:digit:][:lower:]_]` is short for
+`[0-9a-z_]`.  The supported character classes are listed on
+[Wikipedia](https://en.wikipedia.org/w/index.php?title=Regular_expression&oldid=1095256273#Character_classes)
+and defined in module
+[`TNFA`](https://github.com/haskell-hvr/regex-tdfa/blob/95d47cb982d2cf636b2cb6260a866f9907341c45/lib/Text/Regex/TDFA/TNFA.hs#L804-L816).
+
+Please also consult a variant of this documentation which is part of the
+[Text.Regex.TDFA haddock](http://hackage.haskell.org/package/regex-tdfa/docs/Text-Regex-TDFA.html),
+and the original documentation at the [Haskell wiki](https://wiki.haskell.org/Regular_expressions#regex-tdfa).
+
 ### Less common stuff
 
 #### Get match indices
@@ -148,16 +159,6 @@
 
 `regex-tdfa` does not provide find-and-replace.
 
-## The relevant links
-
-This documentation is also available in [Text.Regex.TDFA haddock](http://hackage.haskell.org/package/regex-tdfa-1.2.3.2/docs/Text-Regex-TDFA.html).
-
-This was also documented at the [Haskell wiki](https://wiki.haskell.org/Regular_expressions#regex-tdfa).  The original Darcs repository was at [code.haskell.org](http://code.haskell.org/regex-tdfa/).  When not updated, this was forked and maintained by Roman Cheplyaka as [regex-tdfa-rc](http://hackage.haskell.org/package/regex-tdfa-rc).
-
-Then the repository moved to <https://github.com/ChrisKuklewicz/regex-tdfa>, which was primarily maintained by [Artyom (neongreen)](https://github.com/neongreen).
-
-Finally, maintainership was passed on again and the repository moved to its current location at <https://github.com/haskell-hvr/regex-tdfa>.
-
 ## Avoiding backslashes
 
 If you find yourself writing a lot of regexes, take a look at
@@ -193,10 +194,23 @@
 
 Regardless of performance, nearly every single OS and Libra for POSIX regular expressions has bugs in sub-matches.  This was detailed on the [Regex POSIX Haskell wiki page](https://wiki.haskell.org/Regex_Posix), and can be demonstrated with the [regex-posix-unittest](http://hackage.haskell.org/package/regex-posix-unittest) suite of checks.  Test [regex-tdfa-unittest](http://hackage.haskell.org/package/regex-tdfa-unittest) should show regex-tdfa passing these same checks.  I owe my understanding of the correct behvior and many of these unit tests to Glenn Fowler at AT&T ("An Interpretation of the POSIX regex Standard").
 
+### Maintainance history
+
+The original Darcs repository was at [code.haskell.org](http://code.haskell.org/regex-tdfa/).
+For a while a fork was maintained by Roman Cheplyaka as
+[regex-tdfa-rc](http://hackage.haskell.org/package/regex-tdfa-rc).
+
+Then the repository moved to <https://github.com/ChrisKuklewicz/regex-tdfa>,
+which was primarily maintained by [Artyom (neongreen)](https://github.com/neongreen).
+
+Finally, maintainership was passed on again and the repository moved to its current location
+at <https://github.com/haskell-hvr/regex-tdfa>.
+
 ## Other related packages
 
-You can find several other related packages by searching for "tdfa" on [hackage](http://hackage.haskell.org/packages/search?terms=tdfa).
+Searching for "tdfa" on [hackage](http://hackage.haskell.org/packages/search?terms=tdfa)
+finds some related packages (unmaintained as of 2022-07-14).
 
 ## Document notes
 
-This was written 2016-04-30.
+This README was originally written 2016-04-30.
diff --git a/lib/Text/Regex/TDFA/Common.hs b/lib/Text/Regex/TDFA/Common.hs
--- a/lib/Text/Regex/TDFA/Common.hs
+++ b/lib/Text/Regex/TDFA/Common.hs
@@ -94,7 +94,7 @@
   , newSyntax :: Bool        -- ^ False in blankCompOpt, True in defaultCompOpt. Add the extended non-POSIX syntax described in "Text.Regex.TDFA" haddock documentation.
   , lastStarGreedy ::  Bool  -- ^ False by default.  This is POSIX correct but it takes space and is slower.
                             -- Setting this to true will improve performance, and should be done
-                            -- if you plan to set the captureGroups execoption to False.
+                            -- if you plan to set the captureGroups ExecOption to False.
   } deriving (Read,Show)
 
 data ExecOption = ExecOption {
@@ -226,7 +226,7 @@
                    , dt_a,dt_b :: DT      -- ^ use dt_a if test is True else use dt_b
                    }
 
--- | Internal type to repesent the commands for the tagged transition.
+-- | Internal type to represent the commands for the tagged transition.
 -- The outer IntMap is for the destination Index and the inner IntMap
 -- is for the Source Index.  This is convenient since all runtime data
 -- going to the same destination must be compared to find the best.
@@ -246,7 +246,7 @@
 -- Maximize Tag), the middle positions in the Seq, and the final
 -- position is NOT saved in the Orbits (only in a Maximize Tag).
 --
--- The orderinal code is being written XXX TODO document it.
+-- The original code is being written XXX TODO document it.
 data Orbits = Orbits
   { inOrbit :: !Bool        -- True if enterOrbit, False if LeaveOrbit
   , basePos :: Position
diff --git a/lib/Text/Regex/TDFA/CorePattern.hs b/lib/Text/Regex/TDFA/CorePattern.hs
--- a/lib/Text/Regex/TDFA/CorePattern.hs
+++ b/lib/Text/Regex/TDFA/CorePattern.hs
@@ -35,8 +35,10 @@
                                   ,patternToQ,cleanNullView,cannotAccept,mustAccept) where
 
 import Control.Monad (liftM2, forM, replicateM)
-import Control.Monad.RWS {- all -}
+import Control.Monad.RWS (RWS, runRWS, ask, local, listens, tell, get, put)
+
 import Data.Array.IArray(Array,(!),accumArray,listArray)
+import Data.Either (partitionEithers, rights)
 import Data.List(sort)
 import Data.IntMap.EnumMap2(EnumMap)
 import qualified Data.IntMap.EnumMap2 as Map(singleton,null,assocs,keysSet)
@@ -44,6 +46,7 @@
 import Data.IntSet.EnumSet2(EnumSet)
 import qualified Data.IntSet.EnumSet2 as Set(singleton,toList,isSubsetOf)
 import Data.Semigroup as Sem
+
 import Text.Regex.TDFA.Common {- all -}
 import Text.Regex.TDFA.Pattern(Pattern(..),starTrans)
 -- import Debug.Trace
@@ -269,7 +272,7 @@
 -- favoring pushing Apply into the child postTag makes PGroup happier
 
 type PM = RWS (Maybe GroupIndex) [Either Tag GroupInfo] ([OP]->[OP],Tag)
-type HHQ = HandleTag  -- m1 : info about left boundaary / preTag
+type HHQ = HandleTag  -- m1 : info about left boundary / preTag
         -> HandleTag  -- m2 : info about right boundary / postTag
         -> PM Q
 
@@ -278,18 +281,6 @@
 makeGroupArray maxGroupIndex groups = accumArray (\earlier later -> later:earlier) [] (1,maxGroupIndex) filler
     where filler = map (\gi -> (thisIndex gi,gi)) groups
 
-fromRight :: [Either Tag GroupInfo] -> [GroupInfo]
-fromRight [] = []
-fromRight ((Right x):xs) = x:fromRight xs
-fromRight ((Left _):xs) = fromRight xs
-
-partitionEither :: [Either Tag GroupInfo] -> ([Tag],[GroupInfo])
-partitionEither = helper id id where
-  helper :: ([Tag]->[Tag]) -> ([GroupInfo]->[GroupInfo]) -> [Either Tag GroupInfo] -> ([Tag],[GroupInfo])
-  helper ls rs [] = (ls [],rs [])
-  helper ls rs ((Right x):xs) = helper  ls      (rs.(x:)) xs
-  helper ls rs ((Left  x):xs) = helper (ls.(x:)) rs       xs
-
 -- Partial function: assumes starTrans has been run on the Pattern
 -- Note that the lazy dependency chain for this very zigzag:
 --   varies information is sent up the tree
@@ -305,7 +296,7 @@
 patternToQ compOpt (pOrig,(maxGroupIndex,_)) = (tnfa,aTags,aGroups) where
   (tnfa,(tag_dlist,nextTag),groups) = runRWS monad startReader startState
   aTags = listArray (0,pred nextTag) (tag_dlist [])
-  aGroups = makeGroupArray maxGroupIndex (fromRight groups)
+  aGroups = makeGroupArray maxGroupIndex (rights groups)
 
   -- implicitly inside a PGroup 0 converted into a GroupInfo 0 undefined 0 1
   monad = go (starTrans pOrig) (Advice 0) (Advice 1)
@@ -354,8 +345,7 @@
   -- withOrbit uses MonadWriter(listens to makeOrbit/Left), collects
   -- children at all depths
   withOrbit :: PM a -> PM (a,[Tag])
-  withOrbit = listens childStars
-    where childStars x = let (ts,_) = partitionEither x in ts
+  withOrbit = listens $ fst . partitionEithers
 
   {-# INLINE makeGroup #-}
   -- makeGroup usesMonadWriter(tell/Right)
@@ -380,7 +370,7 @@
   withParent :: GroupIndex -> PM a -> PM (a,[Tag])
   withParent this = local (const (Just this)) . listens childGroupInfo
     where childGroupInfo x =
-            let (_,gs) = partitionEither x
+            let gs = snd $ partitionEithers x
                 children :: [GroupIndex]
                 children = norep . sort . map thisIndex
                            -- filter to get only immediate children (efficiency)
@@ -389,7 +379,7 @@
 
   -- combineConcat is a partial function: Must not pass in an empty list
   -- Policy choices:
-  --  * pass tags to apply to children and have no preTag or postTag here (so none addded to nullQ)
+  --  * pass tags to apply to children and have no preTag or postTag here (so none added to nullQ)
   --  * middle 'mid' tag: give to left/front child as postTag so a Group there might claim it as a stopTag
   --  * if parent is Group then preReset will become non-empty
   combineConcat :: [Pattern] -> HHQ
@@ -465,7 +455,7 @@
                newUniq = if needUniqTags then uniq "POr branch" else return bAdvice
 --           trace ("\nPOr sub "++show aAdvice++" "++show bAdvice++"needsTags is "++show needTags) $ return ()
            -- The "bs" values are allocated in left-to-right order before the children in "qs"
-           -- optimiztion: low priority for last branch is implicit, do not create separate tag here.
+           -- optimization: low priority for last branch is implicit, do not create separate tag here.
            bs <- fmap (++[bAdvice]) $ replicateM (pred $ length branches) newUniq -- 2 <= length ps
            -- create all the child branches in left-to-right order after the "bs"
            qs <- forM (zip branches bs) (\(branch,bTag) ->  (go branch aAdvice bTag))
@@ -544,7 +534,7 @@
          --
          -- If the parent index is Nothing then this is part of a
          -- non-capturing subtree and ignored.  This is a lazy and
-         -- efficient alternative to rebuidling the tree with PGroup
+         -- efficient alternative to rebuilding the tree with PGroup
          -- Nothing replacing PGroup (Just _).
          --
          -- Guarded by the getParentIndex /= Nothing check is the
@@ -593,7 +583,7 @@
          -- PNonEmpty means the child pattern p can be skipped by
          -- bypassing the pattern.  This is only used in the case p
          -- can accept 0 and can accept more than zero characters
-         -- (thus the assertions, enforcted by CorePattern.starTrans).
+         -- (thus the assertions, enforced by CorePattern.starTrans).
          -- The important thing about this case is intercept the
          -- "accept 0" possibility and replace with "skip".
          PNonEmpty p -> mdo
diff --git a/lib/Text/Regex/TDFA/NewDFA/Engine.hs b/lib/Text/Regex/TDFA/NewDFA/Engine.hs
--- a/lib/Text/Regex/TDFA/NewDFA/Engine.hs
+++ b/lib/Text/Regex/TDFA/NewDFA/Engine.hs
@@ -178,7 +178,7 @@
 -- position and the basePos position.  Entries in different groups
 -- will never be comparable in the future so they can be processed
 -- separately.  Groups could probably be even more finely
--- distinguished, as a futher optimization, but the justification will
+-- distinguished, as a further optimization, but the justification will
 -- be tricky.
 --
 -- Current Tag-0 values are at most offset and all newly spawned
@@ -193,7 +193,7 @@
 -- is avoided.
 --
 -- An entry in a group can only collide with that group's
--- descendents. compressOrbit sends each group to the compressGroup
+-- descendants. compressOrbit sends each group to the compressGroup
 -- command.
 --
 -- compressGroup on a single record checks whether it's Seq can be
@@ -201,19 +201,19 @@
 -- this this not particularly important).
 --
 -- compressGroup on many records sorts and groups the members and zips
--- the groups with their new ordinal value.  The comparision is based
+-- the groups with their new ordinal value.  The comparison is based
 -- on the old ordinal value, then the inOrbit value, and then the (Seq
 -- Position) data.
 --
 -- The old ordinals of the group will all be Nothing or all be Just,
 -- but this condition is neither checked nor violations detected.
--- This comparision is justified because once records get different
+-- This comparison is justified because once records get different
 -- ordinals assigned they will never change places.
 --
 -- The inOrbit Bool is only different if one of them has set the stop
--- position to at most (succ offset).  They will obly be compared if
+-- position to at most (succ offset).  They will only be compared if
 -- the other one leaves, an its stop position will be at least offset.
--- The previous sentence is justified by inspectin of the "assemble"
+-- The previous sentence is justified by inspection of the "assemble"
 -- function in the TDFA module: there is no (PostUpdate
 -- LeaveOrbitTask) so the largest possible value for the stop Tag is
 -- (pred offset). Thus the record with inOrbit==False would beat (be
@@ -221,7 +221,7 @@
 --
 -- The Seq comparison is safe because the largest existing Position
 -- value is (pred offset) and the smallest future Position value is
--- offset.  The previous sentence is justified by inspectin of the
+-- offset.  The previous sentence is justified by inspection of the
 -- "assemble" function in the TDFA module: there is no (PostUpdate
 -- EnterOrbitTags) so the largest possible value in the Seq is (pred
 -- offset).
@@ -323,7 +323,7 @@
 -- A non-empty winner from the startState might obscure a potential
 -- empty winner (form the startState at the current offset).  This
 -- winEmpty possibility is also checked for. (unit test pattern ".*")
--- (futher test "(.+|.+.)*" on "aa\n")
+-- (further test "(.+|.+.)*" on "aa\n")
 
         {-# INLINE processWinner #-}
         processWinner s1 did dt w offset = {-# SCC "goNext.newWinnerThenProceed" #-} do
@@ -716,7 +716,7 @@
 -- This has been updated for ghc 6.8.3 and still works with ghc 6.10.1
 {-# INLINE copySTU #-}
 copySTU :: (Show i,Ix i,MArray (STUArray s) e (S.ST s)) => STUArray s i e -> STUArray s i e -> S.ST s () -- (STUArray s i e)
-copySTU _souce@(STUArray _ _ _ msource) _destination@(STUArray _ _ _ mdest) =
+copySTU _source@(STUArray _ _ _ msource) _destination@(STUArray _ _ _ mdest) =
 -- do b1 <- getBounds s1
 --  b2 <- getBounds s2
 --  when (b1/=b2) (error ("\n\nWTF copySTU: "++show (b1,b2)))
diff --git a/lib/Text/Regex/TDFA/NewDFA/Engine_FA.hs b/lib/Text/Regex/TDFA/NewDFA/Engine_FA.hs
--- a/lib/Text/Regex/TDFA/NewDFA/Engine_FA.hs
+++ b/lib/Text/Regex/TDFA/NewDFA/Engine_FA.hs
@@ -115,14 +115,14 @@
 -- compressOrbit.
 --
 -- compressOrbit on such a Tag loops through all the NFS states'
--- m_orbit record, discardind ones that are Nothing and discarding
+-- m_orbit record, discarding ones that are Nothing and discarding
 -- ones that are too new to care about (after the cutoff value).
 --
 -- compressOrbit then groups the Orbits records by the Tag-0 start
--- position and the basePos position.  Entried in different groups
+-- position and the basePos position.  Entries in different groups
 -- will never be comparable in the future so they can be processed
 -- separately.  Groups could probably be even more finely
--- distinguished, as a futher optimization, but the justification will
+-- distinguished, as a further optimization, but the justification will
 -- be tricky.
 --
 -- Current Tag-0 values are at most offset and all newly spawned
@@ -137,7 +137,7 @@
 -- is avoided.
 --
 -- An entry in a group can only collide with that group's
--- descendents. compressOrbit sends each group to the compressGroup
+-- descendants. compressOrbit sends each group to the compressGroup
 -- command.
 --
 -- compressGroup on a single record checks whether it's Seq can be
@@ -145,19 +145,19 @@
 -- this this not particularly important).
 --
 -- compressGroup on many records sorts and groups the members and zips
--- the groups with their new ordinal value.  The comparision is based
+-- the groups with their new ordinal value.  The comparison is based
 -- on the old ordinal value, then the inOrbit value, and then the (Seq
 -- Position) data.
 --
 -- The old ordinals of the group will all be Nothing or all be Just,
 -- but this condition is neither checked nor violations detected.
--- This comparision is justified because once records get different
+-- This comparison is justified because once records get different
 -- ordinals assigned they will never change places.
 --
 -- The inOrbit Bool is only different if one of them has set the stop
 -- position to at most (succ offset).  They will obly be compared if
 -- the other one leaves, an its stop position will be at least offset.
--- The previous sentence is justified by inspectin of the "assemble"
+-- The previous sentence is justified by inspection of the "assemble"
 -- function in the TDFA module: there is no (PostUpdate
 -- LeaveOrbitTask) so the largest possible value for the stop Tag is
 -- (pred offset). Thus the record with inOrbit==False would beat (be
@@ -165,7 +165,7 @@
 --
 -- The Seq comparison is safe because the largest existing Position
 -- value is (pred offset) and the smallest future Position value is
--- offset.  The previous sentence is justified by inspectin of the
+-- offset.  The previous sentence is justified by inspection of the
 -- "assemble" function in the TDFA module: there is no (PostUpdate
 -- EnterOrbitTags) so the largest possible value in the Seq is (pred
 -- offset).
@@ -269,7 +269,7 @@
 -- A non-empty winner from the startState might obscure a potential
 -- empty winner (form the startState at the current offset).  This
 -- winEmpty possibility is also checked for. (unit test pattern ".*")
--- (futher test "(.+|.+.)*" on "aa\n")
+-- (further test "(.+|.+.)*" on "aa\n")
 
         {-# INLINE processWinner #-}
         processWinner :: MScratch s -> IntMap Instructions -> Position -> ST s ()
@@ -613,7 +613,7 @@
 -- This has been updated for ghc 6.8.3 and still works with ghc 6.10.1
 {-# INLINE copySTU #-}
 copySTU :: (Show i,Ix i,MArray (STUArray s) e (S.ST s)) => STUArray s i e -> STUArray s i e -> S.ST s () -- (STUArray s i e)
-copySTU _souce@(STUArray _ _ _ msource) _destination@(STUArray _ _ _ mdest) =
+copySTU _source@(STUArray _ _ _ msource) _destination@(STUArray _ _ _ mdest) =
 -- do b1 <- getBounds s1
 --  b2 <- getBounds s2
 --  when (b1/=b2) (error ("\n\nWTF copySTU: "++show (b1,b2)))
diff --git a/lib/Text/Regex/TDFA/Pattern.hs b/lib/Text/Regex/TDFA/Pattern.hs
--- a/lib/Text/Regex/TDFA/Pattern.hs
+++ b/lib/Text/Regex/TDFA/Pattern.hs
@@ -1,6 +1,9 @@
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-}
+
 -- | This "Text.Regex.TDFA.Pattern" module provides the 'Pattern' data
 -- type and its subtypes.  This 'Pattern' type is used to represent
 -- the parsed form of a Regular Expression.
+
 module Text.Regex.TDFA.Pattern
     (Pattern(..)
     ,PatternSet(..)
@@ -105,9 +108,9 @@
     in shows charSpec
        . showsPrec i scc' . showsPrec i sce' . showsPrec i sec'
        . if '-' `elem` special then showChar '-' else id
-    where byRange xAll@(x:xs) | length xAll <=3 = xAll
-                              | otherwise = groupRange x 1 xs
-          byRange _ = undefined
+    where byRange xAll@(~(x:xs))
+            | length xAll <=3 = xAll
+            | otherwise       = groupRange x 1 xs
           groupRange x n (y:ys) = if (fromEnum y)-(fromEnum x) == n then groupRange x (succ n) ys
                                   else (if n <=3 then take n [x..]
                                         else x:'-':(toEnum (pred n+fromEnum x)):[]) ++ groupRange y 1 ys
@@ -139,7 +142,7 @@
 starTrans :: Pattern -> Pattern
 starTrans = dfsPattern (simplify' . starTrans')
 
--- | Apply a Pattern transfomation function depth first
+-- | Apply a Pattern transformation function depth first
 dfsPattern :: (Pattern -> Pattern)  -- ^ The transformation function
            -> Pattern               -- ^ The Pattern to transform
            -> Pattern               -- ^ The transformed Pattern
diff --git a/lib/Text/Regex/TDFA/ReadRegex.hs b/lib/Text/Regex/TDFA/ReadRegex.hs
--- a/lib/Text/Regex/TDFA/ReadRegex.hs
+++ b/lib/Text/Regex/TDFA/ReadRegex.hs
@@ -33,7 +33,7 @@
 p_regex :: CharParser (GroupIndex,Int) Pattern
 p_regex = liftM POr $ sepBy1 p_branch (char '|')
 
--- man re_format helps alot, it says one-or-more pieces so this is
+-- man re_format helps a lot, it says one-or-more pieces so this is
 -- many1 not many.  Use "()" to indicate an empty piece.
 p_branch = liftM PConcat $ many1 p_piece
 
diff --git a/lib/Text/Regex/TDFA/String.hs b/lib/Text/Regex/TDFA/String.hs
--- a/lib/Text/Regex/TDFA/String.hs
+++ b/lib/Text/Regex/TDFA/String.hs
@@ -66,7 +66,7 @@
           rest = map fst (tail (elems mt)) -- will be []
       in Right (Just (pre,main,post,rest))
 
--- Minimal defintion for now
+-- Minimal definition for now
 instance RegexLike Regex String where
   matchOnce r s = listToMaybe (matchAll r s)
   matchAll r s = execMatch r 0 '\n' s
diff --git a/lib/Text/Regex/TDFA/TDFA.hs b/lib/Text/Regex/TDFA/TDFA.hs
--- a/lib/Text/Regex/TDFA/TDFA.hs
+++ b/lib/Text/Regex/TDFA/TDFA.hs
@@ -1,5 +1,5 @@
 -- | "Text.Regex.TDFA.TDFA" converts the QNFA from TNFA into the DFA.
--- A DFA state corresponds to a Set of QNFA states, repesented as list
+-- A DFA state corresponds to a Set of QNFA states, represented as list
 -- of Index which are used to lookup the DFA state in a lazy Trie
 -- which holds all possible subsets of QNFA states.
 module Text.Regex.TDFA.TDFA(patternToRegex,DFA(..),DT(..)
diff --git a/lib/Text/Regex/TDFA/TNFA.hs b/lib/Text/Regex/TDFA/TNFA.hs
--- a/lib/Text/Regex/TDFA/TNFA.hs
+++ b/lib/Text/Regex/TDFA/TNFA.hs
@@ -11,7 +11,7 @@
 --
 -- This holds every possible way to follow one state by another, while
 -- in the DFA these will be reduced by picking a single best
--- transition for each (soure,destination) pair.  The transitions are
+-- transition for each (source,destination) pair.  The transitions are
 -- heavily and often redundantly annotated with tasks to perform, and
 -- this redundancy is reduced when picking the best transition.  So
 -- far, keeping all this information has helped fix bugs in both the
@@ -19,7 +19,7 @@
 --
 -- The QNFA for a Pattern with a starTraned Q\/P form with N one
 -- character accepting leaves has at most N+1 nodes.  These nodes
--- repesent the future choices after accepting a leaf.  The processing
+-- represent the future choices after accepting a leaf.  The processing
 -- of Or nodes often reduces this number by sharing at the end of the
 -- different paths.  Turning off capturing while compiling the pattern
 -- may (future extension) reduce this further for some patterns by
@@ -71,7 +71,7 @@
 
 qtwin,qtlose :: QT
 -- qtwin is the continuation after matching the whole pattern.  It has
--- no futher transitions and sets tag #1 to the current position.
+-- no further transitions and sets tag #1 to the current position.
 qtwin = Simple {qt_win=[(1,PreUpdate TagTask)],qt_trans=mempty,qt_other=mempty}
 -- qtlose is the continuation to nothing, used when ^ or $ tests fail.
 qtlose = Simple {qt_win=mempty,qt_trans=mempty,qt_other=mempty}
@@ -221,7 +221,7 @@
 -- are handled.
 --
 -- mergeQT_2nd is used by the NonEmpty case and always discards the
--- first argument's win and uses the second argment's win.
+-- first argument's win and uses the second argument's win.
 --
 -- mergeAltQT is used by the Or cases and is biased to the first
 -- argument's winning transition, if present.
@@ -238,7 +238,7 @@
               | nullQT q2 = q1  -- union wins
               | otherwise = mergeQTWith mappend q1 q2 -- no preference, win with combined SetTag XXX is the wrong thing! "(.?)*"
 
--- This takes a function which implements a policy on mergining
+-- This takes a function which implements a policy on merging
 -- winning transitions and then merges all the transitions.  It opens
 -- the CharMap newtype for more efficient operation, then rewraps it.
 mergeQTWith :: (WinTags -> WinTags -> WinTags) -> QT -> QT -> QT
@@ -408,7 +408,7 @@
 getE (eLoop,Just accepting,_) = fromQT (mergeQT (getQT eLoop) (getQT accepting))
 getE (eLoop,Nothing,_) = eLoop
 
--- 2009: See coment for addTest.  Here is a case where the third component might be a (Just qnfa) and it
+-- 2009: See comment for addTest.  Here is a case where the third component might be a (Just qnfa) and it
 -- is being lost even though the added test might be redundant.
 addTestAC :: TestInfo -> ActCont -> ActCont
 addTestAC ti (e,mE,_) = (addTest ti e
@@ -756,7 +756,7 @@
            let trans = toMap mempty . S.toAscList . addNewline . decodePatternSet $ ps
            in Simple { qt_win = mempty, qt_trans = trans, qt_other = target }
          _ -> err ("Cannot acceptTrans pattern "++show (qTop,pIn))
-    where  -- Take a common destination and a sorted list of unique chraceters
+    where  -- Take a common destination and a sorted list of unique characters
            -- and create a map from those characters to the common destination
       toMap :: IntMap [(DoPa,[(Tag, TagUpdate)])] -> [Char]
             -> CharMap (IntMap [(DoPa,[(Tag, TagUpdate)])])
@@ -795,7 +795,7 @@
       withMSEC = foldl (flip S.insert) withMSCC (maybe [] (concatMap unSEC . S.toAscList) msec)
   in withMSEC
 
--- | This returns the disctince ascending list of characters
+-- | This returns the distinct ascending list of characters
 -- represented by [: :] values in legalCharacterClasses; unrecognized
 -- class names return an empty string
 decodeCharacterClass :: PatternSetCharacterClass -> String
diff --git a/regex-tdfa.cabal b/regex-tdfa.cabal
--- a/regex-tdfa.cabal
+++ b/regex-tdfa.cabal
@@ -1,6 +1,6 @@
 cabal-version:          1.12
 name:                   regex-tdfa
-version:                1.3.1.2
+version:                1.3.1.3
 
 build-Type:             Simple
 license:                BSD3
@@ -25,18 +25,19 @@
   test/cases/*.txt
 
 tested-with:
-  GHC == 7.4.2
-  GHC == 7.6.3
-  GHC == 7.8.4
-  GHC == 7.10.3
-  GHC == 8.0.2
-  GHC == 8.2.2
-  GHC == 8.4.4
-  GHC == 8.6.5
-  GHC == 8.8.4
-  GHC == 8.10.7
+  GHC == 9.4.1
+  GHC == 9.2.3
   GHC == 9.0.2
-  GHC == 9.2.1
+  GHC == 8.10.7
+  GHC == 8.8.4
+  GHC == 8.6.5
+  GHC == 8.4.4
+  GHC == 8.2.2
+  GHC == 8.0.2
+  GHC == 7.10.3
+  GHC == 7.8.4
+  GHC == 7.6.3
+  GHC == 7.4.2
 
 source-repository head
   type:                git
@@ -45,7 +46,7 @@
 source-repository this
   type:                git
   location:            https://github.com/haskell-hvr/regex-tdfa.git
-  tag:                 v1.3.1.2
+  tag:                 v1.3.1.3
 
 flag force-O2
   default: False
@@ -96,14 +97,14 @@
   if !impl(ghc >= 8.0)
     build-depends:      fail               == 4.9.*
                       , semigroups         == 0.18.* || == 0.19.*
-  build-depends:        array              >= 0.4 && < 0.6
-                      , base               >= 4.5 && < 4.17
-                      , bytestring         >= 0.9.2 && < 0.12
-                      , containers         >= 0.4.2 && < 0.7
-                      , mtl                >= 2.1.3 && < 2.4
+  build-depends:        array              >= 0.4    && < 0.6
+                      , base               >= 4.5    && < 5
+                      , bytestring         >= 0.9.2  && < 0.12
+                      , containers         >= 0.4.2  && < 0.7
+                      , mtl                >= 2.1.3  && < 2.4
                       , parsec             == 3.1.*
                       , regex-base         == 0.94.*
-                      , text               >= 1.2.3 && < 2.1
+                      , text               >= 1.2.3  && < 2.1
 
   default-language:     Haskell2010
   default-extensions:   BangPatterns
