dependent-literals 0.1.1.0 → 0.2.0
raw patch · 4 files changed
+29/−22 lines, 4 filesdep +type-comparedep ~numeric-kindsdep ~snumberPVP ok
version bump matches the API change (PVP)
Dependencies added: type-compare
Dependency ranges changed: numeric-kinds, snumber
API changes (from Hackage documentation)
- DependentLiterals.Bounds: instance DependentLiterals.Bounds.AssertNotApart msg (Kinds.Num.Cmp n maxp1) 'GHC.Types.LT => DependentLiterals.Bounds.CheckLessThanMaxBound msg maxp1 a n
- DependentLiterals.Bounds: instance DependentLiterals.Bounds.AssertNotApart msg (n Kinds.Num.>=? min) 'GHC.Types.True => DependentLiterals.Bounds.CheckAtLeastMinBound msg min a n
- DependentLiterals.Int: instance (Kinds.Num.Cmp n ('Kinds.Integer.Pos m) GHC.Types.~ 'GHC.Types.LT, n Kinds.Num.>= 'Kinds.Integer.Pos 0) => DependentLiterals.Int.FinInBounds m n
+ DependentLiterals.Bounds: instance DependentLiterals.Bounds.AssertNotApart msg (n Kinds.Ord.<? maxp1) 'GHC.Types.True => DependentLiterals.Bounds.CheckLessThanMaxBound msg maxp1 a n
+ DependentLiterals.Bounds: instance DependentLiterals.Bounds.AssertNotApart msg (n Kinds.Ord.>=? min) 'GHC.Types.True => DependentLiterals.Bounds.CheckAtLeastMinBound msg min a n
+ DependentLiterals.Int: instance (n Kinds.Ord.< 'Kinds.Integer.Pos m, n Kinds.Ord.>= 'Kinds.Integer.Pos 0) => DependentLiterals.Int.FinInBounds m n
Files
- CHANGELOG.md +11/−3
- dependent-literals.cabal +11/−14
- src/DependentLiterals/Bounds.hs +3/−2
- src/DependentLiterals/Int.hs +4/−3
CHANGELOG.md view
@@ -1,7 +1,15 @@-# 0.1.0.0+# 0.2.0 (2021-11-05) -Initial version.+* Get type-level `Ord` from `type-compare` instead of `numeric-kinds`.+ * Check inequality tests like `<?` against `True` rather than checking+ `Ordering`s against `EQ`.+ * This could in theory require updating constraints, but probably won't break+ anything in practice. -# 0.1.1.0+# 0.1.1.0 (2021-09-09) * Moved the `StockLit` instance to `Wrapped Num` (kept `StockLit` as a newtype).++# 0.1.0.0 (2021-09-08)++Initial version.
dependent-literals.cabal view
@@ -1,14 +1,12 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: ee075abaa5a355783e9d5654e999ec647b0927daf34932c6a04eea6c66e688f2 name: dependent-literals-version: 0.1.1.0-synopsis: Provides library support for pseudo-dependently-typed int literals.+version: 0.2.0+synopsis: Library for dependent-literals-plugin description: This is the library counterpart of <https://hackage.haskell.org/package/dependent-literals-plugin dependent-literals-plugin>. See that package's description for more details.@@ -34,16 +32,15 @@ DependentLiterals DependentLiterals.Bounds DependentLiterals.Int- other-modules:- Paths_dependent_literals hs-source-dirs: src build-depends:- base >=4.12 && <4.16- , fin-int >=0.1 && <0.2- , numeric-kinds >=0.1 && <0.2- , sint >=0.1 && <0.2- , snumber >=0.1 && <0.2- , tagged >=0.8 && <0.9- , wrapped >=0.1 && <0.2+ base >=4.12 && <4.17+ , fin-int >=0.1 && <0.3+ , numeric-kinds >=0.1 && <0.3+ , sint >=0.1 && <0.3+ , snumber >=0.1 && <0.4+ , tagged ==0.8.*+ , type-compare ==0.1.*+ , wrapped ==0.1.* default-language: Haskell2010
src/DependentLiterals/Bounds.hs view
@@ -56,7 +56,8 @@ import GHC.TypeLits (TypeError, ErrorMessage(..)) import Kinds.Integer (pattern Pos, pattern Neg)-import Kinds.Num (type (-), type (>=?), type (<), type (>=), Cmp)+import Kinds.Num (type (-))+import Kinds.Ord (type (>=?), type (<?), type (<), type (>=)) import qualified Kinds.Integer as K (Integer) type family ShowNum (n :: K.Integer) where@@ -103,7 +104,7 @@ (maxp1 :: K.Integer) (a :: Type) (n :: K.Integer)-instance AssertNotApart msg (Cmp n maxp1) 'LT+instance AssertNotApart msg (n <? maxp1) 'True => CheckLessThanMaxBound msg maxp1 a n class (n >= min)
src/DependentLiterals/Int.hs view
@@ -92,7 +92,8 @@ import Data.Tagged (Tagged(..)) import Data.Wrapped (Wrapped(..)) import Kinds.Integer (type (-#), KnownInteger(..), pattern Pos)-import Kinds.Num (type (>=), type (<), Cmp, ToInteger)+import Kinds.Num (ToInteger)+import Kinds.Ord (type (>=), type (<)) import qualified Kinds.Integer as K (Integer) import Data.Fin.Int (Fin, finToInt, unsafeFin) @@ -149,9 +150,9 @@ fromSNum (Satisfying x) = x intoSNum = Satisfying -class (Cmp n ('Pos m) ~ 'LT, n >= 'Pos 0)+class (n < 'Pos m, n >= 'Pos 0) => FinInBounds (m :: Nat) (n :: K.Integer)-instance (Cmp n ('Pos m) ~ 'LT, n >= 'Pos 0) => FinInBounds m n+instance (n < 'Pos m, n >= 'Pos 0) => FinInBounds m n instance SNum (Fin n) where type SNumRepr (Fin n) = Int