MyNixOS website logo
Description

Monad for allocation and cleanup of application resources.

This library allows you to allocate resources with clean up strategies when initializing your application. It then provides a Monadic interface to compose multiple resources without having to deal with cleanup operations explicitely.

componentm

An utility library to build multiple components (config, db, cache, logging, etc.) of an application in a traceable, reliable and efficient fashion

Table Of Contents

Installation

Hackage Stackage LTS Stackage Nightly

Make sure you include the following entry on your cabal file's dependecies section.

library:
  build-depends: componentm

Or on your package.yaml

dependencies:
- componentm

Purpose

This library is intended to be a high level API for the teardown library; it provides a high level monad interface that helps composition of resource allocation/teardown in a safe and reliable way.

Differences with ResourceT

The resourcet library provides a monad transformer that keeps track of allocated resources at runtime making sure that if an exception happens or the block of execution finishes, the resources allocated are cleaned up.

The componentm library on the other hand, does not run as a Monad transformer, but rather it gets called at the very beginning of your application, it builds the environment needed by your application environment to work (e.g. Layer 1), and provides helper bracket style functions that cleanup all allocated resources in the right order when your application terminates either normally or with an error.

Development

Build Status Hackage Dependencies Github

This library is intended to be minimal, providing a few functions that work reliably among many different kind of projects. If you want to contribute, Pull Request are very welcome! Please try to follow these simple rules:

  • Please create a topic branch for every separate change you make.
  • Update the README.md file if necessary.
  • Please do not change the version number on your Pull Request.

Open Commit Bit

This project has an open commit bit policy: Anyone with an accepted pull request gets added as a repository collaborator. Please try to follow these simple rules:

  • Commit directly onto the master branch only for typos, improvements to the README and documentation.
  • Create a feature branch and open a pull-request early for any new features to get feedback.
  • Make sure you adhere to the general pull request rules above.

License

Copyright (c) 2017-2018 Roman Gonzalez

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Metadata

Version

0.0.0.2

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows