function-builder: Create poly variadic functions for monoidal results

[ bsd3, data-structures, library ] [ Propose Tags ]

Please see README.md


[Skip to Readme]

Modules

[Last Documentation]

  • Data
    • Data.FunctionBuilder

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.1.0, 0.2.0.0, 0.2.0.1, 0.3.0.0, 0.3.0.1
Change log CHANGELOG.md
Dependencies base (<0) [details]
License BSD-3-Clause
Copyright 2019 Sven Heyll
Author Sven Heyll
Maintainer sven.heyll@gmail.com
Revised Revision 1 made by HerbertValerioRiedel at 2019-02-03T21:56:57Z
Category Data Structures
Home page https://github.com/sheyll/function-builder#readme
Source repo head: git clone https://github.com/sheyll/function-builder
Uploaded by SvenHeyll at 2019-01-22T05:41:23Z
Distributions LTSHaskell:0.3.0.1, NixOS:0.3.0.1, Stackage:0.3.0.1
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 4857 total (30 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2019-01-22 [all 3 reports]

Readme for function-builder-0.1.0.0

[back to package description]

Build Status

Hackage

A library for making Monoid writing functions with variable number of parameters

Also known as: Holey monoids.

This library is made to be useful especially for library authors, who want to provide users with building blocks to create functions that compose a monoidal structure from their parameters in a type safe way. Think of printf.

Imagine a library that lets user create nicely formatted strings, with the ability to compose strings into larger strings and to allow the rendering of all sorts of values, for example Doubles, Bool`s, or lists to strings.

This library allows the author of such a library to easily add the building blocks, allowing users to build poly variadic functions, i.e. with parameters depending on the order and composition of these building blocks.

Several FunctionBuilder values sharing a common monoidal output type can be composed to a big FunctionBuilder value, in order to build an output function that has a flexible number and types of parameters depending, on the individual FunctionBuilders used. This output function can be obtained by toFunction.

FunctionBuilders can also be composed via standard type classes.

This module gives you ready-made like Functor, Applicative, Semigroup, Monoid or Category` instances;

The basic building blocks are toFunction, immediate and addParameter.

For example, you could use this library to build a string formatting library, that allows users to compose arbitrary, printf-style render functions from reusable building blocks, such that they can be re-combined in order to make get functions, that can be applied to parameters that fill place holders, like e.g.:

 renderCpuTemp :: Int -> Float -> String
 renderCpuTemp =
   toFunction (render "CPU " . renderInt . render " Temperature: " . renderFloat)

Similar Libraries