Understand my error



bad = withDB $ \db->
  insert db P.farmers (P.farmer_id << constant 3 #
                       P.name << constant "Jack Farmer" #
                       H.farm_id << constant 2)


Err> bad
ERROR "Err.hs" - Constraints are not consistent with functional dependency
*** Constraint : InsertRec (RecCons Farm_id (Expr Int) RecNil) (RecCons Farm_id (Expr Int) RecNil)
*** And constraint : InsertRec (RecCons Farm_id (Expr Int) RecNil) (RecCons Farm_id (Expr Int) RecNil)
*** For class : InsertRec a b
*** Break dependency : a -> b
Farming.Farms> ERROR - Undefined variable "bad"

The ugly error messages is a result of our implementation of records. Usually you have made the mistake to ask for a field that does not exist in that table, but in another table. Even though they may be exactly the same in the database haskell sees them as being of different type when they are in the record structure. The misstake here is that I used H instead of P

also see insert and delete
what's that P and H ?

Here are all words and functions with references, in alphabetical order

Go to main page