Hi folks!
We’re happy to announce the release of Rel8 1.7 ! Rel8 is a Haskell library for interacting with PostgreSQL databases, built on top of the fantastic Opaleye library.
The main objectives of Rel8 are:
- Conciseness: Users using Rel8 should not need to write boiler-plate code. By using expressive types, we can provide sufficient information for the compiler to infer code whenever possible.
- Inferrable: Despite using a lot of type level magic, Rel8 aims to have excellent and predictable type inference.
- Familiar: writing Rel8 queries should feel like normal Haskell programming.
If you encounter any issues please let us know.
Here’s the full changelog for this release:
Removed
- Removed support for
network-ip
. We still supportiproute
.
Added
- Add support for prepared statements. To use prepared statements, simply use
prepare run
instead ofrun
with a function that passes the parameters to your statement. - Added new
Encoder
type with three members:binary
, which is the Hasql binary encoder,text
which encodes a type in PostgreSQL’s text format (needed for nested arrays) andquote
, which is the does the thing that the function we previously calledencode
does (i.e.,a -> Opaleye.PrimExpr
). - Support hasql-1.9
- Add
elem
andelem1
toRel8.Array
for testing if an element is contained in[]
andNonEmpty
Expr
s.
Changed
- Several changes to
TypeInformation
:- Changed the
encode
field ofTypeInformation
to beEncoder a
instead ofa -> Opaleye.PrimExpr
. - Moved the
delimiter
field ofDecoder
into the top level ofTypeInformation
, as it’s not “decoding” specific, it’s also used when “encoding”. - Renamed the
parser
field ofDecoder
totext
, to mirror thetext
field of the newEncoder
type.All of this will break any downstream code that uses a completely customDBType
implementation, but anything that usesReadShow
,Enum
,Composite
,JSONBEncoded
orparseTypeInformation
will continue working as before (which should cover all common cases).
- Changed the
- Stop exporting
Decoder
andEncoder
from theRel8
module. These can now be found inRel8.Decoder
andRel8.Encoder
. - Some changes were made to the
DBEnum
type class:Enumable
was removed as a superclass constraint. It is still used to provide the default implementation of theDBEnum
class.- A new method,
enumerate
, was added to theDBEnum
class (with the default implementation provided byEnumable
).This is unlikely to break any existingDBEnum
instances, it just allows some instances that weren’t possible before (e.g., for types that are notGeneric
).