[commit: base] master: Add a type-family for comparing numbers. (d0e0ace)
Iavor Diatchki
diatchki at galois.com
Tue May 1 08:09:02 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/d0e0ace6500784bc8714ae070c1b0c625f71d732
>---------------------------------------------------------------
commit d0e0ace6500784bc8714ae070c1b0c625f71d732
Author: Iavor S. Diatchki <iavor.diatchki at gmail.com>
Date: Mon Apr 30 23:08:54 2012 -0700
Add a type-family for comparing numbers.
For the moment, this replaces the class (<=) because it is
easier to fit with GHC's coercion evidence.
>---------------------------------------------------------------
GHC/TypeLits.hs | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/GHC/TypeLits.hs b/GHC/TypeLits.hs
index 984fd39..8b4e13b 100644
--- a/GHC/TypeLits.hs
+++ b/GHC/TypeLits.hs
@@ -23,7 +23,7 @@ module GHC.TypeLits
, withSing, singThat
-- * Functions on type nats
- , type (<=), type (+), type (*), type (^)
+ , type (<=), type (<=?), type (+), type (*), type (^)
-- * Destructing type-nats.
, isZero, IsZero(..)
@@ -76,6 +76,8 @@ class SingI a where
-- | Comparsion of type-level naturals.
class (m :: Nat) <= (n :: Nat)
+type family (m :: Nat) <=? (n :: Nat) :: Bool
+
-- | Addition of type-level naturals.
type family (m :: Nat) + (n :: Nat) :: Nat
More information about the Cvs-libraries
mailing list