ghc-typelits-natnormalise 0.5.3 → 0.5.4
raw patch · 4 files changed
+22/−4 lines, 4 filesdep ~ghc-typelits-natnormalisePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc-typelits-natnormalise
API changes (from Hackage documentation)
Files
- CHANGELOG.md +3/−0
- ghc-typelits-natnormalise.cabal +4/−3
- src/GHC/TypeLits/Normalise/SOP.hs +7/−1
- tests/Tests.hs +8/−0
CHANGELOG.md view
@@ -1,5 +1,8 @@ # Changelog for the [`ghc-typelits-natnormalise`](http://hackage.haskell.org/package/ghc-typelits-natnormalise) package +## 0.5.4 *October 14th 2017*+* Perform normalisations such as: `2^x * 4^x ==> 8^x`+ ## 0.5.3 *May 15th 2017* * Add support for GHC 8.2
ghc-typelits-natnormalise.cabal view
@@ -1,5 +1,5 @@ name: ghc-typelits-natnormalise-version: 0.5.3+version: 0.5.4 synopsis: GHC typechecker plugin for types of kind GHC.TypeLits.Nat description: A type checker plugin for GHC that can solve /equalities/ of types of kind@@ -41,7 +41,8 @@ license-file: LICENSE author: Christiaan Baaij maintainer: christiaan.baaij@gmail.com-copyright: Copyright © 2015-2016 University of Twente+copyright: Copyright © 2015-2016, University of Twente,+ 2017 , QBayLogic B.V. category: Type System build-type: Simple extra-source-files: README.md@@ -82,7 +83,7 @@ main-is: Tests.hs Other-Modules: ErrorTests build-depends: base >=4.8 && <5,- ghc-typelits-natnormalise >= 0.4,+ ghc-typelits-natnormalise, tasty >= 0.10, tasty-hunit >= 0.9, template-haskell >= 2.11.0.0
src/GHC/TypeLits/Normalise/SOP.hs view
@@ -1,5 +1,6 @@ {-|-Copyright : (C) 2015-2016, University of Twente+Copyright : (C) 2015-2016, University of Twente,+ 2017 , QBayLogic B.V. License : BSD2 (see the file LICENSE) Maintainer : Christiaan Baaij <christiaan.baaij@gmail.com> @@ -197,6 +198,11 @@ mergeS (E (S [P [s']]) (P [I i])) s | s == s' = Left (E (S [P [s']]) (P [I (i + 1)]))++-- 4^x * 2^x ==> 8^x+mergeS (E (S [P [I i]]) p) (E (S [P [I j]]) p')+ | p == p'+ = Left (E (S [P [I (i*j)]]) p) -- y*y ==> y^2 mergeS l r
tests/Tests.hs view
@@ -248,6 +248,9 @@ proxyInEq5 :: Proxy 1 -> Proxy (2^a) -> () proxyInEq5 = proxyInEq +proxyEq1 :: Proxy x -> Proxy ((2 ^ x) * (2 ^ (x + x))) -> Proxy (2 * (2 ^ ((x + (x + x)) - 1)))+proxyEq1 _ = id+ main :: IO () main = defaultMain tests @@ -283,6 +286,11 @@ "()" , testCase "show (proxyFun7 (Proxy :: Proxy 8) :: Proxy 3)" $ show (proxyFun7 (Proxy :: Proxy 8) :: Proxy 3) @?=+ "Proxy"+ ]+ , testGroup "Equality"+ [ testCase "((2 ^ x) * (2 ^ (x + x))) ~ (2 * (2 ^ ((x + (x + x)) - 1)))" $+ show (proxyEq1 (Proxy :: Proxy 4) Proxy) @?= "Proxy" ] , testGroup "Inequality"