{"action":"created","issue":{"url":"https://api.github.com/repos/agrafix/Spock/issues/57","labels_url":"https://api.github.com/repos/agrafix/Spock/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/agrafix/Spock/issues/57/comments","events_url":"https://api.github.com/repos/agrafix/Spock/issues/57/events","html_url":"https://github.com/agrafix/Spock/issues/57","id":114421427,"number":57,"title":"Connect to a database","user":{"login":"jbpotonnier","id":368382,"avatar_url":"https://avatars.githubusercontent.com/u/368382?v=3","gravatar_id":"","url":"https://api.github.com/users/jbpotonnier","html_url":"https://github.com/jbpotonnier","followers_url":"https://api.github.com/users/jbpotonnier/followers","following_url":"https://api.github.com/users/jbpotonnier/following{/other_user}","gists_url":"https://api.github.com/users/jbpotonnier/gists{/gist_id}","starred_url":"https://api.github.com/users/jbpotonnier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbpotonnier/subscriptions","organizations_url":"https://api.github.com/users/jbpotonnier/orgs","repos_url":"https://api.github.com/users/jbpotonnier/repos","events_url":"https://api.github.com/users/jbpotonnier/events{/privacy}","received_events_url":"https://api.github.com/users/jbpotonnier/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-10-31T17:01:53Z","updated_at":"2015-11-13T13:14:39Z","closed_at":"2015-11-13T13:14:39Z","body":"I'm trying to connect to a RethinkDB database, but I don't understand how to do it with Spock.\r\n\r\nI created a `PoolOrConn` like this : \r\n```haskell\r\ndbConn :: PoolOrConn R.RethinkDBHandle\r\ndbConn =\r\n  PCConn (ConnBuilder\r\n          (R.connect \"localhost\" 28015 Nothing)\r\n          R.close\r\n          (PoolCfg 5 5 60)\r\n         )\r\n```\r\nI typed my actions like this one :\r\n```haskell\r\ninsertMessageAction :: SpockAction R.RethinkDBHandle session state ()\r\n```\r\nSince I use a websocket app (named `wsapp`), my main function looks like this :\r\n```haskell\r\nmain :: IO ()\r\nmain = do\r\n  app <- spockAsApp $ spockT _g $ appMiddleware >> appRoutes\r\n  Warp.runSettings\r\n        (Warp.setPort 3000 Warp.defaultSettings)\r\n        (WaiWS.websocketsOr WS.defaultConnectionOptions wsapp app)\r\n```\r\nIt looks I have to put something in he `_g` hole. Probably it has to do with monad transformers, which sadly I don't fully understand yet.\r\n\r\nCould you provide some help?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/agrafix/Spock/issues/comments/156428702","html_url":"https://github.com/agrafix/Spock/issues/57#issuecomment-156428702","issue_url":"https://api.github.com/repos/agrafix/Spock/issues/57","id":156428702,"user":{"login":"agrafix","id":1106569,"avatar_url":"https://avatars.githubusercontent.com/u/1106569?v=3","gravatar_id":"","url":"https://api.github.com/users/agrafix","html_url":"https://github.com/agrafix","followers_url":"https://api.github.com/users/agrafix/followers","following_url":"https://api.github.com/users/agrafix/following{/other_user}","gists_url":"https://api.github.com/users/agrafix/gists{/gist_id}","starred_url":"https://api.github.com/users/agrafix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agrafix/subscriptions","organizations_url":"https://api.github.com/users/agrafix/orgs","repos_url":"https://api.github.com/users/agrafix/repos","events_url":"https://api.github.com/users/agrafix/events{/privacy}","received_events_url":"https://api.github.com/users/agrafix/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T13:14:39Z","updated_at":"2015-11-13T13:14:39Z","body":"Closed in favor of #62"}}