I got trouble with ambiguous type when developing web app with Snap.
My code is
getUserByUsrnamePwd :: Handler HaskellCalendar HaskellCalendar ()
getUserByUsrnamePwd = do
username <- getPostParam "username"
password <- getPostParam "password"
user <- query_ "SELECT * FROM users WHERE username = ? AND password = ?" (username, password)
liftIO $ print (user :: [User])
I got an error
Expected type: (Maybe ByteString, Maybe ByteString)
-> Handler HaskellCalendar HaskellCalendar [User]
Actual type: (Maybe ByteString, Maybe ByteString) -> [r0]
I really don't know why because according to API it should be (Maybe ByteString, Maybe ByteString) rather than (Maybe ByteString, Maybe ByteString) -> [r0]
Kind Regards
Judging by the documentation, it looks like
query_
is only for queries that take no parameters. You wantquery
.