Commits

Aleksey Khudyakov  committed bab8728

Expose method for IntT type class and fix tests

That what you get for for forgetting to run tests before uploading package

  • Participants
  • Parent commits cd47b79
  • Tags v0.1.0.4

Comments (0)

Files changed (3)

File TypeLevel/Number/Int.hs

                         , Dn
                         , D0
                         , D1
-                        , IntT
+                        , IntT(..)
                           -- * Template haskell utilities
                         , intT
                         , module TypeLevel.Number.Classes

File test/TestNat.hs

 import Language.Haskell.TH
 import Text.Printf
 
-import TypeLevel.Number.Nat
-import TypeLevel.Number.Int
+import TypeLevel.Number.Nat as N
+import TypeLevel.Number.Int as I
 
 text :: Bool -> String
-text flag = if flag then "OK" else "Failed"
+text True  = "OK"
+text False = "Failed"
 
 ----------------------------------------------------------------
 -- Natural numbers
 
 testAdd :: Integer -> Integer -> ExpQ
 testAdd n m = 
-  [| let flag = (n+m) == (toInt $ addN (undefined :: $(natT n)) (undefined :: $(natT m)) :: Integer)
+  [| let flag = (n+m) == (N.toInt $ addN (undefined :: $(natT n)) (undefined :: $(natT m)) :: Integer)
      in printf "Add %3i %3i : %s" (n::Integer) (m::Integer) (text flag) :: String
    |]
 
 testSub :: Integer -> Integer -> ExpQ
 testSub n m = 
-  [| let flag = (n-m) == (toInt $ subN (undefined :: $(natT n)) (undefined :: $(natT m)) :: Integer)
+  [| let flag = (n-m) == (N.toInt $ subN (undefined :: $(natT n)) (undefined :: $(natT m)) :: Integer)
      in printf "Sub %3i %3i : %s" (n::Integer) (m::Integer) (text flag) :: String
    |]
 
 testMul :: Integer -> Integer -> ExpQ
 testMul n m = 
-  [| let flag = (n*m) == (toInt $ mulN (undefined :: $(natT n)) (undefined :: $(natT m)) :: Integer)
+  [| let flag = (n*m) == (N.toInt $ mulN (undefined :: $(natT n)) (undefined :: $(natT m)) :: Integer)
      in printf "Mul %3i %3i : %s" (n::Integer) (m::Integer) (text flag) :: String
    |]
 
 
 testAddZ :: Integer -> Integer -> ExpQ
 testAddZ n m = 
-  [| let flag = (n+m) == (toInt $ addN (undefined :: $(intT n)) (undefined :: $(intT m)) :: Integer)
+  [| let flag = (n+m) == (I.toInt $ addN (undefined :: $(intT n)) (undefined :: $(intT m)) :: Integer)
      in printf "Add %3i %3i : %s" (n::Integer) (m::Integer) (text flag) :: String
    |]
 
 testSubZ :: Integer -> Integer -> ExpQ
 testSubZ n m = 
-  [| let flag = (n-m) == (toInt $ subN (undefined :: $(intT n)) (undefined :: $(intT m)) :: Integer)
+  [| let flag = (n-m) == (I.toInt $ subN (undefined :: $(intT n)) (undefined :: $(intT m)) :: Integer)
      in printf "Sub %3i %3i : %s" (n::Integer) (m::Integer) (text flag) :: String
    |]
 
 testMulZ :: Integer -> Integer -> ExpQ
 testMulZ n m = 
-  [| let flag = (n*m) == (toInt $ mulN (undefined :: $(intT n)) (undefined :: $(intT m)) :: Integer)
+  [| let flag = (n*m) == (I.toInt $ mulN (undefined :: $(intT n)) (undefined :: $(intT m)) :: Integer)
      in printf "Mul %3i %3i : %s" (n::Integer) (m::Integer) (text flag) :: String
    |]
 

File type-level-numbers.cabal

 Name:           type-level-numbers
-Version:        0.1.0.3
+Version:        0.1.0.4
 Synopsis:       
   Type level numbers implemented using type families.
 Description: