on dev help sign in
doctests
e8283fdEitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/PQ.hs+9−5
@@ -117,8 +117,12 @@ backslashes within the value must be escaped with a backslash, i.e., ' and \.
117
117
118To specify the schema you wish to connect with, use type application.
118To specify the schema you wish to connect with, use type application.
119
119
120−>>> :set -XTypeApplication
120+>>> :set -XDataKinds
121+>>> :set -XTypeOperators
122+>>> type Schema = '["tab" ::: '["col" ::: 'Required ('Null 'PGint2)]]
123+>>> :set -XTypeApplications
124+>>> :set -XOverloadedStrings
121−>>> conn <- connectdb @MySchema "host=localhost port=5432 dbname=exampledb"
125+>>> conn <- connectdb @Schema "host=localhost port=5432 dbname=exampledb"
122
126
123Note that, for now, squeal doesn't offer any protection from connecting
127Note that, for now, squeal doesn't offer any protection from connecting
124with the wrong schema!
128with the wrong schema!
@@ -193,7 +197,7 @@ pqThen pq2 pq1 = pq1 & pqBind (\ _ -> pq2)
193
197
194-- | Run a `Definition` with `LibPQ.exec`, we expect that libpq obeys the law
198-- | Run a `Definition` with `LibPQ.exec`, we expect that libpq obeys the law
195--
199--
196−-- prop> pqThen (define statement2) statement1 = define (statement2 . statement1)
200+-- @pqThen (define statement2) statement1 = define (statement2 . statement1)@
197define
201define
198 :: MonadBase IO io
202 :: MonadBase IO io
199 => Definition schema0 schema1
203 => Definition schema0 schema1
@@ -462,8 +466,8 @@ newtype RowNumber = RowNumber { unRowNumber :: LibPQ.Row }
462newtype ColumnNumber (n :: Nat) (cs :: [k]) (c :: k) =
466newtype ColumnNumber (n :: Nat) (cs :: [k]) (c :: k) =
463 UnsafeColumnNumber { getColumnNumber :: LibPQ.Column }
467 UnsafeColumnNumber { getColumnNumber :: LibPQ.Column }
464
468
465−-- | >>> getColumnNumber (columnNumber @5)
469+-- | >>> getColumnNumber (columnNumber @5 @'[_,_,_,_,_,_])
466−-- 5
470+-- Col 5
467class KnownNat n => HasColumnNumber n columns column
471class KnownNat n => HasColumnNumber n columns column
468 | n columns -> column where
472 | n columns -> column where
469 columnNumber :: ColumnNumber n columns column
473 columnNumber :: ColumnNumber n columns column
squeal-postgresql/test/DocTest.hs+2
@@ -9,4 +9,6 @@ main = doctest
9 , "src/Squeal/PostgreSQL/Definition.hs"
9 , "src/Squeal/PostgreSQL/Definition.hs"
10 , "src/Squeal/PostgreSQL/Manipulation.hs"
10 , "src/Squeal/PostgreSQL/Manipulation.hs"
11 , "src/Squeal/PostgreSQL/Query.hs"
11 , "src/Squeal/PostgreSQL/Query.hs"
12+ , "src/Squeal/PostgreSQL/Expression.hs"
13+ , "src/Squeal/PostgreSQL/PQ.hs"
12 ]
14 ]