项目作者: arianvp

项目描述 :
Applicative configuration DSL
高级语言: Haskell
项目地址: git://github.com/arianvp/hconfig.git
创建时间: 2017-04-29T14:53:46Z
项目社区:https://github.com/arianvp/hconfig

开源协议:BSD 3-Clause "New" or "Revised" License

下载


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:

  1. {-# LANGUAGE OverloadedStrings #-}
  2. import Data.Text (Text)
  3. import Database.PostgreSQL (PoolConfiguration)
  4. postgreSQLPool :: Config Text PoolConfiguration
  5. postgreSQLPool =
  6. PoolConfiguration
  7. <$> string "user"
  8. <*> string "password"
  9. <*> string "host"
  10. <*> int "port"
  11. <*> string "database"