I just started a new project and wanted to use HaskellDB at the beginning. I created a database with two columns:
create table sensor (
service text,
name text
);
.. learned how to make the basic HaskellDB mechanism (ohhhh .. in the documentation) and wanted to do an insert. However, I wanted to do a partial insertion (there should be more columns), something like:
insert into sensor (service) values ('myservice');
Translated to HaskellDB:
transaction db $ insert db SE.sensor (SE.service <<- (Just $ senService sensor))
But ... it just doesn't work. What also does not work is to specify the column names in a different order, which is also not very convenient. Is there a way to do partial insertion in haskelldb?
The error codes I get is when I simply inserted another column ("name") as the first:
Couldn't match expected type `SEI.Service'
against inferred type `SEI.Name'
Expected type: SEI.Intsensor
Inferred type: Database.HaskellDB.HDBRec.RecCons
SEI.Name (Expr String) er
When using functional dependencies to combine
Database.HaskellDB.Query.InsertRec
(Database.HaskellDB.HDBRec.RecCons f (e a) r)
(Database.HaskellDB.HDBRec.RecCons f (Expr a) er),
etc..
And when I do the "service" as the first and only field, I get:
Couldn't match expected type `Database.HaskellDB.HDBRec.RecCons
SEI.Name
(Expr String)
(Database.HaskellDB.HDBRec.RecCons
SEI.Time
(Expr Int)
(Database.HaskellDB.HDBRec.RecCons
SEI.Intval (Expr Int) Database.HaskellDB.HDBRec.RecNil))'
against inferred type `Database.HaskellDB.HDBRec.RecNil'
( )
" ", : (