postgresql-types: Precise PostgreSQL types representation and driver-agnostic codecs
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
[Skip to Readme]
Modules
[Index] [Quick Jump]
- PostgresqlTypes
- PostgresqlTypes.Bit
- PostgresqlTypes.Bool
- PostgresqlTypes.Box
- PostgresqlTypes.Bpchar
- PostgresqlTypes.Bytea
- PostgresqlTypes.Char
- PostgresqlTypes.Cidr
- PostgresqlTypes.Circle
- 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.Uuid
- PostgresqlTypes.Varbit
- PostgresqlTypes.Varchar
Downloads
- postgresql-types-0.1.1.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1, 0.1.1, 0.1.1.1 |
|---|---|
| Dependencies | 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 && <0.3), mtl (>=2.2 && <3), postgresql-types, postgresql-types-algebra (>=0.1 && <0.2), ptr-peeker (>=0.1 && <0.2), ptr-poker (>=0.1.3 && <0.2), QuickCheck (>=2.14 && <3), scientific (>=0.3 && <1), tagged (>=0.8.9 && <0.9), text (>=1.2 && <3), text-builder (>=1.0.0.4 && <1.1), time (>=1.12 && <2), transformers (>=0.5 && <0.7), uuid (>=1.3 && <2), vector (>=0.13 && <0.14) [details] |
| License | MIT |
| Copyright | (c) 2025, Nikita Volkov |
| Author | Nikita Volkov <nikita.y.volkov@mail.ru> |
| Maintainer | Nikita Volkov <nikita.y.volkov@mail.ru> |
| Uploaded | by NikitaVolkov at 2026-01-23T12:20:31Z |
| Category | PostgreSQL, Codecs |
| Home page | https://github.com/nikita-volkov/postgresql-types |
| Bug tracker | https://github.com/nikita-volkov/postgresql-types/issues |
| Source repo | head: git clone https://github.com/nikita-volkov/postgresql-types |
| Distributions | |
| Reverse Dependencies | 1 direct, 0 indirect [details] |
| Downloads | 4 total (4 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs available [build log] Last success reported on 2026-01-23 [all 1 reports] |