type-level-numbers 0.1 → 0.1.0.1
raw patch · 4 files changed
+37/−19 lines, 4 files
Files
- TypeLevel/Number/Int.hs +5/−5
- TypeLevel/Number/Nat/Num.hs +23/−10
- TypeLevel/Number/Nat/TH.hs +3/−3
- type-level-numbers.cabal +6/−1
TypeLevel/Number/Int.hs view
@@ -48,12 +48,12 @@ -- | Generate type for integer number. intT :: Integer -> TypeQ-intT = foldr appT [t| ZZ |] . map con . splitToTrits+intT = foldr appT (conT ''ZZ) . map con . splitToTrits where- con (-1) = [t| Dn |]- con 0 = [t| D0 |]- con 1 = [t| D1 |]- con x = error $ "Strange trit: " ++ show x+ con (-1) = conT ''Dn+ con 0 = conT ''D0+ con 1 = conT ''D1+ con x = error $ "Strange trit: " ++ show x ---------------------------------------------------------------- --
TypeLevel/Number/Nat/Num.hs view
@@ -3,16 +3,29 @@ import TypeLevel.Number.Nat -type N0 = $(natT 0)-type N1 = $(natT 1)-type N2 = $(natT 2)-type N3 = $(natT 3)-type N4 = $(natT 4)-type N5 = $(natT 5)-type N6 = $(natT 6)-type N7 = $(natT 7)-type N8 = $(natT 8)-type N9 = $(natT 9)+-- type N0 = $(natT 0)+-- type N1 = $(natT 1)+-- type N2 = $(natT 2)+-- type N3 = $(natT 3)+-- type N4 = $(natT 4)+-- type N5 = $(natT 5)+-- type N6 = $(natT 6)+-- type N7 = $(natT 7)+-- type N8 = $(natT 8)+-- type N9 = $(natT 9)++-- Workaround for GHC bug #4364+-- http://hackage.haskell.org/trac/ghc/ticket/4364+type N0 = Z+type N1 = I Z+type N2 = O (I Z)+type N3 = I (I Z)+type N4 = O (O (I Z))+type N5 = I (O (I Z))+type N6 = O (I (I Z))+type N7 = I (I (I Z))+type N8 = O (O (O (I Z)))+type N9 = I (O (O (I Z))) n0 :: N0; n0 = undefined n1 :: N1; n1 = undefined
TypeLevel/Number/Nat/TH.hs view
@@ -16,11 +16,11 @@ -- | Create type for natural number. natT :: Integer -> TypeQ-natT n | n >= 0 = foldr appT [t| Z |] . map con . splitToBits $ n+natT n | n >= 0 = foldr appT (conT ''Z) . map con . splitToBits $ n | otherwise = error "natT: negative number is supplied" where- con 0 = [t| O |]- con 1 = [t| I |]+ con 0 = conT ''O+ con 1 = conT ''I con _ = error "natT: Strange bit nor 0 nor 1" -- | Create value for type level natural. Value itself is undefined.
type-level-numbers.cabal view
@@ -1,5 +1,5 @@ Name: type-level-numbers-Version: 0.1+Version: 0.1.0.1 Cabal-Version: >= 1.6 License: BSD3 License-File: LICENSE@@ -29,6 +29,11 @@ . So far comparison of numbers, subtraction and multiplication of numbers are supported.+ .+ Changes in 0.1.0.1:+ .+ * Workaround for GHC bug #4364 (Build failure on GHC7.0)+ source-repository head type: hg