Semigroup

This commit is contained in:
Nikita Volkov 2016-02-23 09:39:57 +03:00
parent 1389b08a62
commit 7954c8d734
5 changed files with 11 additions and 2 deletions

View File

@ -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.*,

View File

@ -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

View File

@ -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.

View File

@ -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" #-}

View File

@ -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(..))