This code gives me an error:
67: isFileInstalled f = do
68: dbcon <- open "/var/lib/beaver/pkgs.db"
69: res <- queryNamed dbcon "SELECT * FROM files WHERE path = :path" [":path" := ("/usr/bin/getpkg" :: String)]
70: mapM_ putStrLn res
71: -- when (null res) (return ())
72: -- putStrLn ("File " ++ res ++ " is already installed and comes from " ++ res ++ ".") -- first res is `owner` and second is `path`
73: close dbcon
74: exit
I get this error:
No instance for (Database.SQLite.Simple.FromField.FromField Char)
arising from a use of `queryNamed' In a stmt of a 'do' block:
res <- queryNamed
dbcon
"SELECT * FROM files WHERE path = :path"
[":path" := ("/usr/bin/getpkg" :: String)] In the expression:
do { dbcon <- open "/var/lib/beaver/pkgs.db";
res <- queryNamed
dbcon
"SELECT * FROM files WHERE path = :path"
[":path" := ("/usr/bin/getpkg" :: String)];
mapM_ putStrLn res;
close dbcon;
.... } In an equation for `isFileInstalled':
isFileInstalled f
= do { dbcon <- open "/var/lib/beaver/pkgs.db";
res <- queryNamed
dbcon
"SELECT * FROM files WHERE path = :path"
[":path" := ("/usr/bin/getpkg" :: String)];
mapM_ putStrLn res;
I didn't find anything in Google. If it's important, OverloadedStrings are enabled. Is there workaround (or way to fix it)?
Aucun commentaire:
Enregistrer un commentaire