Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficulty creating a ConnectionManager instance #60

Open
imalsogreg opened this issue Aug 16, 2016 · 3 comments
Open

Difficulty creating a ConnectionManager instance #60

imalsogreg opened this issue Aug 16, 2016 · 3 comments

Comments

@imalsogreg
Copy link
Contributor

With new type for withConn :: (conn -> m a) -> conn -> m a, I'm confused about how to write a ConnectionManager instance for snap that defers to the ConnectionManager instance for Pool Postgresql.

What I have so far:

data App = App { _heist :: Snaplet (Heist App), _db :: Pool Postgresql }

instance ConnectionManager App where
  withConn f app@(App _ pg) = do
    pgConn <- extractConnection return pg
    let g = _ f
    withConn g pgConn

It seems I need to somehow create a function g :: Postgresql -> m a out of the function f :: App -> m a if I want to use Postgresql's ConnectionManager instance, but it seems impossible to generate such a function.

Maybe I'm going down the wrong route? The ultimate goal is just to provide a convenience function for running groundhog queries from within my Handler App App monad.

@lykahb
Copy link
Owner

lykahb commented Nov 23, 2016

Hi @imalsogreg. Sorry, I was not able to put as much effort to Groundhog as before and seldom checked the notifications. Have you found a solution for this issue?

@imalsogreg
Copy link
Contributor Author

No problem @lykahb :) Thanks for checking!

I have at least a workaround for now. Rather than write a instance ConnectionManager App, I just use the instance from the connection itself. Do you think you will step back from groundhog permanently? If so, would you like help maintaining it?

@lykahb
Copy link
Owner

lykahb commented Nov 25, 2016

I plan to support Groundhog indefinitely and release pipes/conduit integration sometime in the future. Yet, it would be hard to keep the same level of activity as a couple of years ago. Any help with the maintenance would be invaluable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants