ghc-typelits-extra 0.2.6 → 0.3
raw patch · 4 files changed
+13/−8 lines, 4 filesdep ~ghc-typelits-knownnatPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc-typelits-knownnat
API changes (from Hackage documentation)
- GHC.TypeLits.Extra: instance (GHC.TypeNats.KnownNat x, GHC.TypeNats.KnownNat y, 1 GHC.TypeNats.<= y) => GHC.TypeLits.KnownNat.KnownNat2 "GHC.TypeNats.Div" x y
- GHC.TypeLits.Extra: instance (GHC.TypeNats.KnownNat x, GHC.TypeNats.KnownNat y, 1 GHC.TypeNats.<= y) => GHC.TypeLits.KnownNat.KnownNat2 "GHC.TypeNats.Mod" x y
Files
- CHANGELOG.md +3/−0
- ghc-typelits-extra.cabal +3/−3
- src/GHC/TypeLits/Extra.hs +4/−4
- src/GHC/TypeLits/Extra/Solver.hs +3/−1
CHANGELOG.md view
@@ -1,5 +1,8 @@ # Changelog for the [`ghc-typelits-extra`](http://hackage.haskell.org/package/ghc-typelits-extra) package +# 0.3 *September 14th 2018*+* Move `KnownNat2` instances for GHC 8.4's `Div` and `Mod` from `ghc-typelits-extra` to `ghc-typelits-knownnat`+ # 0.2.6 *Julty 10th 2018* * Add support for GHC-8.6.1-alpha1
ghc-typelits-extra.cabal view
@@ -1,5 +1,5 @@ name: ghc-typelits-extra-version: 0.2.6+version: 0.3 synopsis: Additional type-level operations on GHC.TypeLits.Nat description: Additional type-level operations on @GHC.TypeLits.Nat@:@@ -69,7 +69,7 @@ ghc >= 7.10 && <8.8, ghc-prim >= 0.5 && <1.0, ghc-tcplugins-extra >= 0.2,- ghc-typelits-knownnat >= 0.5 && <0.6,+ ghc-typelits-knownnat >= 0.6 && <0.7, ghc-typelits-natnormalise >= 0.6 && <0.7, integer-gmp >= 1.0 && <1.1, transformers >= 0.4.2.0 && <0.6@@ -98,7 +98,7 @@ Other-Modules: ErrorTests build-depends: base >= 4.8 && <5, ghc-typelits-extra,- ghc-typelits-knownnat >= 0.2,+ ghc-typelits-knownnat >= 0.6, ghc-typelits-natnormalise >= 0.4.1, tasty >= 0.10, tasty-hunit >= 0.9,
src/GHC/TypeLits/Extra.hs view
@@ -129,14 +129,14 @@ -- "GHC.TypeLits.Extra.Solver". type family Div (x :: Nat) (y :: Nat) :: Nat where Div x 1 = x++instance (KnownNat x, KnownNat y, 1 <= y) => KnownNat2 $(nameToSymbol ''Div) x y where+ natSing2 = SNatKn (quot (N.natVal (Proxy @x)) (N.natVal (Proxy @y))) #endif -- | A variant of 'Div' that rounds up instead of down type DivRU n d = Div (n + (d - 1)) d -instance (KnownNat x, KnownNat y, 1 <= y) => KnownNat2 $(nameToSymbol ''Div) x y where- natSing2 = SNatKn (quot (N.natVal (Proxy @x)) (N.natVal (Proxy @y)))- #if !MIN_VERSION_ghc(8,4,0) -- | Type-level 'mod' --@@ -144,10 +144,10 @@ -- "GHC.TypeLits.Extra.Solver". type family Mod (x :: Nat) (y :: Nat) :: Nat where Mod x 1 = 0-#endif instance (KnownNat x, KnownNat y, 1 <= y) => KnownNat2 $(nameToSymbol ''Mod) x y where natSing2 = SNatKn (rem (N.natVal (Proxy @x)) (N.natVal (Proxy @y)))+#endif -- | Type-level `divMod` type DivMod n d = '(Div n d, Mod n d)
src/GHC/TypeLits/Extra/Solver.hs view
@@ -135,7 +135,9 @@ tcPluginTrace "unifyExtra result" (ppr ur) case ur of Win -> simples (((,) <$> evMagic ct <*> pure ct):evs) eqs'- Lose -> return (Impossible eq)+ Lose -> if null evs && null eqs'+ then return (Impossible eq)+ else simples evs eqs' Draw -> simples evs eqs' simples evs (eq@(Right (ct,u,v,b)):eqs') = do tcPluginTrace "unifyExtra leq result" (ppr (u,v,b))