, HConcatable(..)
, HMappable(..)
- , HLength(..)
+ , HLength
)
where
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)