Question

I'm getting a type error with a query right from the hackage page.
The query is supposed to select a GolfCourse whose name is equal to "Miniota".
Query:

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

The error:

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"'

I suspect that the error has to do with me incorrectly using E.val
I'm not actually using gcs in the widgetFile right now. Help would be very appreciated.

Était-ce utile?

La solution

I'm not certain, but it might be that you need to use:

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

Since the exact problem depends on your import statements, it's probably a good idea to provide a link to a complete, standalone file demonstrating the problem.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top