diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
 *Megaparsec follows [SemVer](https://semver.org/).*
 
+## Megaparsec 9.6.0
+
+* Added the functions `initialState` and `initialPosState` to
+  `Text.Megaparsec.State`. [Issue
+  449](https://github.com/mrkkrp/megaparsec/issues/449).
+
 ## Megaparsec 9.5.0
 
 * Dropped a number of redundant constraints here and there. [PR
diff --git a/Setup.hs b/Setup.hs
deleted file mode 100644
--- a/Setup.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-module Main (main) where
-
-import Distribution.Simple
-
-main :: IO ()
-main = defaultMain
diff --git a/Text/Megaparsec.hs b/Text/Megaparsec.hs
--- a/Text/Megaparsec.hs
+++ b/Text/Megaparsec.hs
@@ -295,24 +295,6 @@
     Error e ->
       (s', Left (toBundle (e :| stateParseErrors s')))
 
--- | Given the name of source file and the input construct the initial state
--- for a parser.
-initialState :: String -> s -> State s e
-initialState name s =
-  State
-    { stateInput = s,
-      stateOffset = 0,
-      statePosState =
-        PosState
-          { pstateInput = s,
-            pstateOffset = 0,
-            pstateSourcePos = initialPos name,
-            pstateTabWidth = defaultTabWidth,
-            pstateLinePrefix = ""
-          },
-      stateParseErrors = []
-    }
-
 ----------------------------------------------------------------------------
 -- Signaling parse errors
 
diff --git a/Text/Megaparsec/State.hs b/Text/Megaparsec/State.hs
--- a/Text/Megaparsec/State.hs
+++ b/Text/Megaparsec/State.hs
@@ -21,7 +21,9 @@
 -- @since 6.5.0
 module Text.Megaparsec.State
   ( State (..),
+    initialState,
     PosState (..),
+    initialPosState,
   )
 where
 
@@ -74,6 +76,24 @@
 
 instance (NFData s, NFData (ParseError s e)) => NFData (State s e)
 
+-- | Given the name of the source file and the input construct the initial
+-- state for a parser.
+--
+-- @since 9.6.0
+initialState ::
+  -- | Name of the file the input is coming from
+  FilePath ->
+  -- | Input
+  s ->
+  State s e
+initialState name s =
+  State
+    { stateInput = s,
+      stateOffset = 0,
+      statePosState = initialPosState name s,
+      stateParseErrors = []
+    }
+
 -- | A special kind of state that is used to calculate line\/column
 -- positions on demand.
 --
@@ -93,3 +113,22 @@
   deriving (Show, Eq, Data, Typeable, Generic)
 
 instance (NFData s) => NFData (PosState s)
+
+-- | Given the name of source file and the input construct the initial
+-- positional state.
+--
+-- @since 9.6.0
+initialPosState ::
+  -- | Name of the file the input is coming from
+  FilePath ->
+  -- | Input
+  s ->
+  PosState s
+initialPosState name s =
+  PosState
+    { pstateInput = s,
+      pstateOffset = 0,
+      pstateSourcePos = initialPos name,
+      pstateTabWidth = defaultTabWidth,
+      pstateLinePrefix = ""
+    }
diff --git a/megaparsec.cabal b/megaparsec.cabal
--- a/megaparsec.cabal
+++ b/megaparsec.cabal
@@ -1,6 +1,6 @@
 cabal-version:   2.4
 name:            megaparsec
-version:         9.5.0
+version:         9.6.0
 license:         BSD-2-Clause
 license-file:    LICENSE.md
 maintainer:      Mark Karpov <markkarpov92@gmail.com>
@@ -9,7 +9,7 @@
     Paolo Martini <paolo@nemail.it>,
     Daan Leijen <daan@microsoft.com>
 
-tested-with:     ghc ==9.2.8 ghc ==9.4.5 ghc ==9.6.2
+tested-with:     ghc ==9.4.7 ghc ==9.6.3 ghc ==9.8.1
 homepage:        https://github.com/mrkkrp/megaparsec
 bug-reports:     https://github.com/mrkkrp/megaparsec/issues
 synopsis:        Monadic parser combinators
@@ -56,25 +56,27 @@
 
     default-language: Haskell2010
     build-depends:
-        base >=4.15 && <5.0,
-        bytestring >=0.2 && <0.12,
+        base >=4.15 && <5,
+        bytestring >=0.2 && <0.13,
         case-insensitive >=1.2 && <1.3,
-        containers >=0.5 && <0.7,
-        deepseq >=1.3 && <1.5,
-        mtl >=2.2.2 && <3.0,
-        parser-combinators >=1.0 && <2.0,
+        containers >=0.5 && <0.8,
+        deepseq >=1.3 && <1.6,
+        mtl >=2.2.2 && <3,
+        parser-combinators >=1.0 && <2,
         scientific >=0.3.7 && <0.4,
-        text >=0.2 && <2.1,
+        text >=0.2 && <2.2,
         transformers >=0.4 && <0.7
 
     if flag(dev)
-        ghc-options: -Wall -Werror -Wpartial-fields -Wunused-packages
+        ghc-options:
+            -Wall -Werror -Wredundant-constraints -Wpartial-fields
+            -Wunused-packages
 
     else
         ghc-options: -O2 -Wall
 
-    if (flag(dev) && !impl(ghc ==9.6.2))
-        ghc-options: -Wredundant-constraints
+    if impl(ghc >=9.8)
+        ghc-options: -Wno-x-partial
 
 benchmark bench-speed
     type:             exitcode-stdio-1.0
@@ -82,13 +84,13 @@
     hs-source-dirs:   bench/speed
     default-language: Haskell2010
     build-depends:
-        base >=4.15 && <5.0,
-        bytestring >=0.2 && <0.12,
-        containers >=0.5 && <0.7,
+        base >=4.15 && <5,
+        bytestring >=0.2 && <0.13,
+        containers >=0.5 && <0.8,
         criterion >=0.6.2.1 && <1.7,
-        deepseq >=1.3 && <1.5,
+        deepseq >=1.3 && <1.6,
         megaparsec,
-        text >=0.2 && <2.1
+        text >=0.2 && <2.2
 
     if flag(dev)
         ghc-options:
@@ -104,12 +106,12 @@
     hs-source-dirs:   bench/memory
     default-language: Haskell2010
     build-depends:
-        base >=4.15 && <5.0,
-        bytestring >=0.2 && <0.12,
-        containers >=0.5 && <0.7,
-        deepseq >=1.3 && <1.5,
+        base >=4.15 && <5,
+        bytestring >=0.2 && <0.13,
+        containers >=0.5 && <0.8,
+        deepseq >=1.3 && <1.6,
         megaparsec,
-        text >=0.2 && <2.1,
+        text >=0.2 && <2.2,
         weigh >=0.0.4
 
     if flag(dev)
