singleton-nats 0.4.0.1 → 0.4.0.2
raw patch · 2 files changed
+57/−36 lines, 2 filesdep ~basedep ~singletonsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, singletons
API changes (from Hackage documentation)
- Data.Nat: instance Data.Singletons.Decide.SDecide 'Data.Proxy.KProxy
- Data.Nat: instance Data.Singletons.Prelude.Eq.PEq 'Data.Proxy.KProxy
- Data.Nat: instance Data.Singletons.Prelude.Eq.SEq 'Data.Proxy.KProxy
- Data.Nat: instance Data.Singletons.Prelude.Num.PNum 'Data.Proxy.KProxy
- Data.Nat: instance Data.Singletons.Prelude.Num.SNum 'Data.Proxy.KProxy
- Data.Nat: instance Data.Singletons.Prelude.Ord.POrd 'Data.Proxy.KProxy
- Data.Nat: instance Data.Singletons.Prelude.Ord.SOrd 'Data.Proxy.KProxy => Data.Singletons.Prelude.Ord.SOrd 'Data.Proxy.KProxy
- Data.Nat: instance Data.Singletons.SingKind 'Data.Proxy.KProxy
- Data.Nat: instance Data.Singletons.SuppressUnusedWarnings.SuppressUnusedWarnings Data.Nat.Compare_1627420084Sym0
- Data.Nat: instance Data.Singletons.SuppressUnusedWarnings.SuppressUnusedWarnings Data.Nat.Compare_1627420084Sym1
+ Data.Nat: instance Data.Singletons.Decide.SDecide Data.Nat.Nat
+ Data.Nat: instance Data.Singletons.Prelude.Eq.PEq 'Data.Proxy.Proxy
+ Data.Nat: instance Data.Singletons.Prelude.Eq.SEq Data.Nat.Nat
+ Data.Nat: instance Data.Singletons.Prelude.Num.PNum 'Data.Proxy.Proxy
+ Data.Nat: instance Data.Singletons.Prelude.Num.SNum Data.Nat.Nat
+ Data.Nat: instance Data.Singletons.Prelude.Ord.POrd 'Data.Proxy.Proxy
+ Data.Nat: instance Data.Singletons.Prelude.Ord.SOrd Data.Nat.Nat => Data.Singletons.Prelude.Ord.SOrd Data.Nat.Nat
+ Data.Nat: instance Data.Singletons.SingKind Data.Nat.Nat
+ 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 GHC.Classes.Eq (Data.Nat.SNat n)
+ Data.Nat: instance GHC.Classes.Ord (Data.Nat.SNat n)
+ Data.Nat: instance GHC.Show.Show (Data.Singletons.Sing n)
+ Data.Nat: sLit :: forall (n :: Nat). SingI (Lit n) => Sing (Lit n)
- Data.Nat: class (~) (KProxy a0) kproxy0 (KProxy a0) => PNum (kproxy0 :: KProxy a0)
+ Data.Nat: class (~) (Proxy * a0) kproxy0 (Proxy * a0) => PNum a0 (kproxy0 :: Proxy * a0)
- Data.Nat: class (~) (KProxy a0) kproxy0 (KProxy a0) => SNum (kproxy0 :: KProxy a0)
+ Data.Nat: class SNum a0
- Data.Nat: data SSym0 (l_a7fG :: TyFun Nat Nat)
+ Data.Nat: data SSym0 (l_abzL :: TyFun Nat Nat)
- Data.Nat: type SNat = (Sing :: Nat -> *)
+ Data.Nat: type SNat = (Sing :: Nat -> Type)
- Data.Nat: type SSym1 (t_a7fF :: Nat) = S t_a7fF
+ Data.Nat: type SSym1 (t_abzK :: Nat) = S t_abzK
Files
- Data/Nat.hs +27/−6
- singleton-nats.cabal +30/−30
Data/Nat.hs view
@@ -1,7 +1,8 @@ {-# LANGUAGE UndecidableInstances, ScopedTypeVariables, DataKinds, FlexibleInstances, GADTs, TypeFamilies, TemplateHaskell,- InstanceSigs, TypeOperators, PolyKinds #-}+ InstanceSigs, TypeOperators, PolyKinds, StandaloneDeriving,+ FlexibleContexts, AllowAmbiguousTypes #-} module Data.Nat ( Nat(..)@@ -21,7 +22,8 @@ , SSym1(..) , ZSym0(..) , Lit- , SLit ) where+ , SLit+ , sLit) where import Data.Singletons.TH import Data.Singletons.Prelude@@ -46,9 +48,17 @@ natAbs :: Nat -> Nat natAbs n = n- |]) + |]) -instance PNum ('KProxy :: KProxy Nat) where+deriving instance Show (SNat n)++instance Eq (SNat n) where+ (==) _ _ = True++instance Ord (SNat n) where+ compare _ _ = EQ++instance PNum ('Proxy :: Proxy Nat) where type a :+ b = NatPlus a b type a :- b = NatMinus a b type a :* b = NatMul a b@@ -56,7 +66,7 @@ type Signum (a :: Nat) = Error "Data.Nat: signum not implemented" type FromInteger (a :: Lit.Nat) = Lit a -instance SNum ('KProxy :: KProxy Nat) where +instance SNum Nat where (%:+) = sNatPlus (%:*) = sNatMul (%:-) = sNatMinus@@ -69,7 +79,7 @@ {-| Converts a runtime 'Integer' to an existentially wrapped 'Nat'. Returns 'Nothing' if the argument is negative -}-someNatVal :: Integer -> Maybe (SomeSing (KindOf Z))+someNatVal :: Integer -> Maybe (SomeSing Nat) someNatVal n = case Lit.someNatVal n of Just (Lit.SomeNat (pn :: Proxy n)) -> Just (SomeSing (sFromInteger (sing :: Sing n))) Nothing -> Nothing@@ -86,4 +96,15 @@ Lit n = S (Lit (n Lit.- 1)) type SLit n = Sing (Lit n)++{-| Shorthand for 'SNat' literals using `TypeApplications`.++>>> :set -XTypeApplications+>>> sLit @5+SS (SS (SS (SS (SS SZ))))++-}++sLit :: forall (n :: Lit.Nat). SingI (Lit n) => Sing (Lit n)+sLit = sing
singleton-nats.cabal view
@@ -1,31 +1,31 @@- -name: singleton-nats -version: 0.4.0.1 -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. -category: Data, Dependent Types -homepage: https://github.com/AndrasKovacs/singleton-nats -bug-reports: https://github.com/AndrasKovacs/singleton-nats/issues -license: BSD3 -license-file: LICENSE -author: András Kovács -maintainer: puttamalac@gmail.com -copyright: 2015 András Kovács - -build-type: Simple -cabal-version: >=1.10 -tested-with: GHC == 7.10.2 - -source-repository head - type: git - location: https://github.com/AndrasKovacs/singleton-nats.git - -library - exposed-modules: - Data.Nat - - build-depends: - base >=4.8.1.0 && <4.9, - singletons >= 2.0.1 - ++name: singleton-nats+version: 0.4.0.2+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. +category: Data, Dependent Types+homepage: https://github.com/AndrasKovacs/singleton-nats+bug-reports: https://github.com/AndrasKovacs/singleton-nats/issues+license: BSD3+license-file: LICENSE+author: András Kovács+maintainer: puttamalac@gmail.com+copyright: 2015 András Kovács++build-type: Simple+cabal-version: >=1.10+tested-with: GHC == 8.0.1++source-repository head+ type: git+ location: https://github.com/AndrasKovacs/singleton-nats.git++library+ exposed-modules:+ Data.Nat++ build-depends:+ base >=4.8.1.0 && <5,+ singletons >= 2.2 && < 2.3+ default-language: Haskell2010