
Just to keep you updated, Ok so the design was bad ... a table of elements 'a' will have indexes that hold elements of the same type 'a' so the list of indexes can be [dbIndex a].. There's was still one polymorphism issue : data DbIndex a = DbIndex {dbiInsert :: Row a -> Maybe (DbIndex a), dbiDelete :: Row a -> DbIndex a, dbiFindWithKey :: Dynamic -> Maybe [Row a]} indexDelete DbIndex{dbiDelete=delete} row = delete row indexInsert DbIndex{dbiInsert=insert} row = insert row findWithKey :: forall a k. (Typeable k) => (DbIndex a) -> k -> Maybe [Row a] findWithKey DbIndex{dbiFindWithKey=find} key = find $ toDyn key As far as i understand it, there is absolutely no way for the key in findWithKey to be fully typed while still having the indexes in the same list, so i took the given advice and used dynamics. I guess this is poor style but it does the job ! Thanks again Sacha