2

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.

ChrisU
  • 473
  • 4
  • 14

1 Answers1

2

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.

Michael Snoyman
  • 31,100
  • 3
  • 48
  • 77
  • Thanks, that was it! I forgot that Persistent's `==.` and Esqueleto's `==.` were different. – ChrisU Nov 14 '13 at 13:09