mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-12-26 03:56:50 +03:00
Semigroup
This commit is contained in:
parent
1389b08a62
commit
7954c8d734
@ -88,6 +88,7 @@ library
|
||||
bytestring >= 0.10 && < 0.11,
|
||||
hashable >= 1.2 && < 1.3,
|
||||
-- control:
|
||||
semigroups >= 0.18 && < 0.20,
|
||||
data-default-class >= 0.0.1 && < 0.1,
|
||||
profunctors >= 5.1 && < 6,
|
||||
contravariant-extras == 0.3.*,
|
||||
|
@ -18,6 +18,8 @@ newtype Commands =
|
||||
Commands (DList BB.Builder)
|
||||
deriving (Monoid)
|
||||
|
||||
instance Semigroup Commands
|
||||
|
||||
asBytes :: Commands -> ByteString
|
||||
asBytes (Commands list) =
|
||||
BL.toStrict $ BB.toLazyByteString $ foldMap (<> BB.char7 ';') $ list
|
||||
|
@ -106,7 +106,7 @@ import qualified Hasql.Prelude as Prelude
|
||||
--
|
||||
newtype Params a =
|
||||
Params (Params.Params a)
|
||||
deriving (Contravariant, Divisible, Monoid)
|
||||
deriving (Contravariant, Divisible, Monoid, Semigroup)
|
||||
|
||||
-- |
|
||||
-- Encode no parameters.
|
||||
|
@ -13,6 +13,8 @@ newtype Params a =
|
||||
Params (Op (DList (LibPQ.Oid, Bool -> Maybe ByteString)) a)
|
||||
deriving (Contravariant, Divisible, Monoid)
|
||||
|
||||
instance Semigroup (Params a)
|
||||
|
||||
run :: Params a -> a -> DList (LibPQ.Oid, Bool -> Maybe ByteString)
|
||||
run (Params (Op op)) params =
|
||||
{-# SCC "run" #-}
|
||||
|
@ -16,7 +16,7 @@ where
|
||||
|
||||
-- base-prelude
|
||||
-------------------------
|
||||
import BasePrelude as Exports hiding (assert, left, right, isLeft, isRight, error)
|
||||
import BasePrelude as Exports hiding (assert, left, right, isLeft, isRight, error, (<>), First(..), Last(..))
|
||||
|
||||
-- transformers
|
||||
-------------------------
|
||||
@ -53,6 +53,10 @@ import Contravariant.Extras as Exports
|
||||
import Control.Monad.Trans.Either as Exports
|
||||
import Data.Either.Combinators as Exports
|
||||
|
||||
-- semigroups
|
||||
-------------------------
|
||||
import Data.Semigroup as Exports
|
||||
|
||||
-- hashable
|
||||
-------------------------
|
||||
import Data.Hashable as Exports (Hashable(..))
|
||||
|
Loading…
Reference in New Issue
Block a user