packages feed

ghc-typelits-knownnat 0.7.3 → 0.7.4

raw patch · 3 files changed

+48/−4 lines, 3 filesdep ~ghcdep ~ghc-primPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: ghc, ghc-prim

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,5 +1,8 @@ # Changelog for the [`ghc-typelits-knownnat`](http://hackage.haskell.org/package/ghc-typelits-knownnat) package +## 0.7.4 *January 1st 2021*+* Add support for GHC 9.0.1-rc1+ ## 0.7.3 *July 25th 2020* * Fix https://github.com/clash-lang/clash-compiler/issues/1454 
ghc-typelits-knownnat.cabal view
@@ -1,5 +1,5 @@ name:                ghc-typelits-knownnat-version:             0.7.3+version:             0.7.4 synopsis:            Derive KnownNat constraints from other KnownNat constraints description:   A type checker plugin for GHC that can derive \"complex\" @KnownNat@@@ -54,7 +54,7 @@                      CHANGELOG.md cabal-version:       >=1.10 tested-with:         GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5,-                     GHC == 8.8.1+                     GHC == 8.8.4, GHC == 8.10.3, GHC == 9.0.1  source-repository head   type: git@@ -86,8 +86,8 @@                        UndecidableInstances                        ViewPatterns   build-depends:       base                      >= 4.9      && <5,-                       ghc                       >= 8.0.1    && <8.11,-                       ghc-prim                  >= 0.4.0.0  && <0.7,+                       ghc                       >= 8.0.1    && <9.2,+                       ghc-prim                  >= 0.4.0.0  && <0.8,                        ghc-tcplugins-extra       >= 0.3.1,                        ghc-typelits-natnormalise >= 0.7.1    && <0.8,                        transformers              >= 0.5.2.0  && <0.6,
src/GHC/TypeLits/KnownNat/Solver.hs view
@@ -111,6 +111,38 @@ import GHC.TypeLits.Normalise.Unify (CType (..),normaliseNat,reifySOP)  -- GHC API+#if MIN_VERSION_ghc(9,0,0)+import GHC.Builtin.Names (knownNatClassName)+import GHC.Builtin.Types (boolTy)+import GHC.Builtin.Types.Literals (typeNatAddTyCon, typeNatDivTyCon, typeNatSubTyCon)+import GHC.Core.Class (Class, classMethods, className, classTyCon)+import GHC.Core.Coercion (Role (Representational), mkUnivCo)+import GHC.Core.InstEnv (instanceDFunId, lookupUniqueInstEnv)+import GHC.Core.Make (mkNaturalExpr)+import GHC.Core.Predicate+  (EqRel (NomEq), Pred (ClassPred,EqPred), classifyPredType)+import GHC.Core.TyCo.Rep (Type (..), TyLit (..), UnivCoProvenance (PluginProv))+import GHC.Core.TyCon (tyConName)+import GHC.Core.Type+  (PredType, dropForAlls, eqType, funResultTy, mkNumLitTy, mkStrLitTy, mkTyConApp,+   piResultTys, splitFunTys, splitTyConApp_maybe, tyConAppTyCon_maybe, typeKind,+   irrelevantMult)+import GHC.Data.FastString (fsLit)+import GHC.Driver.Plugins (Plugin (..), defaultPlugin, purePlugin)+import GHC.Tc.Instance.Family (tcInstNewTyCon_maybe)+import GHC.Tc.Plugin (TcPluginM, tcLookupClass, getInstEnvs)+import GHC.Tc.Types (TcPlugin(..), TcPluginResult (..))+import GHC.Tc.Types.Constraint+  (Ct, ctEvExpr, ctEvidence, ctEvLoc, ctEvPred, ctLoc, ctLocSpan, isWanted,+   mkNonCanonical, setCtLoc, setCtLocSpan)+import GHC.Tc.Types.Evidence+  (EvTerm (..), EvExpr, evDFunApp, mkEvCast, mkTcSymCo, mkTcTransCo)+import GHC.Types.Id (idType)+import GHC.Types.Name (nameModule_maybe, nameOccName)+import GHC.Types.Name.Occurrence (mkTcOcc, occNameString)+import GHC.Types.Var (DFunId)+import GHC.Unit.Module (mkModuleName, moduleName, moduleNameString)+#else import Class      (Class, classMethods, className, classTyCon) #if MIN_VERSION_ghc(8,6,0) import Coercion   (Role (Representational), mkUnivCo)@@ -175,6 +207,7 @@ import TcRnTypes (ctEvTerm) #endif #endif+#endif  -- | Classes and instances from "GHC.TypeLits.KnownNat" data KnownNatDefs@@ -439,7 +472,11 @@                         . splitFunTys          -- ([KnownNat x, KnowNat y], DKnownNat2 "+" x y)                         . (`piResultTys` args0N) -- (KnowNat x, KnownNat y) => DKnownNat2 "+" x y                         $ idType df_id         -- forall a b . (KnownNat a, KnownNat b) => DKnownNat2 "+" a b+#if MIN_VERSION_ghc(9,0,0)+            (evs,new) <- unzip <$> mapM (go_arg . irrelevantMult) df_args+#else             (evs,new) <- unzip <$> mapM go_arg df_args+#endif             if className cls == className (knownBool defs)                -- Create evidence using the original, flattened, argument of                -- the KnownNat we're trying to solve. Not doing this results in@@ -739,7 +776,11 @@         -- SNat n ~ Integer #if MIN_VERSION_ghc(8,5,0)   = do+#if MIN_VERSION_ghc(9,0,0)+    let et = mkNaturalExpr i+#else     et <- unsafeTcPluginTcM (mkNaturalExpr i)+#endif     let ev_tm = mkEvCast et (mkTcSymCo (mkTcTransCo co_dict co_rep))     return (Just ev_tm)   | otherwise