
Hello, As an effort to learn Haskell, I am creating a relational algebra engine. To this end, I have been looking at how haskelldb handles its mapping layer. I found this: data RecNil = RecNil deriving (Eq, Ord) data RecCons f a b = RecCons a b deriving (Eq, Ord) It seems to me that the type of "b" is too loose, no? I would like "b" to be of the type RecCons or RecNil as well. The looseness of b prevents me from writing functions like this: data RecCons a b = RecCons a b | RecNil deriving (Eq, Ord) tupleLength :: RecCons a b -> Int tupleLength RecNil = 0 tupleLength (RecCons x xs) = 1 + tupleLength xs -- xs really should be of type RecCons What I would like is a list of arbitrary values rolled into a type such as (RecCons Int (RecCons String RecNil)). I tried a RecCons with existential quantification, but I ended up with a completely loosely-typed list. I would like Haskell's type engine to catch invalid comparisons between record tuples of disparate types. It seems that HDBRec works around this using a variety of typeclasses, but I don't really understand why. Thanks for any advice. Cheers, M