Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arianvp/hconfig
Applicative configuration DSL
https://github.com/arianvp/hconfig
applicative config dsl haskell
Last synced: 1 day 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 (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-30T13:23:51.000Z (almost 8 years ago)
- Last Synced: 2024-12-13T01:11:18.279Z (about 2 months ago)
- Topics: applicative, config, dsl, haskell
- Language: Haskell
- Size: 8.79 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- 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"
```