{"repo":"brandonchinn178/persistent-mtl","free":true,"listed":false,"github":"https://github.com/brandonchinn178/persistent-mtl","clone":"git clone https://github.com/brandonchinn178/persistent-mtl.git","description":"Monad transformers for the persistent library","language":"Haskell","stars":14,"topics":["monad-transformers","database"],"license":"BSD-3-Clause","category":"databases-storage","readme_excerpt":"persistent-mtl Use the persistent API in your monad transformer stack, seamlessly interleaving business logic with database operations by simply dropping SqlQueryT into your stack. Features: Easy integration into a monad transformer stack Monad type class to generalize functions that use database operations Simple transaction control Supports mocking database operations in tests Quickstart What's wrong with just using persistent ? Using persistent in production code persistent runs all of its functions in SqlPersistT , which is an alias for ReaderT SqlBackend . Since all functions run in this concrete monad and not a generalized type class, it becomes difficult to integrate database operations into your monad transformer stack. Below are some examples of trying to integrate persistent functions into a monad transformer application, and the drawbacks of each option. Option 1: Add SqlPersistT to your monad transformer stack One might look at the SqlPersistT type and think it's a monad transformer, and add it to their monad transformer stack. But since persistent functions run in the concrete SqlPersistT monad (and not with a type class), you'll need some way of lifting SqlPersistT into your application monad. Before going further, I do want to point out that SqlBackend represents a single database connection, so adding SqlPersistT to your monad transformer stack would run your entire application in a single connection (read: single transaction)! So for most applications, this o","default_branch":null,"files":null,"tree":[],"storefront":"/r/brandonchinn178","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/brandonchinn178/persistent-mtl/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}