Switch to ImportQualifiedPost

This commit is contained in:
Nikita Volkov 2024-04-19 07:38:30 +03:00
parent 2edcd367b8
commit f2f747e6c6
31 changed files with 110 additions and 109 deletions

View File

@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
include:
- ghc: 8.8.1
- ghc: 8.10.1
ghc-options: ""
ignore-haddock: "true"
- ghc: latest

View File

@ -2,10 +2,10 @@ module Main where
import Criterion
import Criterion.Main
import qualified Hasql.Connection as A
import qualified Hasql.Decoders as D
import qualified Hasql.Session as B
import qualified Hasql.Statement as C
import Hasql.Connection qualified as A
import Hasql.Decoders qualified as D
import Hasql.Session qualified as B
import Hasql.Statement qualified as C
import Prelude
main :: IO ()

View File

@ -44,6 +44,7 @@ common base
FunctionalDependencies
GADTs
GeneralizedNewtypeDeriving
ImportQualifiedPost
LambdaCase
LiberalTypeSynonyms
MagicHash
@ -110,7 +111,7 @@ library
build-depends:
, aeson >=2 && <3
, attoparsec >=0.10 && <0.15
, base >=4.13 && <5
, base >=4.14 && <5
, bytestring >=0.10 && <0.13
, bytestring-strict-builder >=0.4.5.1 && <0.5
, contravariant >=1.3 && <2

View File

@ -6,8 +6,8 @@ module Hasql.Commands
)
where
import qualified Data.ByteString.Builder as BB
import qualified Data.ByteString.Lazy as BL
import Data.ByteString.Builder qualified as BB
import Data.ByteString.Lazy qualified as BL
import Hasql.Prelude
newtype Commands

View File

@ -2,11 +2,11 @@
-- This module provides a low-level effectful API dealing with the connections to the database.
module Hasql.Connection.Core where
import qualified Database.PostgreSQL.LibPQ as LibPQ
import qualified Hasql.IO as IO
import Database.PostgreSQL.LibPQ qualified as LibPQ
import Hasql.IO qualified as IO
import Hasql.Prelude
import qualified Hasql.PreparedStatementRegistry as PreparedStatementRegistry
import qualified Hasql.Settings as Settings
import Hasql.PreparedStatementRegistry qualified as PreparedStatementRegistry
import Hasql.Settings qualified as Settings
-- |
-- A single connection to the database.

View File

@ -2,18 +2,18 @@
-- A DSL for declaration of result decoders.
module Hasql.Decoders.All where
import qualified Data.Aeson as Aeson
import qualified Data.Vector.Generic as GenericVector
import qualified Hasql.Decoders.Array as Array
import qualified Hasql.Decoders.Composite as Composite
import qualified Hasql.Decoders.Result as Result
import qualified Hasql.Decoders.Results as Results
import qualified Hasql.Decoders.Row as Row
import qualified Hasql.Decoders.Value as Value
import Data.Aeson qualified as Aeson
import Data.Vector.Generic qualified as GenericVector
import Hasql.Decoders.Array qualified as Array
import Hasql.Decoders.Composite qualified as Composite
import Hasql.Decoders.Result qualified as Result
import Hasql.Decoders.Results qualified as Results
import Hasql.Decoders.Row qualified as Row
import Hasql.Decoders.Value qualified as Value
import Hasql.Prelude hiding (bool, maybe)
import qualified Hasql.Prelude as Prelude
import qualified Network.IP.Addr as NetworkIp
import qualified PostgreSQL.Binary.Decoding as A
import Hasql.Prelude qualified as Prelude
import Network.IP.Addr qualified as NetworkIp
import PostgreSQL.Binary.Decoding qualified as A
-- * Result

View File

@ -1,7 +1,7 @@
module Hasql.Decoders.Array where
import Hasql.Prelude
import qualified PostgreSQL.Binary.Decoding as A
import PostgreSQL.Binary.Decoding qualified as A
newtype Array a
= Array (ReaderT Bool A.Array a)

View File

@ -1,7 +1,7 @@
module Hasql.Decoders.Composite where
import Hasql.Prelude
import qualified PostgreSQL.Binary.Decoding as A
import PostgreSQL.Binary.Decoding qualified as A
newtype Composite a
= Composite (ReaderT Bool A.Composite a)

View File

@ -1,14 +1,14 @@
module Hasql.Decoders.Result where
import qualified Data.Attoparsec.ByteString.Char8 as Attoparsec
import qualified Data.ByteString as ByteString
import qualified Data.Vector as Vector
import qualified Data.Vector.Mutable as MutableVector
import qualified Database.PostgreSQL.LibPQ as LibPQ
import qualified Hasql.Decoders.Row as Row
import Data.Attoparsec.ByteString.Char8 qualified as Attoparsec
import Data.ByteString qualified as ByteString
import Data.Vector qualified as Vector
import Data.Vector.Mutable qualified as MutableVector
import Database.PostgreSQL.LibPQ qualified as LibPQ
import Hasql.Decoders.Row qualified as Row
import Hasql.Errors
import Hasql.Prelude hiding (many, maybe)
import qualified Hasql.Prelude as Prelude
import Hasql.Prelude qualified as Prelude
newtype Result a
= Result (ReaderT (Bool, LibPQ.Result) (ExceptT ResultError IO) a)

View File

@ -10,11 +10,11 @@
-- * Row-by-row fetching.
module Hasql.Decoders.Results where
import qualified Database.PostgreSQL.LibPQ as LibPQ
import qualified Hasql.Decoders.Result as Result
import Database.PostgreSQL.LibPQ qualified as LibPQ
import Hasql.Decoders.Result qualified as Result
import Hasql.Errors
import Hasql.Prelude hiding (many, maybe)
import qualified Hasql.Prelude as Prelude
import Hasql.Prelude qualified as Prelude
newtype Results a
= Results (ReaderT (Bool, LibPQ.Connection) (ExceptT CommandError IO) a)

View File

@ -1,10 +1,10 @@
module Hasql.Decoders.Row where
import qualified Database.PostgreSQL.LibPQ as LibPQ
import qualified Hasql.Decoders.Value as Value
import Database.PostgreSQL.LibPQ qualified as LibPQ
import Hasql.Decoders.Value qualified as Value
import Hasql.Errors
import Hasql.Prelude hiding (error)
import qualified PostgreSQL.Binary.Decoding as A
import PostgreSQL.Binary.Decoding qualified as A
newtype Row a
= Row (ReaderT Env (ExceptT RowError IO) a)

View File

@ -1,7 +1,7 @@
module Hasql.Decoders.Value where
import Hasql.Prelude
import qualified PostgreSQL.Binary.Decoding as A
import PostgreSQL.Binary.Decoding qualified as A
newtype Value a
= Value (Bool -> A.Value a)

View File

@ -2,17 +2,17 @@
-- A DSL for declaration of query parameter encoders.
module Hasql.Encoders.All where
import qualified Data.Aeson as Aeson
import qualified Data.ByteString.Lazy as LazyByteString
import qualified Hasql.Encoders.Array as Array
import qualified Hasql.Encoders.Params as Params
import qualified Hasql.Encoders.Value as Value
import qualified Hasql.PostgresTypeInfo as PTI
import Data.Aeson qualified as Aeson
import Data.ByteString.Lazy qualified as LazyByteString
import Hasql.Encoders.Array qualified as Array
import Hasql.Encoders.Params qualified as Params
import Hasql.Encoders.Value qualified as Value
import Hasql.PostgresTypeInfo qualified as PTI
import Hasql.Prelude hiding (bool)
import qualified Hasql.Prelude as Prelude
import qualified Network.IP.Addr as NetworkIp
import qualified PostgreSQL.Binary.Encoding as A
import qualified Text.Builder as C
import Hasql.Prelude qualified as Prelude
import Network.IP.Addr qualified as NetworkIp
import PostgreSQL.Binary.Encoding qualified as A
import Text.Builder qualified as C
-- * Parameters Product Encoder

View File

@ -1,9 +1,9 @@
module Hasql.Encoders.Array where
import qualified Hasql.PostgresTypeInfo as B
import Hasql.PostgresTypeInfo qualified as B
import Hasql.Prelude
import qualified PostgreSQL.Binary.Encoding as A
import qualified Text.Builder as C
import PostgreSQL.Binary.Encoding qualified as A
import Text.Builder qualified as C
data Array a
= Array B.OID B.OID (Bool -> a -> A.Array) (a -> C.Builder)

View File

@ -1,11 +1,11 @@
module Hasql.Encoders.Params where
import qualified Database.PostgreSQL.LibPQ as A
import qualified Hasql.Encoders.Value as C
import qualified Hasql.PostgresTypeInfo as D
import Database.PostgreSQL.LibPQ qualified as A
import Hasql.Encoders.Value qualified as C
import Hasql.PostgresTypeInfo qualified as D
import Hasql.Prelude
import qualified PostgreSQL.Binary.Encoding as B
import qualified Text.Builder as E
import PostgreSQL.Binary.Encoding qualified as B
import Text.Builder qualified as E
-- |
-- Encoder of some representation of a parameters product.

View File

@ -1,9 +1,9 @@
module Hasql.Encoders.Value where
import qualified Hasql.PostgresTypeInfo as PTI
import Hasql.PostgresTypeInfo qualified as PTI
import Hasql.Prelude
import qualified PostgreSQL.Binary.Encoding as B
import qualified Text.Builder as C
import PostgreSQL.Binary.Encoding qualified as B
import Text.Builder qualified as C
data Value a
= Value PTI.OID PTI.OID (Bool -> a -> B.Encoding) (a -> C.Builder)

View File

@ -10,7 +10,7 @@
-- * Row-by-row fetching.
module Hasql.Errors where
import qualified Data.ByteString.Char8 as BC
import Data.ByteString.Char8 qualified as BC
import Hasql.Prelude
-- |

View File

@ -2,14 +2,14 @@
-- An API of low-level IO operations.
module Hasql.IO where
import qualified Database.PostgreSQL.LibPQ as LibPQ
import qualified Hasql.Commands as Commands
import qualified Hasql.Decoders.Result as ResultDecoders
import qualified Hasql.Decoders.Results as ResultsDecoders
import qualified Hasql.Encoders.Params as ParamsEncoders
import Database.PostgreSQL.LibPQ qualified as LibPQ
import Hasql.Commands qualified as Commands
import Hasql.Decoders.Result qualified as ResultDecoders
import Hasql.Decoders.Results qualified as ResultsDecoders
import Hasql.Encoders.Params qualified as ParamsEncoders
import Hasql.Errors
import Hasql.Prelude
import qualified Hasql.PreparedStatementRegistry as PreparedStatementRegistry
import Hasql.PreparedStatementRegistry qualified as PreparedStatementRegistry
{-# INLINE acquireConnection #-}
acquireConnection :: ByteString -> IO LibPQ.Connection

View File

@ -1,6 +1,6 @@
module Hasql.PostgresTypeInfo where
import qualified Database.PostgreSQL.LibPQ as LibPQ
import Database.PostgreSQL.LibPQ qualified as LibPQ
import Hasql.Prelude hiding (bool)
-- | A Postgresql type info

View File

@ -34,8 +34,8 @@ import Data.Bifunctor as Exports
import Data.Bits as Exports
import Data.Bool as Exports
import Data.ByteString as Exports (ByteString)
import qualified Data.ByteString.Builder
import qualified Data.ByteString.Lazy
import Data.ByteString.Builder qualified
import Data.ByteString.Lazy qualified
import Data.Char as Exports
import Data.Coerce as Exports
import Data.Complex as Exports
@ -68,8 +68,8 @@ import Data.Scientific as Exports (Scientific)
import Data.Semigroup as Exports hiding (First (..), Last (..))
import Data.String as Exports
import Data.Text as Exports (Text)
import qualified Data.Text.Lazy
import qualified Data.Text.Lazy.Builder
import Data.Text.Lazy qualified
import Data.Text.Lazy.Builder qualified
import Data.Time as Exports
import Data.Traversable as Exports
import Data.Tuple as Exports

View File

@ -6,8 +6,8 @@ module Hasql.PreparedStatementRegistry
)
where
import qualified ByteString.StrictBuilder as B
import qualified Data.HashTable.IO as A
import ByteString.StrictBuilder qualified as B
import Data.HashTable.IO qualified as A
import Hasql.Prelude hiding (lookup)
data PreparedStatementRegistry

View File

@ -1,14 +1,14 @@
module Hasql.Session.Core where
import qualified Hasql.Connection.Core as Connection
import qualified Hasql.Decoders.Result as Decoders.Result
import qualified Hasql.Decoders.Results as Decoders.Results
import qualified Hasql.Encoders.All as Encoders
import qualified Hasql.Encoders.Params as Encoders.Params
import Hasql.Connection.Core qualified as Connection
import Hasql.Decoders.Result qualified as Decoders.Result
import Hasql.Decoders.Results qualified as Decoders.Results
import Hasql.Encoders.All qualified as Encoders
import Hasql.Encoders.Params qualified as Encoders.Params
import Hasql.Errors
import qualified Hasql.IO as IO
import Hasql.IO qualified as IO
import Hasql.Prelude
import qualified Hasql.Statement as Statement
import Hasql.Statement qualified as Statement
-- |
-- A batch of actions to be executed in the context of a database connection.

View File

@ -1,8 +1,8 @@
module Hasql.Settings where
import qualified Data.ByteString as B
import qualified Data.ByteString.Builder as BB
import qualified Data.ByteString.Lazy as BL
import Data.ByteString qualified as B
import Data.ByteString.Builder qualified as BB
import Data.ByteString.Lazy qualified as BL
import Hasql.Prelude
-- |

View File

@ -12,9 +12,9 @@ module Hasql.Statement
)
where
import qualified Hasql.Decoders as Decoders
import qualified Hasql.Decoders.All as Decoders
import qualified Hasql.Encoders as Encoders
import Hasql.Decoders qualified as Decoders
import Hasql.Decoders.All qualified as Decoders
import Hasql.Encoders qualified as Encoders
import Hasql.Prelude
-- |

View File

@ -1,10 +1,10 @@
module Main where
import qualified Data.Vector as F
import qualified Hasql.Connection as A
import qualified Hasql.Decoders as D
import qualified Hasql.Session as B
import qualified Hasql.Statement as C
import Data.Vector qualified as F
import Hasql.Connection qualified as A
import Hasql.Decoders qualified as D
import Hasql.Session qualified as B
import Hasql.Statement qualified as C
import Prelude
main :: IO ()

View File

@ -1,14 +1,14 @@
module Main where
import Contravariant.Extras
import qualified Hasql.Decoders as Decoders
import qualified Hasql.Encoders as Encoders
import qualified Hasql.Session as Session
import qualified Hasql.Statement as Statement
import qualified Main.Connection as Connection
import qualified Main.DSL as DSL
import Hasql.Decoders qualified as Decoders
import Hasql.Encoders qualified as Encoders
import Hasql.Session qualified as Session
import Hasql.Statement qualified as Statement
import Main.Connection qualified as Connection
import Main.DSL qualified as DSL
import Main.Prelude hiding (assert)
import qualified Main.Statements as Statements
import Main.Statements qualified as Statements
import Test.QuickCheck.Instances ()
import Test.Tasty
import Test.Tasty.HUnit

View File

@ -1,6 +1,6 @@
module Main.Connection where
import qualified Hasql.Connection as HC
import Hasql.Connection qualified as HC
import Main.Prelude
with :: (HC.Connection -> IO a) -> IO (Either HC.ConnectionError a)

View File

@ -7,8 +7,8 @@ module Main.DSL
)
where
import qualified Hasql.Connection as HC
import qualified Hasql.Session
import Hasql.Connection qualified as HC
import Hasql.Session qualified
import Main.Prelude
type Session =

View File

@ -1,7 +1,7 @@
module Main.Statements where
import qualified Hasql.Decoders as HD
import qualified Hasql.Statement as HQ
import Hasql.Decoders qualified as HD
import Hasql.Statement qualified as HQ
import Main.Prelude
plain :: ByteString -> HQ.Statement () ()

View File

@ -1,8 +1,8 @@
module Main where
import qualified Hasql.Connection
import qualified Hasql.Session
import qualified Main.Statements as Statements
import Hasql.Connection qualified
import Hasql.Session qualified
import Main.Statements qualified as Statements
import Prelude
main :: IO ()

View File

@ -1,7 +1,7 @@
module Main.Statements where
import qualified Hasql.Decoders as D
import qualified Hasql.Encoders as E
import Hasql.Decoders qualified as D
import Hasql.Encoders qualified as E
import Hasql.Statement
import Prelude