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 fail-fast: false
matrix: matrix:
include: include:
- ghc: 8.8.1 - ghc: 8.10.1
ghc-options: "" ghc-options: ""
ignore-haddock: "true" ignore-haddock: "true"
- ghc: latest - ghc: latest

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,8 +34,8 @@ import Data.Bifunctor as Exports
import Data.Bits as Exports import Data.Bits as Exports
import Data.Bool as Exports import Data.Bool as Exports
import Data.ByteString as Exports (ByteString) import Data.ByteString as Exports (ByteString)
import qualified Data.ByteString.Builder import Data.ByteString.Builder qualified
import qualified Data.ByteString.Lazy import Data.ByteString.Lazy qualified
import Data.Char as Exports import Data.Char as Exports
import Data.Coerce as Exports import Data.Coerce as Exports
import Data.Complex 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.Semigroup as Exports hiding (First (..), Last (..))
import Data.String as Exports import Data.String as Exports
import Data.Text as Exports (Text) import Data.Text as Exports (Text)
import qualified Data.Text.Lazy import Data.Text.Lazy qualified
import qualified Data.Text.Lazy.Builder import Data.Text.Lazy.Builder qualified
import Data.Time as Exports import Data.Time as Exports
import Data.Traversable as Exports import Data.Traversable as Exports
import Data.Tuple as Exports import Data.Tuple as Exports

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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