A framework of packages for building Haskell applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Peter J. Jones 8260619ad7
Update the Opaleye example so it is polymorphic, demonstrating CanOpaleye
1 month ago
..
example Update the Opaleye example so it is polymorphic, demonstrating CanOpaleye 1 month ago
src/Iolaus Update the Opaleye example so it is polymorphic, demonstrating CanOpaleye 1 month ago
test Add the Newtype module for generating newtype instances 1 month ago
.envrc Fix a couple typos, improve the shell.nix file 1 month ago
CHANGELOG.md Add Iolaus.Opaleye.Config 2 months ago
LICENSE Build with nix, fix duplicate LICENSE file to make nix/cabal happy 1 month ago
README.md Fix a couple typos, improve the shell.nix file 1 month ago
Setup.hs Add Iolaus.Opaleye.Config 2 months ago
default.nix Add Iolaus.Opaleye.Config 2 months ago
iolaus-opaleye.cabal Add the Newtype module for generating newtype instances 1 month ago
iolaus-opaleye.nix Add the Newtype module for generating newtype instances 1 month ago

README.md

Iolaus.Opaleye

The goal of this library is to provide a simple wrapper around the opaleye and postgresql-simple packages without leaking a MonadIO interface into your application’s monad, all while exposing an mtl + lens style of composing the major components of an application.

Using this library is fairly straight forward:

  1. Create your monad transformer stack and then make it an instance of AsOpaleyeError and HasOpaleye.

  2. Parse a Config value from a configuration file.

  3. Call initOpaleye to create the MonadReader value you`ll need.

  4. Use the query functions inside your transformer stack!

For more details, including a tutorial, please see the example.hs file that is part of this distribution.

Running the Example

To run the example application you first need to set two environment variables:

  • DB_CONN: The PostgreSQL database connection string. Create a database with any name you like, then set this variable.

  • iolaus_opaleye_datadir: The path to the directory containing this README.md file. This is so the example application can find the schema migration files.

Examples of these environment variables can be found in the top-level .envrc file.