How does "import Database.Persist as X hiding (get)" from the yesod-sqlite template works

Viewed 48

I am using the yesod-sqlite template and trying to use the get function from Database.Persist in a test.

Here is my code:

[Entity _ task] <- runDB $ selectList [TaskName ==. name] []
...
user <- runDB $ X.get (taskUserId task)

And the error I am getting:

my_project/test/Handler/TaskSpec.hs:47:29: error:
Not in scope: ‘X.get’
No module named ‘X’ is imported.

In the TestImport.hs file, I saw this line:

import Database.Persist      as X hiding (get)

To my understanding it should be hidding the get function from the HSpec module, so I could use X.get for database retrieving. I also tried with Database.Persist.get and just get with the same result.

So my doubt is: what that line in TestImport.hs is doing?

1 Answers
Related