From: Mathijs K. <blu...@gm...> - 2009-05-23 02:04:55
|
Hi all, I finally got haskelldb working. It took some time, but (after many tries in the past) I got it. I'm playing around with querying and I have a simple question: I have a table with a foreign key that can be NULL. Now if I try to create an inner-join like restriction, I get a type-mismatch, which I can understand, but couldn't figure out how to solve it (it's a little late here :) let q = do { u <- table users; g <- table groups; restrict (g!G.xid .==. u!U.group_id)} <interactive>:1:4: Couldn't match expected type `Int' against inferred type `Maybe Int' Expected type: Expr Int Inferred type: Expr (Maybe Int) When using functional dependencies to combine Select (Attr f a) (Rel r) (Expr a), arising from the dependency `f r -> a' in the instance declaration at <no location info> Select (Attr U.Group_id (Maybe Int)) (Rel U.Users) (Expr Int), arising from a use of `!' at <interactive>:1:97-107 When generalising the type(s) for `q' What would be the correct way to fix this? Thanks, Mathijs |