packages feed

hipsql-monad (empty) → 0.0.0.0

raw patch · 3 files changed

+69/−0 lines, 3 filesdep +basedep +postgresql-libpq

Dependencies added: base, postgresql-libpq

Files

+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# Changelog for hipsql-monad++## 0.0.0.0++* Initial release
+ hipsql-monad.cabal view
@@ -0,0 +1,37 @@+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.31.2.+--+-- see: https://github.com/sol/hpack+--+-- hash: 51f7c0aa4ca8fedab77c5c2425e8d829741e8d96ef9970bf786a36224375fb27++name:           hipsql-monad+version:        0.0.0.0+description:    Please see the README on GitHub at <https://github.com/simspace/hipsql#readme>+homepage:       https://github.com/simspace/hipsql#readme+bug-reports:    https://github.com/simspace/hipsql/issues+author:         Cary Robbins+maintainer:     carymrobbins@gmail.com+copyright:      2021 SimSpace+license:        BSD3+build-type:     Simple+extra-source-files:+    CHANGELOG.md++source-repository head+  type: git+  location: https://github.com/simspace/hipsql++library+  exposed-modules:+      Hipsql.Monad+  other-modules:+      Paths_hipsql_monad+  hs-source-dirs:+      library+  ghc-options: -Wall+  build-depends:+      base >=4.7 && <5+    , postgresql-libpq >=0.9.4.2 && <0.10+  default-language: Haskell2010
+ library/Hipsql/Monad.hs view
@@ -0,0 +1,27 @@+-- | This module provides a low-dependency integration point for+-- supporting @hipsql@ interop in your own 'Monad'.+--+-- In practice, you generally want to define an instance for+-- 'MonadHipsqlAdapter' and use the orphan instance for 'MonadHipsql' provided+-- by importing 'Hipsql.Server.Adapter' from @hipsql-server@. This way,+-- you can optionally depend on @hipsql-server@ only when you need to+-- but can always depend on @hipsql-monad@, the latter of which would+-- not cause you to transitively depend on any additional packages.+module Hipsql.Monad where++import GHC.Stack (HasCallStack)+import qualified Database.PostgreSQL.LibPQ as LibPQ++-- | Type class for starting a @hipsql@ session in a @Monad m@.+--+-- N.B. You generally do not want to define this instance on your own.+-- See the haddock at the top of this module.+class MonadHipsql m where+  -- | Starts a @hipsql@ session in the given @Monad m@.+  hipsql :: (HasCallStack) => m ()++-- | Convenience type class used for deriving instances of 'MonadHipsql'.+--+-- See the haddock at the top of this module for an explanation.+class MonadHipsqlAdapter m where+  hipsqlAcquireLibPQ :: (LibPQ.Connection -> IO a) -> m a