Skip to content

Commit

Permalink
update to megaparsec-9.6.1 (#1609)
Browse files Browse the repository at this point in the history
* Update to `megaparsec-9.6.1`.  This allows us to remove any annoying workaround. 
* Bump stack resolver to LTS-21.19.
* Drop support for GHC 8.10.
  • Loading branch information
byorgey authored Nov 8, 2023
1 parent d63e7d8 commit 96d3062
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 25 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ jobs:
compilerVersion: 9.0.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.10.7
compilerKind: ghc
compilerVersion: 8.10.7
setup-method: ghcup
allow-failure: false
fail-fast: false
steps:
- name: apt
Expand Down
2 changes: 0 additions & 2 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ queue_rules:
- check-success=Haskell-CI - Linux - ghc-9.4.5
- check-success=Haskell-CI - Linux - ghc-9.2.7
- check-success=Haskell-CI - Linux - ghc-9.0.2
- check-success=Haskell-CI - Linux - ghc-8.10.7

pull_request_rules:
- actions:
Expand Down Expand Up @@ -49,7 +48,6 @@ pull_request_rules:
- check-success=Haskell-CI - Linux - ghc-9.4.5
- check-success=Haskell-CI - Linux - ghc-9.2.7
- check-success=Haskell-CI - Linux - ghc-9.0.2
- check-success=Haskell-CI - Linux - ghc-8.10.7
- label=merge me
- ! '#approved-reviews-by>=1'
- ! '#changes-requested-reviews-by=0'
Expand Down
20 changes: 5 additions & 15 deletions src/Swarm/Language/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import Text.Megaparsec hiding (runParser)
import Text.Megaparsec.Char
import Text.Megaparsec.Char.Lexer qualified as L
import Text.Megaparsec.Pos qualified as Pos
import Text.Megaparsec.State (initialPosState, initialState)
import Witch

-- Imports for doctests (cabal-docspec needs this)
Expand Down Expand Up @@ -486,24 +487,13 @@ runParserTH (file, line, col) p s =
Left err -> fail $ errorBundlePretty err
Right e -> return e
where
-- This is annoying --- megaparsec does not export its function to
-- construct an initial parser state, so we can't just use that
-- and then change the one field we need to be different (the
-- 'pstateSourcePos'). We have to copy-paste the whole thing.
initState :: State Text Void
initState =
State
{ stateInput = from s
, stateOffset = 0
, statePosState =
PosState
{ pstateInput = from s
, pstateOffset = 0
, pstateSourcePos = SourcePos file (mkPos line) (mkPos col)
, pstateTabWidth = defaultTabWidth
, pstateLinePrefix = ""
(initialState file (from s))
{ statePosState =
(initialPosState file (from s))
{ pstateSourcePos = SourcePos file (mkPos line) (mkPos col)
}
, stateParseErrors = []
}

-- | Parse some input 'Text' completely as a 'Term', consuming leading
Expand Down
3 changes: 2 additions & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extra-deps:
# breaking changes; see https://github.com/swarm-game/swarm/issues/1350
- lsp-1.6.0.0
- lsp-types-1.6.0.0
- megaparsec-9.6.1
- AhoCorasick-0.0.4
resolver: lts-21.0
resolver: lts-21.19

4 changes: 2 additions & 2 deletions swarm.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ maintainer: byorgey@gmail.com
bug-reports: https://github.com/swarm-game/swarm/issues
copyright: Brent Yorgey 2021
category: Game
tested-with: GHC ==8.10.7 || ==9.0.2 || ==9.2.7 || ==9.4.5 || ==9.6.2
tested-with: GHC ==9.0.2 || ==9.2.7 || ==9.4.5 || ==9.6.2
extra-source-files: CHANGELOG.md
example/*.sw
editors/emacs/*.el
Expand Down Expand Up @@ -277,7 +277,7 @@ library
lens >= 4.19 && < 5.3,
linear >= 1.21.6 && < 1.23,
lsp >= 1.6 && < 1.7,
megaparsec >= 9.0 && < 9.6,
megaparsec >= 9.6.1 && < 9.7,
minimorph >= 0.3 && < 0.4,
transformers >= 0.5 && < 0.7,
mtl >= 2.2.2 && < 2.4,
Expand Down

0 comments on commit 96d3062

Please sign in to comment.