https://github.com/arianvp/hconfig
Applicative configuration DSL
https://github.com/arianvp/hconfig
applicative config dsl haskell
Last synced: 11 months ago
JSON representation
Applicative configuration DSL
- Host: GitHub
- URL: https://github.com/arianvp/hconfig
- Owner: arianvp
- License: bsd-3-clause
- Created: 2017-04-29T14:53:46.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-30T13:23:51.000Z (about 9 years ago)
- Last Synced: 2025-03-31T04:19:39.590Z (about 1 year ago)
- Topics: applicative, config, dsl, haskell
- Language: Haskell
- Size: 8.79 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hconfig
Applicative configuration inspired by the talk
[Move Over Free Monads: Make Way for Free Applicatives!][talk]
[talk]: https://www.youtube.com/watch?v=H28QqxO7Ihc
## 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:
```haskell
{-# 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"
```