Created
June 25, 2015 00:46
-
-
Save christian-marie/899cf49873078d3a59cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20:27 < simon> does anyone have an example use of resource-pool? | |
20:28 < simon> and since I plan to use it with MySQL, should I be using the groundhog-mysql package? | |
20:32 < simon> wait, never mind about the last part. groundhog seems cool, but not sure I really want it right now. | |
20:44 < bitraten> simon: https://github.com/bitraten/bitrest/blob/master/src/Database.hs | |
20:47 < bitraten> In most cases you can ignore the IORef and just use a Reader | |
20:50 -!- rodlogic [[email protected]] has quit [Remote host closed the connection] | |
21:00 < simon> bitraten, thanks! | |
21:10 < alpounet> simon: the simplest solution is probably to just make your Server a function that takes a 'Pool Connection' as argument | |
21:10 < alpounet> server :: Pool Connection -> Server YourAPI ; server pool = endpoint1 :<|> endpoint2 :<L> endpoint3 ... | |
21:11 < alpounet> and each request handler can use the pool | |
21:11 < alpounet> if they pretty much all do you can use a Reader or something | |
21:11 < alpounet> it's covered here in the tutorial, fwiw: https://haskell-servant.github.io/tutorial/server.html#using-another-monad-for-your-handlers | |
21:36 < simon> alpounet, that's what I did so far. I'm going to wrap it in a ReaderT, though. | |
21:36 < simon> alpounet, thanks for the link. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment