Skip to content

arianvp/hconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hconfig

Applicative configuration inspired by the talk Move Over Free Monads: Make Way for Free Applicatives!

Example

You can use the applicative DSL in Data.Config to build a description of your configuration. This description contains the keys and types of your configuration, for consumption by various interpreters. Here is an example of such a description, for PostgreSQL connections:

{-# LANGUAGE OverloadedStrings #-}

import Data.Text (Text)
import Database.PostgreSQL (PoolConfiguration)

postgreSQLPool :: Config Text PoolConfiguration
postgreSQLPool =
  PoolConfiguration
  <$> string "user"
  <*> string "password"
  <*> string "host"
  <*> int    "port"
  <*> string "database"

Releases

No releases published

Packages

No packages published