From e74f51110360a7104d2f3084c04707b81788f827 Mon Sep 17 00:00:00 2001 From: Hiromi ISHII Date: Sat, 13 Mar 2021 13:51:18 +0900 Subject: [PATCH 1/5] GHC 9 --- .vscode/settings.json | 2 + ghc-typelits-presburger/Changelog.md | 4 ++ ghc-typelits-presburger/hie.yaml | 1 - .../src/GHC/TypeLits/Presburger/Compat.hs | 41 ++++++++++++++++++- singletons-presburger/package.yaml | 2 +- .../singletons-presburger.cabal | 4 +- stack-8.10.4.yaml | 7 ++++ stack-9.0.1.yaml | 25 ++++------- stack.yaml | 2 +- 9 files changed, 66 insertions(+), 22 deletions(-) create mode 100644 stack-8.10.4.yaml diff --git a/.vscode/settings.json b/.vscode/settings.json index 244fba9..b48b52e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,4 +11,6 @@ ".github/workflows/haskell.yml" ], "github-actions.workflows.pinned.refresh.enabled": true, + "editor.defaultFormatter": "haskell.haskell", + "haskell.formattingProvider": "fourmolu", } diff --git a/ghc-typelits-presburger/Changelog.md b/ghc-typelits-presburger/Changelog.md index 4f631c1..cbea2ad 100644 --- a/ghc-typelits-presburger/Changelog.md +++ b/ghc-typelits-presburger/Changelog.md @@ -1,5 +1,9 @@ Changelog ========== + +## 0.6.0.0 +* Now `ghc-typelits-presburger` won't drop (non-trivial) redundant constraints in simplification phase. + ## 0.4.0.0 * Fixes constraint solving (fixes #9); this may change the previous (unsound) behaviour, and hence it is breaking change. diff --git a/ghc-typelits-presburger/hie.yaml b/ghc-typelits-presburger/hie.yaml index 218d019..00bf5ad 100644 --- a/ghc-typelits-presburger/hie.yaml +++ b/ghc-typelits-presburger/hie.yaml @@ -1,6 +1,5 @@ cradle: stack: - components: - path: "src" component: "ghc-typelits-presburger:lib" - path: "examples/simple-arith-core.hs" diff --git a/ghc-typelits-presburger/src/GHC/TypeLits/Presburger/Compat.hs b/ghc-typelits-presburger/src/GHC/TypeLits/Presburger/Compat.hs index 2dcea6e..31cb05b 100644 --- a/ghc-typelits-presburger/src/GHC/TypeLits/Presburger/Compat.hs +++ b/ghc-typelits-presburger/src/GHC/TypeLits/Presburger/Compat.hs @@ -1,5 +1,6 @@ {-# LANGUAGE CPP, FlexibleInstances, PatternGuards, PatternSynonyms #-} {-# LANGUAGE TypeSynonymInstances, ViewPatterns #-} +{-# LANGUAGE PatternSynonyms #-} {-# OPTIONS_GHC -Wno-orphans #-} module GHC.TypeLits.Presburger.Compat (module GHC.TypeLits.Presburger.Compat) where import Data.Function (on) @@ -10,6 +11,9 @@ import Data.Generics.Twins #if MIN_VERSION_ghc(9,0,0) import GHC.Builtin.Names as GHC.TypeLits.Presburger.Compat (gHC_TYPENATS, dATA_TYPE_EQUALITY) import qualified GHC.Builtin.Names as Old +import GHC.Hs as GHC.TypeLits.Presburger.Compat (HsModule(..), NoExtField(..)) +import GHC.Hs.ImpExp as GHC.TypeLits.Presburger.Compat (ImportDecl(..), ImportDeclQualifiedStyle(..)) +import GHC.Hs.Extension as GHC.TypeLits.Presburger.Compat (GhcPs) import GHC.Builtin.Types as GHC.TypeLits.Presburger.Compat ( boolTyCon, eqTyConName, @@ -34,7 +38,9 @@ import GHC.Driver.Types as GHC.TypeLits.Presburger.Compat (HscEnv (hsc_dflags)) import GHC.Driver.Session (unitState) import GHC.Plugins (InScopeSet, Outputable, emptyUFM, moduleUnit, Unit) import GHC.Plugins as GHC.TypeLits.Presburger.Compat - ( PackageName (..), + ( PackageName (..),isStrLitTy, isNumLitTy, + nilDataCon, consDataCon, + Hsc, HsParsedModule(..), Plugin (..), TCvSubst (..), TvSubstEnv, @@ -59,8 +65,12 @@ import GHC.Plugins as GHC.TypeLits.Presburger.Compat unionTCvSubst, ) import GHC.Tc.Plugin (lookupOrig) +import GHC.Core.InstEnv as GHC.TypeLits.Presburger.Compat (classInstances) +import GHC.Driver.Types as GHC.TypeLits.Presburger.Compat (IsBootInterface(..)) import GHC.Tc.Plugin as GHC.TypeLits.Presburger.Compat ( TcPluginM, + getInstEnvs, + newFlexiTyVar, getTopEnv, lookupOrig, newFlexiTyVar, @@ -359,3 +369,32 @@ type ModuleUnit = UnitId moduleUnit' :: Module -> ModuleUnit moduleUnit' = GHC.moduleUnitId #endif + +#if !MIN_VERSION_ghc(8,10,1) +type NoExtField = NoExt +#endif + +noExtField :: NoExtField +#if MIN_VERSION_ghc(8,10,1) +noExtField = NoExtField +#else +noExtField = NoExt +#endif + +#if MIN_VERSION_ghc(9,0,1) +type HsModule' = HsModule +#else +type HsModule' = HsModule GhcPs +#endif + +#if !MIN_VERSION_ghc(9,0,1) +type IsBootInterface = Bool +pattern NotBoot :: IsBootInterface +pattern NotBoot = False + +pattern IsBoot :: IsBootInterface +pattern IsBoot = True + +{-# COMPLETE NotBoot, IsBoot #-} +#endif + diff --git a/singletons-presburger/package.yaml b/singletons-presburger/package.yaml index 51ca675..f2ce057 100644 --- a/singletons-presburger/package.yaml +++ b/singletons-presburger/package.yaml @@ -1,5 +1,5 @@ name: singletons-presburger -version: "0.5.1.0" +version: "0.6.0.0" synopsis: Presburger Arithmetic Solver for GHC Type-level natural numbers with Singletons package. description: | The @singletons-presburger@ plugin augments GHC type-system with Presburger diff --git a/singletons-presburger/singletons-presburger.cabal b/singletons-presburger/singletons-presburger.cabal index 14adfd2..6410dbd 100644 --- a/singletons-presburger/singletons-presburger.cabal +++ b/singletons-presburger/singletons-presburger.cabal @@ -4,10 +4,10 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -- --- hash: c78fc73861dc22536c4a5d4040b2f5ab8962bbf61f89477aa3af5160d720b11c +-- hash: bcd8a76493634b5daf7fd755d964a4c6c5d5547295f5ffc045534fa5d312162e name: singletons-presburger -version: 0.5.1.0 +version: 0.6.0.0 synopsis: Presburger Arithmetic Solver for GHC Type-level natural numbers with Singletons package. description: The @singletons-presburger@ plugin augments GHC type-system with Presburger Arithmetic Solver for Type-level natural numbers, with integration with package. diff --git a/stack-8.10.4.yaml b/stack-8.10.4.yaml new file mode 100644 index 0000000..7f8d9ed --- /dev/null +++ b/stack-8.10.4.yaml @@ -0,0 +1,7 @@ +resolver: lts-17.3 +compiler: ghc-8.10.4 + +flags: {} +packages: + - "ghc-typelits-presburger" + - "singletons-presburger" diff --git a/stack-9.0.1.yaml b/stack-9.0.1.yaml index 68dd69f..7e38b6f 100644 --- a/stack-9.0.1.yaml +++ b/stack-9.0.1.yaml @@ -1,4 +1,4 @@ -resolver: nightly-2021-02-04 +resolver: nightly-2021-03-12 compiler: ghc-9.0.1 compiler-check: match-exact @@ -11,19 +11,12 @@ packages: extra-deps: - syb-0.7.2.1 -- equational-reasoning-0.7.0.0 +- equational-reasoning-0.7.0.0@rev:1 - indexed-traversable-instances-0.1 -- github: mgsloan/th-expand-syns - commit: 6a64927ebd6b85cc3c67c00c88c3c7c019d31573 -- github: goldfirere/th-desugar - commit: e22709ebfc43c12fb690622eb0da09d2b3c4ba73 -- github: ekmett/profunctors - commit: e74a169799c899075f7cef2afb70a93ac38f9557 -- github: goldfirere/singletons - commit: 30f3abe93b77d477796d179e008aa1146b1d6f14 - subdirs: - - singletons - - singletons-th - - singletons-base -- github: ekmett/lens - commit: 6815396accd3d6ba14bd5bfe4dec2fe516fc33c4 +- th-expand-syns-0.4.8.0 +- th-desugar-1.12 +- profunctors-5.6.2 +- singletons-3.0 +- singletons-base-3.0 +- singletons-th-3.0 +- lens-5.0.1 diff --git a/stack.yaml b/stack.yaml index 42a4635..1498c21 120000 --- a/stack.yaml +++ b/stack.yaml @@ -1 +1 @@ -./stack-8.6.5.yaml \ No newline at end of file +./stack-8.10.4.yaml \ No newline at end of file From 168d4e58e05e47ec52358388bee52eb134a78b5c Mon Sep 17 00:00:00 2001 From: Hiromi ISHII Date: Sat, 13 Mar 2021 13:54:08 +0900 Subject: [PATCH 2/5] Removes fake Changelog --- ghc-typelits-presburger/Changelog.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/ghc-typelits-presburger/Changelog.md b/ghc-typelits-presburger/Changelog.md index cbea2ad..9950dd3 100644 --- a/ghc-typelits-presburger/Changelog.md +++ b/ghc-typelits-presburger/Changelog.md @@ -1,9 +1,6 @@ Changelog ========== -## 0.6.0.0 -* Now `ghc-typelits-presburger` won't drop (non-trivial) redundant constraints in simplification phase. - ## 0.4.0.0 * Fixes constraint solving (fixes #9); this may change the previous (unsound) behaviour, and hence it is breaking change. From a2714f9e73269c787ced93003ebe4abec8ae9908 Mon Sep 17 00:00:00 2001 From: Hiromi ISHII Date: Sat, 13 Mar 2021 14:07:54 +0900 Subject: [PATCH 3/5] GhcPs --- .../src/GHC/TypeLits/Presburger/Compat.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ghc-typelits-presburger/src/GHC/TypeLits/Presburger/Compat.hs b/ghc-typelits-presburger/src/GHC/TypeLits/Presburger/Compat.hs index 31cb05b..19578d9 100644 --- a/ghc-typelits-presburger/src/GHC/TypeLits/Presburger/Compat.hs +++ b/ghc-typelits-presburger/src/GHC/TypeLits/Presburger/Compat.hs @@ -169,12 +169,13 @@ import PrelNames as GHC.TypeLits.Presburger.Compat (eqTyConName) #if MIN_VERSION_ghc(8,10,1) import Predicate as GHC.TypeLits.Presburger.Compat (EqRel (..), Pred(..)) import Predicate as GHC.TypeLits.Presburger.Compat (isEqPred) - +import GHC (NoExtField(..)) import qualified Predicate as Old (classifyPredType) import Predicate as GHC.TypeLits.Presburger.Compat (mkPrimEqPredRole) import Constraint as GHC.TypeLits.Presburger.Compat (Ct, ctEvidence, ctEvPred, isWanted) #else +import GHC (NoExt(..)) import GhcPlugins as GHC.TypeLits.Presburger.Compat (EqRel (..), PredTree (..)) import GhcPlugins as GHC.TypeLits.Presburger.Compat (isEqPred) import qualified GhcPlugins as Old (classifyPredType) @@ -384,7 +385,7 @@ noExtField = NoExt #if MIN_VERSION_ghc(9,0,1) type HsModule' = HsModule #else -type HsModule' = HsModule GhcPs +type HsModule' = GHC.HsModule GHC.GhcPs #endif #if !MIN_VERSION_ghc(9,0,1) From 4fe679a5af9e8b5821fb69bec1b196a582f4e5d7 Mon Sep 17 00:00:00 2001 From: Hiromi ISHII Date: Sat, 13 Mar 2021 14:20:43 +0900 Subject: [PATCH 4/5] Drops support for GHC <8.6 --- .mergify.yml | 1 - ghc-typelits-presburger/package.yaml | 2 +- singletons-presburger/package.yaml | 2 +- stack-8.4.3.yaml | 12 ------------ 4 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 stack-8.4.3.yaml diff --git a/.mergify.yml b/.mergify.yml index e346c5a..c61a16f 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -3,7 +3,6 @@ pull_request_rules: conditions: - "base=master" - "label=merge me" - - status-success=Haskell GHC 8.4.3 Test - status-success=Haskell GHC 8.6.5 Test - status-success=Haskell GHC 8.8.4 Test - status-success=Haskell GHC 8.10.3 Test diff --git a/ghc-typelits-presburger/package.yaml b/ghc-typelits-presburger/package.yaml index 668c124..2851751 100644 --- a/ghc-typelits-presburger/package.yaml +++ b/ghc-typelits-presburger/package.yaml @@ -20,7 +20,7 @@ maintainer: konn.jinro _at_ gmail.com copyright: 2015 (c) Hiromi ISHII license: BSD3 github: konn/ghc-typelits-presburger -tested-with: GHC==8.4.3 GHC==8.6.3 GHC==8.8.3 GHC==8.10.3 GHC==9.0.1 +tested-with: GHC==8.6.3 GHC==8.8.3 GHC==8.10.3 GHC==9.0.1 ghc-options: - -Wall - -Wno-dodgy-imports diff --git a/singletons-presburger/package.yaml b/singletons-presburger/package.yaml index f2ce057..1d4bb7b 100644 --- a/singletons-presburger/package.yaml +++ b/singletons-presburger/package.yaml @@ -15,7 +15,7 @@ maintainer: konn.jinro _at_ gmail.com copyright: 2015 (c) Hiromi ISHII license: BSD3 github: konn/ghc-typelits-presburger -tested-with: GHC==8.4.3 GHC==8.6.3 GHC==8.8.3 GHC==8.10.1 +tested-with: GHC==8.6.3 GHC==8.8.3 GHC==8.10.3 GHC==9.0.1 ghc-options: - -Wall - -Wno-dodgy-imports diff --git a/stack-8.4.3.yaml b/stack-8.4.3.yaml deleted file mode 100644 index d2ac7b6..0000000 --- a/stack-8.4.3.yaml +++ /dev/null @@ -1,12 +0,0 @@ -resolver: lts-12.2 -skip-ghc-check: true - -flags: {} -packages: -- 'ghc-typelits-presburger' -- 'singletons-presburger' - -extra-deps: -- equational-reasoning-0.6.0.0 -# - git: https://github.com/konn/generic-unification.git -# commit: dd26f7a16da20ca3e46e7c046c559b620d64a91c \ No newline at end of file From 0d28f7a71742af839bf3ff36c87eee29fc2f0ca9 Mon Sep 17 00:00:00 2001 From: Hiromi ISHII Date: Sat, 13 Mar 2021 14:23:18 +0900 Subject: [PATCH 5/5] CI config --- .github/workflows/haskell.yml | 2 +- .mergify.yml | 2 +- ghc-typelits-presburger/package.yaml | 2 +- singletons-presburger/package.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 9a862a5..733c9e5 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - ghc: ['8.4.3', '8.6.5', '8.8.4', '8.10.3', '9.0.1'] + ghc: ['8.6.5', '8.8.4', '8.10.4', '9.0.1'] HEAD: [false] runs-on: ubuntu-latest diff --git a/.mergify.yml b/.mergify.yml index c61a16f..f9c79ba 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -5,7 +5,7 @@ pull_request_rules: - "label=merge me" - status-success=Haskell GHC 8.6.5 Test - status-success=Haskell GHC 8.8.4 Test - - status-success=Haskell GHC 8.10.3 Test + - status-success=Haskell GHC 8.10.4 Test - status-success=Haskell GHC 9.0.1 Test actions: merge: diff --git a/ghc-typelits-presburger/package.yaml b/ghc-typelits-presburger/package.yaml index 2851751..6d0508e 100644 --- a/ghc-typelits-presburger/package.yaml +++ b/ghc-typelits-presburger/package.yaml @@ -20,7 +20,7 @@ maintainer: konn.jinro _at_ gmail.com copyright: 2015 (c) Hiromi ISHII license: BSD3 github: konn/ghc-typelits-presburger -tested-with: GHC==8.6.3 GHC==8.8.3 GHC==8.10.3 GHC==9.0.1 +tested-with: GHC==8.6.5 GHC==8.8.4 GHC==8.10.4 GHC==9.0.1 ghc-options: - -Wall - -Wno-dodgy-imports diff --git a/singletons-presburger/package.yaml b/singletons-presburger/package.yaml index 1d4bb7b..62c2bb1 100644 --- a/singletons-presburger/package.yaml +++ b/singletons-presburger/package.yaml @@ -15,7 +15,7 @@ maintainer: konn.jinro _at_ gmail.com copyright: 2015 (c) Hiromi ISHII license: BSD3 github: konn/ghc-typelits-presburger -tested-with: GHC==8.6.3 GHC==8.8.3 GHC==8.10.3 GHC==9.0.1 +tested-with: GHC==8.6.5 GHC==8.8.4 GHC==8.10.4 GHC==9.0.1 ghc-options: - -Wall - -Wno-dodgy-imports