
Kevin Jardine
My goal was to find a way to define all that was needed using Haskell's automatic instance deriving mechanism. Haskell can automatically derive Foldable, which is why I was looking at that.
However, that requires writing two lines for each wrapper newtype to get around the kind problem.
I wanted one line.
There: newtype Blog = Blog { getBlogObj :: Obj } newtype Comment = Comment { getCommentObj :: Obj } newtype User = User { getUserObj :: Obj } class GetObject a where getObject :: a -> Obj instance GetObject Blog where getObject = getBlogObject instance GetObject Comment where getObject = getCommentObject instance GetObject User where getObject = getUserObject You shouldn't abuse Foldable for this purpose, unless you really mean it.
I agree that the Foldable solution was a bit of a kludge.
And not necessary either. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/