A framework of packages for building Haskell applications
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
Peter J. Jones 8260619ad7
Update the Opaleye example so it is polymorphic, demonstrating CanOpaleye
2ヶ月前
..
example Update the Opaleye example so it is polymorphic, demonstrating CanOpaleye 2ヶ月前
src/Iolaus Update the Opaleye example so it is polymorphic, demonstrating CanOpaleye 2ヶ月前
test Add the Newtype module for generating newtype instances 2ヶ月前
.envrc Fix a couple typos, improve the shell.nix file 2ヶ月前
CHANGELOG.md Add Iolaus.Opaleye.Config 3ヶ月前
LICENSE Build with nix, fix duplicate LICENSE file to make nix/cabal happy 3ヶ月前
README.md Fix a couple typos, improve the shell.nix file 2ヶ月前
Setup.hs Add Iolaus.Opaleye.Config 3ヶ月前
default.nix Add Iolaus.Opaleye.Config 3ヶ月前
iolaus-opaleye.cabal Add the Newtype module for generating newtype instances 2ヶ月前
iolaus-opaleye.nix Add the Newtype module for generating newtype instances 2ヶ月前

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.