From d4a5d86603a823db02c1b520906beb256922948f Mon Sep 17 00:00:00 2001 From: Lennart Augustsson Date: Sat, 4 Jan 2025 18:19:59 +0100 Subject: [PATCH 1/5] Make it build with MicroHs. --- parsec.cabal | 5 ++--- src/Text/Parsec/Token.hs | 8 +++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/parsec.cabal b/parsec.cabal index b026453..bd8fefc 100644 --- a/parsec.cabal +++ b/parsec.cabal @@ -67,8 +67,7 @@ library base >= 4.12.0.0 && < 4.21, mtl >= 2.2.2 && < 2.4, bytestring >= 0.10.8.2 && < 0.13, - text (>= 1.2.3.0 && < 1.3) - || (>= 2.0 && < 2.2) + text (>= 1.2.3.0 && < 1.3) || (>= 2.0 && < 2.2) default-language: Haskell2010 other-extensions: @@ -86,7 +85,7 @@ library UndecidableInstances ghc-options: -Wall - if impl(ghc >= 8.0) + if impl(ghc >= 8.0) || impl(mhs) ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wno-trustworthy-safe if impl(ghc < 8.8) ghc-options: -Wnoncanonical-monadfail-instances diff --git a/src/Text/Parsec/Token.hs b/src/Text/Parsec/Token.hs index 61868fc..86de45b 100644 --- a/src/Text/Parsec/Token.hs +++ b/src/Text/Parsec/Token.hs @@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PolymorphicComponents #-} +{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- @@ -348,7 +349,7 @@ data GenTokenParser s u m -- > reserved = P.reserved lexer -- > ... -makeTokenParser :: (Stream s m Char) +makeTokenParser :: forall s m u . (Stream s m Char) => GenLanguageDef s u m -> GenTokenParser s u m {-# INLINABLE makeTokenParser #-} makeTokenParser languageDef @@ -390,6 +391,8 @@ makeTokenParser languageDef ----------------------------------------------------------- -- Bracketing ----------------------------------------------------------- + parens, braces, angles, brackets + :: forall a. ParsecT s u m a -> ParsecT s u m a parens p = between (symbol "(") (symbol ")") p braces p = between (symbol "{") (symbol "}") p angles p = between (symbol "<") (symbol ">") p @@ -400,6 +403,8 @@ makeTokenParser languageDef dot = symbol "." colon = symbol ":" + commaSep, semiSep, commaSep1, semiSep1 + :: forall a. ParsecT s u m a -> ParsecT s u m [a] commaSep p = sepBy p comma semiSep p = sepBy p semi @@ -681,6 +686,7 @@ makeTokenParser languageDef symbol name = lexeme (string name) + lexeme :: forall a. ParsecT s u m a -> ParsecT s u m a lexeme p = do{ x <- p; whiteSpace; return x } From 26e3203e19a40116ed0c0513e4e0bfa0ce2402fb Mon Sep 17 00:00:00 2001 From: Lennart Augustsson Date: Sat, 4 Jan 2025 19:02:37 +0100 Subject: [PATCH 2/5] Add CI for MicroHs --- .github/workflows/mhs-ci.yml | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/mhs-ci.yml diff --git a/.github/workflows/mhs-ci.yml b/.github/workflows/mhs-ci.yml new file mode 100644 index 0000000..59b9d32 --- /dev/null +++ b/.github/workflows/mhs-ci.yml @@ -0,0 +1,58 @@ +name: ci-mhs + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build-mhs-mtl: + runs-on: ubuntu-latest + steps: + + - name: checkout mhs repo + uses: actions/checkout@v4 + with: + repository: augustss/MicroHs + ref: stable-6 + path: mhs + - name: make and install mhs + run: | + cd mhs + make minstall + + - name: checkout transformers repo + uses: actions/checkout@v4 + with: + repository: augustss/transformers + path: transformers + - name: compile and install transformers package + run: | + PATH="$HOME/.mcabal/bin:$PATH" + cd transformers + mcabal install + + - name: checkout mtl repo + uses: actions/checkout@v4 + with: + path: mtl + - name: compile and install mtl package + run: | + PATH="$HOME/.mcabal/bin:$PATH" + cd mtl + mcabal install + + - name: checkout parsec repo + uses: actions/checkout@v4 + with: + path: parsec + - name: compile and install parsec package + run: | + PATH="$HOME/.mcabal/bin:$PATH" + cd parsec + mcabal install + + - name: cleanup + run: | + rm -rf $HOME/.mcabal From 5c8637401d02bb7f717fcb0bd48a6ffb1bf2b025 Mon Sep 17 00:00:00 2001 From: Lennart Augustsson Date: Sat, 4 Jan 2025 19:09:53 +0100 Subject: [PATCH 3/5] Add missing repo --- .github/workflows/mhs-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mhs-ci.yml b/.github/workflows/mhs-ci.yml index 59b9d32..f21c2cd 100644 --- a/.github/workflows/mhs-ci.yml +++ b/.github/workflows/mhs-ci.yml @@ -36,6 +36,7 @@ jobs: - name: checkout mtl repo uses: actions/checkout@v4 with: + repository: augustss/mtl path: mtl - name: compile and install mtl package run: | From ea88d73d83fd6819602ff7ad6980d9f5b4955056 Mon Sep 17 00:00:00 2001 From: Lennart Augustsson Date: Fri, 5 Sep 2025 20:02:03 +0200 Subject: [PATCH 4/5] Remove CI --- .github/workflows/mhs-ci.yml | 59 ------------------------------------ 1 file changed, 59 deletions(-) delete mode 100644 .github/workflows/mhs-ci.yml diff --git a/.github/workflows/mhs-ci.yml b/.github/workflows/mhs-ci.yml deleted file mode 100644 index f21c2cd..0000000 --- a/.github/workflows/mhs-ci.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: ci-mhs - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - build-mhs-mtl: - runs-on: ubuntu-latest - steps: - - - name: checkout mhs repo - uses: actions/checkout@v4 - with: - repository: augustss/MicroHs - ref: stable-6 - path: mhs - - name: make and install mhs - run: | - cd mhs - make minstall - - - name: checkout transformers repo - uses: actions/checkout@v4 - with: - repository: augustss/transformers - path: transformers - - name: compile and install transformers package - run: | - PATH="$HOME/.mcabal/bin:$PATH" - cd transformers - mcabal install - - - name: checkout mtl repo - uses: actions/checkout@v4 - with: - repository: augustss/mtl - path: mtl - - name: compile and install mtl package - run: | - PATH="$HOME/.mcabal/bin:$PATH" - cd mtl - mcabal install - - - name: checkout parsec repo - uses: actions/checkout@v4 - with: - path: parsec - - name: compile and install parsec package - run: | - PATH="$HOME/.mcabal/bin:$PATH" - cd parsec - mcabal install - - - name: cleanup - run: | - rm -rf $HOME/.mcabal From 8e379b978cf46167da374f53a802c4957d323cbb Mon Sep 17 00:00:00 2001 From: Lennart Augustsson Date: Sun, 28 Sep 2025 16:06:17 +0200 Subject: [PATCH 5/5] Add MonoLocalBinds since that's always on for MicroHs. --- src/Text/Parsec/Token.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Text/Parsec/Token.hs b/src/Text/Parsec/Token.hs index 86de45b..2eac693 100644 --- a/src/Text/Parsec/Token.hs +++ b/src/Text/Parsec/Token.hs @@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE MonoLocalBinds #-} -- MicroHs always has MonoLocalBinds, this helps GHC catch those problems {-# LANGUAGE PolymorphicComponents #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE Safe #-}