项目作者: xvw

项目描述 :
高级语言: Elixir
项目地址: git://github.com/xvw/deal.git
创建时间: 2017-08-11T15:08:29Z
项目社区:https://github.com/xvw/deal

开源协议:MIT License

下载


Deal

This module is not about Monad or Maybe… it is just a shortcut
over the pattern {:ok, value}.

With Deal, you can write code like that:

  1. Deal.with! do
  2. f(1)
  3. g()
  4. h()
  5. end

instead of:

  1. with
  2. {:ok, a} <- f(1),
  3. {:ok, b} <- g(a),
  4. {:ok, c} <- h(b),
  5. do: {:ok, c}

You can checkout the test file for more examples.

Installation

The package can be installed
by adding deal to your list of dependencies in mix.exs:

  1. def deps do
  2. [
  3. {:deal, "~> 1.0.0"}
  4. ]
  5. end

Documentation can be generated with ExDoc
and published on HexDocs. Once published, the docs can
be found at https://hexdocs.pm/deal.