type-level 0.2.4 → 0.3.0
raw patch · 5 files changed
+31/−24 lines, 5 filesnew-uploader
Files
- README +1/−1
- src/Data/TypeLevel/Num.hs +1/−1
- src/Data/TypeLevel/Num/Aliases.hs +1/−1
- src/Data/TypeLevel/Num/Ops.hs +17/−15
- type-level.cabal +11/−6
README view
@@ -21,7 +21,7 @@ parameterized by the modulus). Here is a tutorial on type-level numerals and how to use them to-implement numerically-parameterized vectors: http://www.ict.kth.se/org/ict/ecs/sam/projects/forsyde/www/files/tutorial/tutorial.html#FSVec+implement numerically-parameterized vectors: https://forsyde.ict.kth.se/trac/wiki/ForSyDe/Haskell/ForSyDeTutorial#FSVec DEPENDENCIES
src/Data/TypeLevel/Num.hs view
@@ -13,7 +13,7 @@ -- functions of the type-level library. -- -- Here is a tutorial on type-level numerals and how to use them to--- implement numerically-parameterized vectors: <http://www.ict.kth.se/org/ict/ecs/sam/projects/forsyde/www/files/tutorial/tutorial.html#FSVec>+-- implement numerically-parameterized vectors: <https://forsyde.ict.kth.se/trac/wiki/ForSyDe/Haskell/ForSyDeTutorial#FSVec> -- ---------------------------------------------------------------------------- module Data.TypeLevel.Num
src/Data/TypeLevel/Num/Aliases.hs view
@@ -1,4 +1,5 @@ {-# OPTIONS_GHC -fno-warn-missing-signatures #-}+{-# OPTIONS_HADDOCK prune #-} {-# LANGUAGE CPP, TemplateHaskell #-} ----------------------------------------------------------------------------- -- |@@ -21,7 +22,6 @@ module Data.TypeLevel.Num.Aliases where import Language.Haskell.TH-import Data.TypeLevel.Num.Reps import Data.TypeLevel.Num.Aliases.TH (genAliases)
src/Data/TypeLevel/Num/Ops.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, TypeOperators, FlexibleInstances, FlexibleContexts, UndecidableInstances,- EmptyDataDecls #-}+ EmptyDataDecls, AllowAmbiguousTypes #-} ----------------------------------------------------------------------------- -- | -- Module : Data.TypeLevel.Num.Ops@@ -83,11 +83,12 @@ -- trying to calculate the predecesor of 0 -- FIXME: however, the instance rule is never triggered! -class Failure t--- No instances-data PredecessorOfZeroError t+--class Failure t+---- No instances+--data PredecessorOfZeroError t -instance Failure (PredecessorOfZeroError x) => Succ' (x,x) (x,x) D0 D0 True+--instance Failure (PredecessorOfZeroError x) => Succ' (x,x) (x,x) D0 D0 True+ instance Succ' xi D0 xi D1 False instance Succ' xi D1 xi D2 False instance Succ' xi D2 xi D3 False@@ -248,12 +249,13 @@ class (Nat x, Pos y) => DivMod x y q r | x y -> q r instance (Pos y, Trich x y cmp, DivMod' x y q r cmp) => DivMod x y q r -class (Nat x, Pos y) => DivMod' x y q r cmp | x y cmp -> q r, - q r cmp y -> x,- q r cmp x -> y +-- FIXME: Is it required to introduce "q r x -> y" dependency as special case for q!=0?+class (Nat x, Pos y) => DivMod' x y q r cmp | x y cmp -> q r,+ q r y -> x+ instance (Nat x, Pos y) => DivMod' x y D0 x LT-instance (Nat x, Pos y) => DivMod' x y D1 D0 EQ-instance (Nat x, Pos y, Sub x y x', Pred q q', DivMod x' y q' r) +instance (Pos x) => DivMod' x x D1 D0 EQ+instance (Nat x, Pos y, Sub x y x', Sub q D1 q', Trich x' y cmp, DivMod' x' y q' r cmp) => DivMod' x y q r GT -- | value-level reflection function for the 'DivMod' type-level relation@@ -262,7 +264,7 @@ -- | Division type-level relation. Remainder-discarding version of 'DivMod'. -- Note it is not relational (due to DivMod not being relational)-class Div x y z | x y -> z, x z -> y, y z -> x+class Div x y z | x y -> z instance (DivMod x y q r) => Div x y q -- | value-level reflection function for the 'Div' type-level relation @@ -332,7 +334,7 @@ -- | Division by 10 type-level relation (based on DivMod10)-class (Nat x, Nat q) => Div10 x q | x -> q, q -> x+class (Nat x, Nat q) => Div10 x q | x -> q instance DivMod10 x q r => Div10 x q -- | value-level reflection function for Mul10 @@ -384,7 +386,7 @@ -- @log_base_b x = e@ -- Note it is not relational (i.e. cannot be used to express exponentiation) class (Pos b, b :>=: D2, Pos x, Nat e) => LogBase b x e | b x -> e -instance LogBaseF b x e f => LogBase b x e+instance (Pos b, b :>=: D2, Pos x, Nat e, LogBaseF b x e f) => LogBase b x e -- | value-level reflection function for LogBase@@ -398,7 +400,7 @@ -- tells if the result provided is exact) class (Pos b, b :>=: D2, Pos x, Nat e, Bool f) => LogBaseF b x e f | b x -> e f-instance (Trich x b cmp, LogBaseF' b x e f cmp) => LogBaseF b x e f+instance (Pos b, b :>=: D2, Pos x, Nat e, Bool f, Trich x b cmp, LogBaseF' b x e f cmp) => LogBaseF b x e f class (Pos b, b :>=: D2, Pos x, Nat e, Bool f) => LogBaseF' b x e f cmp | b x cmp -> e f @@ -423,7 +425,7 @@ -- (@b@) (i.e. the fractional part of @log_base_b x = 0@, or, -- in a different way, @exists y . b\^y = x@). class (Pos b, b :>=: D2, Pos x) => IsPowOf b x-instance (Trich x b cmp, IsPowOf' b x cmp) => IsPowOf b x+instance (Pos b, b :>=: D2, Pos x, Trich x b cmp, IsPowOf' b x cmp) => IsPowOf b x class (Pos b, b :>=: D2, Pos x) => IsPowOf' b x cmp -- If lower (x < b), then the logarithm is not exact
type-level.cabal view
@@ -1,6 +1,6 @@ name: type-level-version: 0.2.4-cabal-version: >= 1.2+version: 0.3.0+cabal-version: >= 1.6 build-type: Simple license: BSD3 license-file: LICENSE@@ -33,11 +33,10 @@ parameterized by the modulus). Here is a tutorial on type-level numerals and how to use them to- implement numerically-parameterized vectors: <http://www.ict.kth.se/forsyde/files/tutorial/tutorial.html#FSVec>-+ implement numerically-parameterized vectors: <https://forsyde.ict.kth.se/trac/wiki/ForSyDe/Haskell/ForSyDeTutorial#FSVec> category: Data-tested-with: GHC==6.10.4+tested-with: GHC==7.10.1 extra-source-files: LICENSE, README @@ -53,7 +52,13 @@ Data.TypeLevel.Num.Sets, Data.TypeLevel.Num.Ops, Data.TypeLevel.Num.Aliases.TH- ghc-options: -Wall+ ghc-options: -Wall + if impl(ghc >= 8.0) + ghc-options: -Wno-redundant-constraints if os(win32) -- The symbols for the zillion type level numbers overflows the Windows DLL symbol space. cpp-options: -DSLIM++source-repository head+ type: git+ location: https://github.com/forsyde/type-level.git