cabal-version: 3.0
name: postgresql-types
version: 0.1.3.1
category: PostgreSQL, Codecs
synopsis: Precise PostgreSQL types representation and driver-agnostic codecs
description:
This package provides a Haskell representation of PostgreSQL data types, with mappings to and from both binary and textual formats of the PostgreSQL wire protocol. The types are implemented in their canonical forms, directly corresponding to their PostgreSQL counterparts. The philosophy is that nuance matters, so all special values are represented without data loss or compromise.
The types presented by this package do not necessarily have direct mappings to common Haskell types. Canonicalizing conversions and smart constructors are provided to address this.
For example, any @text@ value from PostgreSQL produces a valid 'Data.Text.Text' value in Haskell, but not every Haskell 'Data.Text.Text' value produces a valid PostgreSQL @text@, because PostgreSQL does not allow NUL bytes in text fields, whereas Haskell's 'Data.Text.Text' does. In the case of dates, the supported date ranges may differ between PostgreSQL and Haskell's "time" library. Therefore, conversions between these types and common Haskell types may be partial and may fail if the data cannot be represented in the target type.
All types supply 'Test.QuickCheck.Arbitrary' instances that cover the full range of valid PostgreSQL values. Every type is property-tested to validate round-trip conversions between binary and textual formats against PostgreSQL versions 9 to 18.
The library can be used as the basis for various PostgreSQL libraries. Ecosystem integration adapters are available for:
* hasql: <https://hackage.haskell.org/package/hasql-postgresql-types>
* postgresql-simple: <https://hackage.haskell.org/package/postgresql-simple-postgresql-types>
homepage: https://github.com/nikita-volkov/postgresql-types
bug-reports: https://github.com/nikita-volkov/postgresql-types/issues
author: Nikita Volkov <nikita.y.volkov@mail.ru>
maintainer: Nikita Volkov <nikita.y.volkov@mail.ru>
copyright: (c) 2025, Nikita Volkov
license: MIT
license-file: LICENSE
extra-doc-files:
LICENSE
README.md
source-repository head
type: git
location: https://github.com/nikita-volkov/postgresql-types
common base
default-language: Haskell2010
default-extensions:
ApplicativeDo
BangPatterns
BinaryLiterals
BlockArguments
ConstraintKinds
DataKinds
DefaultSignatures
DeriveDataTypeable
DeriveFoldable
DeriveFunctor
DeriveTraversable
DerivingStrategies
DerivingVia
DuplicateRecordFields
EmptyDataDecls
FlexibleContexts
FlexibleInstances
FunctionalDependencies
GADTs
GeneralizedNewtypeDeriving
LambdaCase
LiberalTypeSynonyms
MagicHash
MultiParamTypeClasses
MultiWayIf
NamedFieldPuns
NoImplicitPrelude
NoMonomorphismRestriction
NumericUnderscores
OverloadedStrings
ParallelListComp
PatternGuards
QuasiQuotes
RankNTypes
RecordWildCards
ScopedTypeVariables
StandaloneDeriving
StrictData
TemplateHaskell
TupleSections
TypeApplications
TypeFamilies
TypeOperators
UnboxedTuples
ViewPatterns
common executable
import: base
ghc-options:
-O2
-threaded
-with-rtsopts=-N
-rtsopts
-funbox-strict-fields
common test
import: base
ghc-options:
-threaded
-with-rtsopts=-N
library
import: base
hs-source-dirs: src/library
exposed-modules:
PostgresqlTypes
PostgresqlTypes.Bit
PostgresqlTypes.Bool
PostgresqlTypes.Box
PostgresqlTypes.Bpchar
PostgresqlTypes.Bytea
PostgresqlTypes.Char
PostgresqlTypes.Cidr
PostgresqlTypes.Circle
PostgresqlTypes.Citext
PostgresqlTypes.Date
PostgresqlTypes.Float4
PostgresqlTypes.Float8
PostgresqlTypes.Hstore
PostgresqlTypes.Inet
PostgresqlTypes.Int2
PostgresqlTypes.Int4
PostgresqlTypes.Int8
PostgresqlTypes.Interval
PostgresqlTypes.Json
PostgresqlTypes.Jsonb
PostgresqlTypes.Line
PostgresqlTypes.Lseg
PostgresqlTypes.Macaddr
PostgresqlTypes.Macaddr8
PostgresqlTypes.Money
PostgresqlTypes.Multirange
PostgresqlTypes.Numeric
PostgresqlTypes.Oid
PostgresqlTypes.Path
PostgresqlTypes.Point
PostgresqlTypes.Polygon
PostgresqlTypes.Range
PostgresqlTypes.Text
PostgresqlTypes.Time
PostgresqlTypes.Timestamp
PostgresqlTypes.Timestamptz
PostgresqlTypes.Timetz
PostgresqlTypes.Tsvector
PostgresqlTypes.Uuid
PostgresqlTypes.Varbit
PostgresqlTypes.Varchar
other-modules:
PostgresqlTypes.Multirange.List
PostgresqlTypes.Multirange.QuickCheckGen
PostgresqlTypes.Numeric.Integer
PostgresqlTypes.Numeric.Scientific
PostgresqlTypes.Prelude
PostgresqlTypes.Timetz.Offset
PostgresqlTypes.Timetz.Time
PostgresqlTypes.Via
PostgresqlTypes.Via.IsScalar
build-depends:
QuickCheck >=2.14 && <3,
aeson >=2.2 && <3,
attoparsec >=0.14 && <0.19,
base >=4.11 && <5,
bytestring >=0.10 && <0.13,
containers >=0.6 && <0.9,
hashable >=1.3 && <2,
jsonifier ^>=0.2.1.3,
mtl >=2.2 && <3,
postgresql-types:jsonifier-aeson,
postgresql-types:time-extras,
postgresql-types-algebra ^>=0.1,
ptr-peeker ^>=0.1,
ptr-poker ^>=0.1.3,
scientific >=0.3 && <1,
tagged ^>=0.8.9,
text >=1.2 && <3,
text-builder ^>=1.0.0.4,
time >=1.12 && <2,
transformers >=0.5 && <0.7,
uuid >=1.3 && <2,
vector ^>=0.13,
library jsonifier-aeson
import: base
hs-source-dirs: src/jsonifier-aeson
exposed-modules:
JsonifierAeson
other-modules:
build-depends:
aeson >=2.2 && <3,
base >=4.11 && <5,
jsonifier ^>=0.2.1.3,
library time-extras
import: base
hs-source-dirs: src/time-extras
exposed-modules:
TimeExtras.TimeOfDay
TimeExtras.TimeZone
other-modules:
build-depends:
base >=4.11 && <5,
time >=1.12 && <2,
test-suite unit-tests
import: test
type: exitcode-stdio-1.0
hs-source-dirs: src/unit-tests
main-is: Main.hs
other-modules:
PostgresqlTypes.BitSpec
PostgresqlTypes.BoolSpec
PostgresqlTypes.BoxSpec
PostgresqlTypes.BpcharSpec
PostgresqlTypes.ByteaSpec
PostgresqlTypes.CharSpec
PostgresqlTypes.CidrSpec
PostgresqlTypes.CircleSpec
PostgresqlTypes.CitextSpec
PostgresqlTypes.DateSpec
PostgresqlTypes.Float4Spec
PostgresqlTypes.Float8Spec
PostgresqlTypes.HstoreSpec
PostgresqlTypes.InetSpec
PostgresqlTypes.Int2Spec
PostgresqlTypes.Int4Spec
PostgresqlTypes.Int8Spec
PostgresqlTypes.IntervalSpec
PostgresqlTypes.JsonSpec
PostgresqlTypes.JsonbSpec
PostgresqlTypes.LineSpec
PostgresqlTypes.LsegSpec
PostgresqlTypes.Macaddr8Spec
PostgresqlTypes.MacaddrSpec
PostgresqlTypes.MoneySpec
PostgresqlTypes.MultirangeSpec
PostgresqlTypes.NumericSpec
PostgresqlTypes.OidSpec
PostgresqlTypes.PathSpec
PostgresqlTypes.PointSpec
PostgresqlTypes.PolygonSpec
PostgresqlTypes.RangeSpec
PostgresqlTypes.TextSpec
PostgresqlTypes.TimeSpec
PostgresqlTypes.TimestampSpec
PostgresqlTypes.TimestamptzSpec
PostgresqlTypes.TimetzSpec
PostgresqlTypes.TsvectorSpec
PostgresqlTypes.UuidSpec
PostgresqlTypes.VarbitSpec
PostgresqlTypes.VarcharSpec
SpecHook
UnitTests.Scripts
build-tool-depends:
hspec-discover:hspec-discover >=2 && <3
build-depends:
QuickCheck >=2.14 && <3,
aeson >=2.2 && <3,
attoparsec >=0.14 && <0.15,
base >=4.11 && <5,
bytestring >=0.10 && <0.13,
containers >=0.6 && <0.9,
hspec >=2.11 && <3,
postgresql-types,
postgresql-types-algebra ^>=0.1,
ptr-peeker >=0.1 && <0.3,
ptr-poker ^>=0.1.2.16,
quickcheck-classes ^>=0.6.5,
quickcheck-instances ^>=0.3.33,
scientific >=0.3 && <1,
tagged ^>=0.8.9,
text >=1.2 && <3,
text-builder ^>=1.0.0.4,
time >=1.12 && <2,
uuid >=1.3 && <2,
vector ^>=0.13,
test-suite integration-tests
import: test
type: exitcode-stdio-1.0
hs-source-dirs: src/integration-tests
main-is: Main.hs
other-modules:
IntegrationTests.Scopes
IntegrationTests.Scripts
PqProcedures
PqProcedures.Algebra
PqProcedures.Procedures
PqProcedures.Procedures.GetTypeInfoByName
PqProcedures.Procedures.RunRoundtripQuery
PqProcedures.Procedures.RunStatement
build-depends:
QuickCheck >=2.14 && <3,
async >=2.2.6 && <2.3,
attoparsec >=0.14 && <0.15,
base >=4.11 && <5,
bytestring >=0.10 && <0.13,
hspec >=2.11 && <3,
postgresql-libpq >=0.10 && <0.12,
postgresql-types,
postgresql-types-algebra ^>=0.1,
ptr-peeker ^>=0.1,
ptr-poker ^>=0.1.2.16,
quickcheck-instances ^>=0.3.33,
stm >=2.5 && <3,
tagged ^>=0.8.9,
testcontainers-postgresql ^>=0.2.0.1,
text >=1.2 && <3,
text-builder ^>=1.0.0.4,