Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for GHC 9 and singleton-3.0 #17

Merged
merged 5 commits into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ 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
- status-success=Haskell GHC 8.10.4 Test
- status-success=Haskell GHC 9.0.1 Test
actions:
merge:
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@
".github/workflows/haskell.yml"
],
"github-actions.workflows.pinned.refresh.enabled": true,
"editor.defaultFormatter": "haskell.haskell",
"haskell.formattingProvider": "fourmolu",
}
1 change: 1 addition & 0 deletions ghc-typelits-presburger/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Changelog
==========

## 0.4.0.0
* Fixes constraint solving (fixes #9); this may change the previous (unsound) behaviour, and hence it is breaking change.

Expand Down
1 change: 0 additions & 1 deletion ghc-typelits-presburger/hie.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cradle:
stack:
components:
- path: "src"
component: "ghc-typelits-presburger:lib"
- path: "examples/simple-arith-core.hs"
Expand Down
2 changes: 1 addition & 1 deletion ghc-typelits-presburger/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.5 GHC==8.8.4 GHC==8.10.4 GHC==9.0.1
ghc-options:
- -Wall
- -Wno-dodgy-imports
Expand Down
44 changes: 42 additions & 2 deletions ghc-typelits-presburger/src/GHC/TypeLits/Presburger/Compat.hs
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -159,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)
Expand Down Expand Up @@ -359,3 +370,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' = GHC.HsModule GHC.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

4 changes: 2 additions & 2 deletions singletons-presburger/package.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.5 GHC==8.8.4 GHC==8.10.4 GHC==9.0.1
ghc-options:
- -Wall
- -Wno-dodgy-imports
Expand Down
4 changes: 2 additions & 2 deletions singletons-presburger/singletons-presburger.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://hackage.haskell.org/package/singletons singletons> package.
Expand Down
7 changes: 7 additions & 0 deletions stack-8.10.4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resolver: lts-17.3
compiler: ghc-8.10.4

flags: {}
packages:
- "ghc-typelits-presburger"
- "singletons-presburger"
12 changes: 0 additions & 12 deletions stack-8.4.3.yaml

This file was deleted.

25 changes: 9 additions & 16 deletions stack-9.0.1.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: nightly-2021-02-04
resolver: nightly-2021-03-12
compiler: ghc-9.0.1
compiler-check: match-exact

Expand All @@ -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
2 changes: 1 addition & 1 deletion stack.yaml