Coder Social home page Coder Social logo

scalaz-config's Introduction

scalaz-config

Build Status Gitter

A scalaz-zio based configuration parsing library

Configuration parsing should be easy as it sounds - Hence;

  • It has no other dependencies.
  • No macros / no reflection
  • Can accumulate maximum errors.
  • Insanely simple to use
  • Based on the principle of effect rotation(scalaz-zio), that will seamlessly integrate with the rest of your application!

Goal

The goal is to implement a principled type-safe FP library that enables reading and composing application configuration parameters, while returning maximum errors along with details on stale and extraneous parameters. The project will also aim at re-generating configuration files back from the ADTs

Introduction & Highlights

There are three main components to the configuration library: User API, reporting, and backend API.

The User API provides a functional, simple interface to the configuration. The intention is to make the API typesafe, simple, and expressive.

The Backend functionality implements the logic to read the configuration from its serialized form. This should ultimately utilize functional abstractions like the Reader Monad or ZIO to provide a consistent method for reading in configured values.

The Reporting functionality provides reporting on how configuration values are actually used, and what is unused. This also implies returning errors if user accidentally input any extraneous parameters compared to the target ADTs.

  • Fast reading of configured values from a variety of formats into user defined types in a composable manner.
  • Maximum error accumulation.
  • Stands against throwing errors in any way.
  • Reports on stale configurations, error on extraneous configuration parameters.
  • Support configuration existing as HOCON and in sys environment.
  • Library aims at not having proliferated usage of compile time/run-time reflection.
  • Emit configuration properties from the user defined types.
  • Above all, absolutely simple to use and seamless interoperability with existing functional libraries in scala world.

Competitions

Typesafe Config

  • Type safe, pure FP? ✘ (Exceptions are thrown, and not with nice error messages)
  • Scalaz compatible ? ✘
  • No macros/reflection? ✔
  • Property file parsing ? ✔
  • Find the extraneous parameters in a config file ✘
  • Better error Reporting ✘
  • Reverse direction inspection.✔
  • Hocon support? ✔
  • No Inheritance complexity in hocon ? ✘

Clear Config

  • Type safe, pure FP? ✔
  • Throws no error? ✘
  • Depends on Typesafe config? ✘ (flattened configuration parameters)
  • No macros/reflection ? ✔
  • Scalaz Compatible ? ✔
  • Property file parsing ? ✔
  • Better error Reporting ? ✔
  • Reverse direction inspection ? ✘
  • Find the extraneous parametres in a config file ✘/✔

Pure Config

  • Type safe, pure FP? ✘/✔
  • Throws no error? ✘
  • Depends on Typesafe config? ✔
  • No macros/reflection ? ✘
  • Scalaz Compatible ? ✘ (Integration with cats, http4s, fs2 etc available)
  • Property file parsing/HOCON ? ✔
  • Better error Reporting ? ✘
  • Reverse direction inspection ? ✘
  • Find the extraneous parametres in a config file ✘

Note: Experienced compile time stack error using the library.

Cedi Config

  • Type safe, pure FP? ✘/✔ (Exposes type safe library operations that can be unsafe)
  • Throws no error? ✘
  • Depends on Typesafe config? ✔
  • No macros/reflection ? ✘
  • Scalaz Compatible ? ✘/✔
  • No macros/reflection ? ✘
  • Property file parsing/HOCON ? ✔
  • Reverse direction inspection ? ✘
  • Find the extraneous parametres in a config file ✘

Background

It is important to learn Reader Monad, Applicatives as we have seen quite a lot of talks in FP world on config parsing using these concepts. I’d like to explore if it makes sense to use ZIO as well.

ZIO:

Reader Monad:

Applicatives:

Projects that we can get inspired:

A few gists that may be useful.

Design sketch on having an applicative way of composing config parameters

Finding the tree structure of config parameters from case class (shapeless)

scalaz-config's People

Contributors

afsalthaj avatar danielyli avatar apeshimam avatar gitter-badger avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.