2

我从hackage 页面直接查询时遇到类型错误。
查询应该选择GolfCourse名称等于 的a "Miniota"
询问:

getTestR :: Handler Html
getTestR = do
  gcs <- runDB $
          E.select $
          E.from $ \g -> do
          E.where_ (g E.^. GolfCourseName ==. E.val "Miniota")
          return g
  defaultLayout $(widgetFile "test")

错误:

Handler/Home.hs:713:49:
    Couldn't match expected type `Text' with actual type `E.Value typ0'
    Expected type: E.Value Text
      Actual type: E.Value (E.Value typ0)
    In the return type of a call of `E.val'
    In the second argument of `(==.)', namely `E.val "Miniota"'

我怀疑这个错误与我错误地使用E.val
我现在实际上没有gcs在 widgetFile 中使用有关。帮助将不胜感激。

4

1 回答 1

2

我不确定,但可能是您需要使用:

... E.==. E.val ...

由于确切的问题取决于您的导入语句,因此最好提供一个链接到一个完整的、独立的文件来演示该问题。

于 2013-11-14T05:45:15.883 回答