confide: derive typeclass instances for decoding types from HOCON conf

[ bsd3, data, library ] [ Propose Tags ]

[Skip to Readme]
Versions [RSS] [faq],,,
Dependencies base (>=4.7 && <5), deiko-config (>=, exceptions (==0.8.3), text (== [details]
License BSD-3-Clause
Copyright 2018 Alex Milkov
Author Alex Milkov
Category Data
Home page
Bug tracker
Source repo head: git clone
Uploaded by amilkov at 2018-03-08T19:18:27Z
Distributions NixOS:
Downloads 1987 total (15 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2018-03-08 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees


Readme for confide-

[back to package description]


Build status

Confide port to Haskell (using GHC.Generics as opposed to Shapeless to generate FromConf typeclass instances). Uses deiko-config to parse HOCON .conf file and read in types


HOCON .conf file


b {
  z {

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

module Test where

import Data.Confide
import Data.Confide.Generic
import qualified Data.Text as T

data Foo = Foo {x :: Integer} deriving (Generic, Show)
data Bar = Bar {y :: Bool, z :: Foo} deriving (Generic, Show)
data Baz = Baz {a :: T.Text, b :: Bar} deriving (Generic, Show)

instance FromConf Foo
instance FromConf Bar
instance FromConf Baz

main :: IO ()
main = do
  c <- loadConfig "project/path/to/confFile.conf"
  baz <- get @Baz "" c
  print baz


$ main 
Baz {a = "hello", b = Bar {y = True, z = Foo {x = 5}}}