]> gitweb @ CieloNegro.org - hs-rrdtool.git/blobdiff - Data/HList/Prelude.hs
revised HLength
[hs-rrdtool.git] / Data / HList / Prelude.hs
index 3ab596ffb1e45c2aacf9484384b5f9334e454f81..c63be3ab5d486cae5c20f4fa35db3231e50c1249 100644 (file)
@@ -28,7 +28,7 @@ module Data.HList.Prelude
     , HConcatable(..)
     , HMappable(..)
 
-    , HLength(..)
+    , HLength
     )
     where
 
@@ -158,16 +158,6 @@ instance ( Applyable f x
     hMap f (HCons x xs) = hCons (apply f x) (hMap f xs)
 
 -- HLength
-class IntegerT (HLengthOf l) => HLength l where
-    type HLengthOf l
-    hLength :: Integral n => l -> n
-
-instance HLength HNil where
-    type HLengthOf HNil = D0
-    hLength _ = 0
-
-instance ( HLength l
-         , IntegerT (Succ (HLengthOf l))
-         ) => HLength (HCons e l) where
-    type HLengthOf (HCons e l) = Succ (HLengthOf l)
-    hLength (HCons _ l) = 1 + hLength l
+type family HLength l
+type instance HLength HNil        = D0
+type instance HLength (HCons e l) = Succ (HLength l)