[commit: packages/base] master: Add functions for comparing type-level Nats and Symbols. (c1d3546)
git at git.haskell.org
git at git.haskell.org
Wed Mar 19 02:35:33 UTC 2014
Repository : ssh://git@git.haskell.org/base
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/c1d3546420ee482bbbd9f15d45a6e8a26304d419/base
>---------------------------------------------------------------
commit c1d3546420ee482bbbd9f15d45a6e8a26304d419
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.
>---------------------------------------------------------------
c1d3546420ee482bbbd9f15d45a6e8a26304d419
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