Haskell Snap:query_ trouble

时间:2013-12-15 20:37:44

标签: haskell haskell-snap-framework

在使用Snap开发Web应用程序时,我遇到了模糊类型的问题。

我的代码是

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])

我收到了错误

Expected type: (Maybe ByteString, Maybe ByteString)
               -> Handler HaskellCalendar HaskellCalendar [User]
  Actual type: (Maybe ByteString, Maybe ByteString) -> [r0]

我真的不知道为什么,因为根据API它应该是(也许是ByteString,也许是ByteString)而不是(也许是ByteString,可能是ByteString) - &gt; [R0]

亲切的问候

1 个答案:

答案 0 :(得分:1)

根据documentation判断,query_似乎仅适用于不带参数的查询。你想要query