8000 Stricter types · postgres-haskell/postgres-wire@e7b1170 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7b1170

Browse files
Stricter types
1 parent 5183b92 commit e7b1170

File tree

2 files changed

+14
-14
lines changed
Collapse file tree

2 files changed

+14
-14
lines changed

src/Database/PostgreSQL/Protocol/Encoders.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ encodeClientMessage (Bind (PortalName portalName) (StatementName stmtName)
3535
putInt16BE 1 <>
3636
encodeFormat paramFormat <>
3737
putInt16BE (fromIntegral $ V.length values) <>
38-
fold (encodeValue <$> values) <>
38+
foldMap encodeValue values <>
3939
-- `1` means that the specified format code is applied to all
4040
-- result columns (if any)
4141
putInt16BE 1 <>
@@ -59,7 +59,7 @@ encodeClientMessage (Parse (StatementName stmtName) (StatementSQL stmt) oids)
5959
putPgString stmtName <>
6060
putPgString stmt <>
6161
putInt16BE (fromIntegral $ V.length oids) <>
62-
fold (putInt32BE . unOid <$> oids)
62+
foldMap (putInt32BE . unOid) oids
6363
encodeClientMessage (PasswordMessage passtext)
6464
= prependHeader 'p' $ putPgString $ getPassword passtext
6565
where

src/Database/PostgreSQL/Protocol/Types.hs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,25 @@ data AuthResponse
105105
deriving (Show)
106106

107107
data ClientMessage
108-
= Bind PortalName StatementName
109-
Format -- parameter format code, one format for all
110-
(Vector ByteString) -- the values of parameters, the empty string
108+
= Bind !PortalName !StatementName
109+
!Format -- parameter format code, one format for all
110+
!(Vector ByteString) -- the values of parameters, the empty string
111111
-- is recognized as NULL
112-
Format -- to apply code to all result columns
112+
!Format -- to apply code to all result columns
113113
-- Postgres use one command `close` for closing both statements and
114114
-- portals, but we distinguish them
115-
| CloseStatement StatementName
116-
| ClosePortal PortalName
115+
| CloseStatement !StatementName
116+
| ClosePortal !PortalName
117117
-- Postgres use one command `describe` for describing both statements
118118
-- and portals, but we distinguish them
119-
| DescribeStatement StatementName
120-
| DescribePortal PortalName
121-
| Execute PortalName RowsToReceive
119+
| DescribeStatement !StatementName
120+
| DescribePortal !PortalName
121+
| Execute !PortalName !RowsToReceive
122122
| Flush
123-
| Parse StatementName StatementSQL (Vector Oid)
124-
| PasswordMessage PasswordText
123+
| Parse !StatementName !StatementSQL !(Vector Oid)
124+
| PasswordMessage !PasswordText
125125
-- PostgreSQL names it `Query`
126-
| SimpleQuery StatementSQL
126+
| SimpleQuery !StatementSQL
127127
| Sync
128128
| Terminate
129129
deriving (Show)
35CE

0 commit comments

Comments
 (0)
0