typelits-witnesses 0.3.0.2 → 0.3.0.3
raw patch · 5 files changed
+124/−113 lines, 5 filesdep −base-compatdep −transformersdep ~basedep ~constraintsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: base-compat, transformers
Dependency ranges changed: base, constraints
API changes (from Hackage documentation)
- GHC.TypeLits.Compare: data (:<=?) :: Nat -> Nat -> *
+ GHC.TypeLits.Compare: data (:<=?) :: Nat -> Nat -> Type
- GHC.TypeLits.Compare: data SCmpNat :: Nat -> Nat -> *
+ GHC.TypeLits.Compare: data SCmpNat :: Nat -> Nat -> Type
- GHC.TypeLits.List: data NatList :: [Nat] -> *
+ GHC.TypeLits.List: data NatList :: [Nat] -> Type
- GHC.TypeLits.List: data SomeNats :: *
+ GHC.TypeLits.List: data SomeNats :: Type
- GHC.TypeLits.List: data SomeSymbols :: *
+ GHC.TypeLits.List: data SomeSymbols :: Type
- GHC.TypeLits.List: data SymbolList :: [Symbol] -> *
+ GHC.TypeLits.List: data SymbolList :: [Symbol] -> Type
Files
- CHANGELOG.md +10/−0
- src/GHC/TypeLits/Compare.hs +10/−8
- src/GHC/TypeLits/List.hs +22/−23
- src/GHC/TypeLits/Witnesses.hs +16/−14
- typelits-witnesses.cabal +66/−68
CHANGELOG.md view
@@ -1,3 +1,13 @@+Version 0.3.0.3+===============++<https://github.com/mstksg/typelits-witnesses/releases/tag/v0.3.0.3>++*October 1, 2018*++* Fix build for GHC 8.6 and `TypeIsStar` changes.+* Break compatibility with GHC < 8.0+ Version 0.3.0.2 ===============
src/GHC/TypeLits/Compare.hs view
@@ -1,9 +1,10 @@ {-# LANGUAGE DataKinds #-}-{-# LANGUAGE LambdaCase #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-}+{-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeOperators #-} -- |@@ -93,9 +94,10 @@ ) where -import Data.Type.Equality-import GHC.TypeLits-import Unsafe.Coerce+import Data.Kind+import Data.Type.Equality+import GHC.TypeLits+import Unsafe.Coerce isLE :: (KnownNat m, KnownNat n)@@ -112,10 +114,10 @@ -> q n -> Maybe ((m <=? n) :~: 'False) isNLE m n = case m %<=? n of- NLE Refl Refl -> Just Refl- LE _ -> Nothing+ NLE Refl Refl -> Just Refl+ LE _ -> Nothing -data (:<=?) :: Nat -> Nat -> * where+data (:<=?) :: Nat -> Nat -> Type where LE :: ((m <=? n) :~: 'True) -> (m :<=? n) NLE :: ((m <=? n) :~: 'False) -> ((n <=? m) :~: 'True) -> (m :<=? n) @@ -127,7 +129,7 @@ m %<=? n | natVal m <= natVal n = LE (unsafeCoerce Refl) | otherwise = NLE (unsafeCoerce Refl) (unsafeCoerce Refl) -data SCmpNat :: Nat -> Nat -> * where+data SCmpNat :: Nat -> Nat -> Type where CLT :: (CmpNat m n :~: 'LT) -> SCmpNat m n CEQ :: (CmpNat m n :~: 'EQ) -> (m :~: n) -> SCmpNat m n CGT :: (CmpNat m n :~: 'GT) -> SCmpNat m n
src/GHC/TypeLits/List.hs view
@@ -1,16 +1,15 @@-{-# LANGUAGE ConstraintKinds #-}-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE GADTs #-}-{-# LANGUAGE KindSignatures #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE NoImplicitPrelude #-}-{-# LANGUAGE PolyKinds #-}-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeInType #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -- |@@ -69,12 +68,12 @@ , mapSymbolList' ) where -import Data.Functor.Identity-import Data.Proxy-import Prelude.Compat-import Data.Reflection-import Data.Type.Equality-import GHC.TypeLits+import Data.Functor.Identity+import Data.Kind+import Data.Proxy+import Data.Reflection+import Data.Type.Equality+import GHC.TypeLits -- | @'KnownNats' ns@ is intended to represent that every 'Nat' in the@@ -115,7 +114,7 @@ -- compile-time. -- -- __Deprecated:__ Use 'SomeSing' from /singletons/ instead.-data SomeNats :: * where+data SomeNats :: Type where SomeNats :: KnownNats ns => !(NatList ns) -> SomeNats {-# DEPRECATED SomeNats "Use SomeSing from the singletons package instead" #-} @@ -127,7 +126,7 @@ -- Typically generated using 'natsList'. -- -- __Deprecated:__ Use 'Sing' from /singletons/ instead.-data NatList :: [Nat] -> * where+data NatList :: [Nat] -> Type where ØNL :: NatList '[] (:<#) :: (KnownNat n, KnownNats ns) => !(Proxy n) -> !(NatList ns) -> NatList (n ': ns)@@ -339,7 +338,7 @@ -- but you don't know what the list contains at compile-time. -- -- __Deprecated:__ Use 'SomeSing' from /singletons/ instead.-data SomeSymbols :: * where+data SomeSymbols :: Type where SomeSymbols :: KnownSymbols ss => !(SymbolList ss) -> SomeSymbols {-# DEPRECATED SomeSymbols "Use SomeSing from the singletons package instead" #-} @@ -351,7 +350,7 @@ -- Typically generated using 'symbolsList'. -- -- __Deprecated:__ Use 'Sing' from /singletons/ instead.-data SymbolList :: [Symbol] -> * where+data SymbolList :: [Symbol] -> Type where ØSL :: SymbolList '[] (:<$) :: (KnownSymbol s, KnownSymbols ss) => !(Proxy s) -> !(SymbolList ss) -> SymbolList (s ': ss)
src/GHC/TypeLits/Witnesses.hs view
@@ -1,9 +1,13 @@-{-# LANGUAGE TypeOperators #-}-{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE TypeOperators #-}+#if __GLASGOW_HASKELL__ >= 806+{-# LANGUAGE NoStarIsType #-}+#endif -- | -- Module : GHC.TypeLits.Witnesses@@ -15,8 +19,6 @@ -- Stability : unstable -- Portability : non-portable ----- __Deprecated: Use the /singletons/ package instead__--- -- This module provides witnesses for instances that result from the -- various arithmetic operations on GHC TypeLits 'Nat' types. In general, -- if you have @'KnownNat' n@, GHC can't infer @'KnownNat' (n + 1)@; and if@@ -69,10 +71,10 @@ -- functions that rely on 'KnownNat' instances to be non-negative can -- potentially break. ----- -module GHC.TypeLits.Witnesses (+module GHC.TypeLits.Witnesses+ {-# DEPRECATED "Use singletons package instead" #-} ( -- * Singletons -- $singletons -- * High level wrapper@@ -92,11 +94,11 @@ , entailExp ) where -import Data.Constraint-import GHC.TypeLits-import Data.Proxy-import Data.Reflection-import Unsafe.Coerce+import Data.Constraint+import Data.Proxy+import Data.Reflection+import GHC.TypeLits+import Unsafe.Coerce -- $singletons --
typelits-witnesses.cabal view
@@ -1,72 +1,70 @@-name: typelits-witnesses-version: 0.3.0.2-synopsis: Existential witnesses, singletons, and classes for operations on GHC TypeLits-description: Provides witnesses for 'KnownNat' and 'KnownSymbol'- instances for various operations on GHC TypeLits - in- particular, the arithmetic operations defined in- "GHC.TypeLits", and also for type-level lists of- 'KnownNat' and 'KnownSymbol' instances.- .- This is useful for situations where you have- @'KnownNat' n@, and you want to prove to GHC- @'KnownNat' (n + 3)@, or @'KnownNat' (2*n + 4)@, or when- constraints on the lower or upper limits of @n@ are- needed.- .- It's also useful for when you want to work with type- level lists of 'KnownNat' or 'KnownSymbol' instances and- singletons for traversing them, and be able to apply- analogies of 'natVal' and 'symbolVal' to lists with- analogies for 'SomeNat' and 'SomeSymbol'.- .- Note that most of the functionality in this library can- be reproduced in a more generic way using the great- <https://hackage.haskell.org/package/singletons singletons>- library. The versions here are provided as a "plumbing- included" alternative that makes some commonly found- design patterns involving GHC's TypeLits functionality a- little smoother, especially when working with external- libraries or GHC TypeLit's Nat comparison API.- .- See README for more information.-homepage: https://github.com/mstksg/typelits-witnesses-license: MIT-license-file: LICENSE-author: Justin Le-maintainer: justin@jle.im-copyright: (c) Justin Le 2018-category: Data-build-type: Simple-extra-source-files: README.md- , CHANGELOG.md-cabal-version: >=1.10-tested-with: GHC == 7.8.4- , GHC == 7.10.3- , GHC == 8.0.2- , GHC == 8.2.1+-- This file has been generated from package.yaml by hpack version 0.28.2.+--+-- see: https://github.com/sol/hpack+--+-- hash: 49b45270e83bf287fa91eedadcbf979e2b8e5438d6ec9adaa6e6fea22183f1a0 +name: typelits-witnesses+version: 0.3.0.3+synopsis: Existential witnesses, singletons, and classes for operations on GHC TypeLits+description: Provides witnesses for 'KnownNat' and 'KnownSymbol'+ instances for various operations on GHC TypeLits - in+ particular, the arithmetic operations defined in+ "GHC.TypeLits", and also for type-level lists of+ 'KnownNat' and 'KnownSymbol' instances.+ .+ This is useful for situations where you have+ @'KnownNat' n@, and you want to prove to GHC+ @'KnownNat' (n + 3)@, or @'KnownNat' (2*n + 4)@, or when+ constraints on the lower or upper limits of @n@ are+ needed.+ .+ It's also useful for when you want to work with type+ level lists of 'KnownNat' or 'KnownSymbol' instances and+ singletons for traversing them, and be able to apply+ analogies of 'natVal' and 'symbolVal' to lists with+ analogies for 'SomeNat' and 'SomeSymbol'.+ .+ Note that most of the functionality in this library can+ be reproduced in a more generic way using the great+ <https://hackage.haskell.org/package/singletons singletons>+ library. The versions here are provided as a "plumbing+ included" alternative that makes some commonly found+ design patterns involving GHC's TypeLits functionality a+ little smoother, especially when working with external+ libraries or GHC TypeLit's Nat comparison API.+ .+ See README for more information.+category: Data+homepage: https://github.com/mstksg/typelits-witnesses+author: Justin Le+maintainer: justin@jle.im+copyright: (c) Justin Le 2018+license: MIT+license-file: LICENSE+tested-with: GHC>=8.0 && <8.8+build-type: Simple+cabal-version: >= 1.10+extra-source-files:+ CHANGELOG.md+ README.md+ source-repository head- type: git- location: git://github.com/mstksg/typelits-witnesses.git+ type: git+ location: git://github.com/mstksg/typelits-witnesses.git library- exposed-modules: GHC.TypeLits.Witnesses- GHC.TypeLits.List- GHC.TypeLits.Compare- -- other-modules: - -- other-extensions: - if impl(ghc >= 8.0)- build-depends: base >=4.7 && <5- , base-compat- , constraints- , reflection >= 2- , transformers- else- build-depends: base >=4.7 && <5- , base-compat- , constraints < 0.9.1- , reflection >= 2- , transformers- hs-source-dirs: src- ghc-options: -Wall- default-language: Haskell2010+ exposed-modules:+ GHC.TypeLits.Witnesses+ GHC.TypeLits.List+ GHC.TypeLits.Compare+ other-modules:+ Paths_typelits_witnesses+ hs-source-dirs:+ src+ ghc-options: -Wall+ build-depends:+ base >=4.7 && <5+ , constraints+ , reflection >=2+ default-language: Haskell2010