[commit: packages/base] ghc-7.8: Add functions for comparing type-level Nats and Symbols. (fca6b0b)

git at git.haskell.org git at git.haskell.org
Thu Mar 27 16:10:59 UTC 2014


Repository : ssh://git@git.haskell.org/base

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/fca6b0b9ee8371e4cbd440a802a21886f1f2d630/base

>---------------------------------------------------------------

commit fca6b0b9ee8371e4cbd440a802a21886f1f2d630
Author: Iavor S. Diatchki <diatchki at galois.com>
Date:   Tue Mar 18 19:35:05 2014 -0700

    Add functions for comparing type-level Nats and Symbols.
    
    (cherry picked from commit c1d3546420ee482bbbd9f15d45a6e8a26304d419)


>---------------------------------------------------------------

fca6b0b9ee8371e4cbd440a802a21886f1f2d630
 GHC/TypeLits.hs |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/GHC/TypeLits.hs b/GHC/TypeLits.hs
index e85b36c..ac0f1ae 100644
--- a/GHC/TypeLits.hs
+++ b/GHC/TypeLits.hs
@@ -29,12 +29,13 @@ module GHC.TypeLits
   , sameNat, sameSymbol
 
 
-    -- * Functions on type nats
+    -- * Functions on type literals
   , type (<=), type (<=?), type (+), type (*), type (^), type (-)
+  , CmpNat, CmpSymbol
 
   ) where
 
-import GHC.Base(Eq(..), Ord(..), Bool(True,False), otherwise)
+import GHC.Base(Eq(..), Ord(..), Bool(True,False), Ordering(..), otherwise)
 import GHC.Num(Integer)
 import GHC.Base(String)
 import GHC.Show(Show(..))
@@ -153,6 +154,12 @@ infixr 8 ^
 type x <= y = (x <=? y) ~ True
 
 -- | Comparison of type-level naturals, as a function.
+type family CmpSymbol (m :: Symbol) (n :: Symbol) :: Ordering
+
+-- | Comparison of type-level symbols, as a function.
+type family CmpNat    (m :: Nat)    (n :: Nat)    :: Ordering
+
+-- | Comparison of type-level naturals, as a function.
 type family (m :: Nat) <=? (n :: Nat) :: Bool
 
 -- | Addition of type-level naturals.



More information about the ghc-commits mailing list