]> gitweb @ CieloNegro.org - hs-rrdtool.git/blobdiff - Data/HList.hs
module splitting
[hs-rrdtool.git] / Data / HList.hs
index 77ad6cc7e724fa1a2641fa1d451bd9abbe1d7f8b..56f961d832640e2f68822984d2f5d783b5a7a0e6 100644 (file)
@@ -1,75 +1,19 @@
 module Data.HList
-    ( HList
+    ( -- Data.HList.Prelude
+      HList
     , HNil(..)
     , hNil
-    , HCons(..)
-    , hCons
-
-    , HExtendable(..)
-    , HAppendable(..)
-
-    , (:*:)
+    , (:*:)(..)
     , (.*.)
-    )
-    where
-
-import Data.Typeable
-
--- HList
-class HList l
-
--- HNil
-data HNil
-    = HNil
-      deriving (Show, Eq, Ord, Read, Typeable)
-
-instance HList HNil
-
-hNil :: HNil
-hNil = HNil
-
--- HCons
-data HCons e l
-    = HCons e l
-      deriving (Show, Eq, Ord, Read, Typeable)
 
-instance HList l => HList (HCons e l)
+    , (:++:)
+    , (.++.)
 
-hCons :: HList l => e -> l -> HCons e l
-hCons = HCons
+    , Applyable(..)
 
--- HExtendable
-class HExtendable e l where
-    type HExtend e l
-    hExtend :: e -> l -> HExtend e l
-
-instance HExtendable e HNil where
-    type HExtend e HNil = HCons e HNil
-    hExtend e nil = hCons e nil
-
-instance HList l => HExtendable e (HCons e' l) where
-    type HExtend e (HCons e' l) = HCons e (HCons e' l)
-    hExtend e (HCons e' l) = hCons e (hCons e' l)
-
--- HAppendable
-class HAppendable l l' where
-    type HAppend l l'
-    hAppend :: l -> l' -> HAppend l l'
-
-instance HList l => HAppendable HNil l where
-    type HAppend HNil l = l
-    hAppend _ l = l
-
-instance (HAppendable l l',
-          HList (HAppend l l')) => HAppendable (HCons e l) l' where
-    type HAppend (HCons e l) l' = HCons e (HAppend l l')
-    hAppend (HCons e l) l' = hCons e (hAppend l l')
-
--- :*:
-infixr 2 :*:
-infixr 2 .*.
-
-type e :*: l = HCons e l
+    , HConcat
+    , HMap
+    )
+    where
 
-(.*.) :: HExtendable e l => e -> l -> HExtend e l
-e .*. l = hExtend e l
+import Data.HList.Prelude