singleton-nats 0.4.0.2 → 0.4.0.3
raw patch · 2 files changed
+14/−11 lines, 2 filesdep ~singletonsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: singletons
API changes (from Hackage documentation)
- Data.Nat: instance Data.Singletons.SuppressUnusedWarnings.SuppressUnusedWarnings Data.Nat.Compare_1627438067Sym0
- Data.Nat: instance Data.Singletons.SuppressUnusedWarnings.SuppressUnusedWarnings Data.Nat.Compare_1627438067Sym1
+ Data.Nat: instance Data.Singletons.SuppressUnusedWarnings.SuppressUnusedWarnings Data.Nat.Compare_6989586621679052581Sym0
+ Data.Nat: instance Data.Singletons.SuppressUnusedWarnings.SuppressUnusedWarnings Data.Nat.Compare_6989586621679052581Sym1
- Data.Nat: data SSym0 (l_abzL :: TyFun Nat Nat)
+ Data.Nat: data SSym0 (l_aabK :: TyFun Nat Nat)
- Data.Nat: type SSym1 (t_abzK :: Nat) = S t_abzK
+ Data.Nat: type SSym1 (t_aabJ :: Nat) = S t_aabJ
Files
- Data/Nat.hs +10/−7
- singleton-nats.cabal +4/−4
Data/Nat.hs view
@@ -2,7 +2,7 @@ UndecidableInstances, ScopedTypeVariables, DataKinds, FlexibleInstances, GADTs, TypeFamilies, TemplateHaskell, InstanceSigs, TypeOperators, PolyKinds, StandaloneDeriving,- FlexibleContexts, AllowAmbiguousTypes #-}+ FlexibleContexts, AllowAmbiguousTypes, CPP, OverloadedStrings #-} module Data.Nat ( Nat(..)@@ -17,7 +17,7 @@ , SNat , Data.Singletons.Prelude.Sing(SS, SZ) , Data.Singletons.Prelude.PNum- , Data.Singletons.Prelude.SNum + , Data.Singletons.Prelude.SNum , SSym0(..) , SSym1(..) , ZSym0(..)@@ -28,7 +28,7 @@ import Data.Singletons.TH import Data.Singletons.Prelude import Unsafe.Coerce-import qualified GHC.TypeLits as Lit +import qualified GHC.TypeLits as Lit $(singletons [d| data Nat = Z | S Nat deriving (Eq, Show, Ord)@@ -58,7 +58,11 @@ instance Ord (SNat n) where compare _ _ = EQ +#if MIN_VERSION_singletons(2,3,0)+instance PNum Nat where+#else instance PNum ('Proxy :: Proxy Nat) where+#endif type a :+ b = NatPlus a b type a :- b = NatMinus a b type a :* b = NatMul a b@@ -66,13 +70,13 @@ type Signum (a :: Nat) = Error "Data.Nat: signum not implemented" type FromInteger (a :: Lit.Nat) = Lit a -instance SNum Nat where +instance SNum Nat where (%:+) = sNatPlus (%:*) = sNatMul (%:-) = sNatMinus- sAbs = sNatAbs + sAbs = sNatAbs sSignum = case toSing "Data.Nat: signum not implemented" of- SomeSing s -> sError s + SomeSing s -> sError s sFromInteger n = case n %:== (sing :: Sing 0) of STrue -> unsafeCoerce SZ SFalse -> unsafeCoerce (SS (sFromInteger (n %:- (sing :: Sing 1))))@@ -107,4 +111,3 @@ sLit :: forall (n :: Lit.Nat). SingI (Lit n) => Sing (Lit n) sLit = sing-
singleton-nats.cabal view
@@ -1,8 +1,8 @@ name: singleton-nats-version: 0.4.0.2+version: 0.4.0.3 synopsis: Unary natural numbers relying on the singletons infrastructure.-description: Unary natural number relying on the <https://hackage.haskell.org/package/singletons singletons> infrastructure. More information about the general usage of singletons can be found on the <https://github.com/goldfirere/singletons singletons github> page. +description: Unary natural number relying on the <https://hackage.haskell.org/package/singletons singletons> infrastructure. More information about the general usage of singletons can be found on the <https://github.com/goldfirere/singletons singletons github> page. category: Data, Dependent Types homepage: https://github.com/AndrasKovacs/singleton-nats bug-reports: https://github.com/AndrasKovacs/singleton-nats/issues@@ -14,7 +14,7 @@ build-type: Simple cabal-version: >=1.10-tested-with: GHC == 8.0.1+tested-with: GHC == 8.0.1, GHC == 8.2.1 source-repository head type: git@@ -26,6 +26,6 @@ build-depends: base >=4.8.1.0 && <5,- singletons >= 2.2 && < 2.3+ singletons >= 2.2 && < 2.4 default-language: Haskell2010