Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xvw/deal
elixir macro nil null useless
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/xvw/deal
- Owner: xvw
- License: mit
- Created: 2017-08-11T15:08:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-14T07:41:52.000Z (over 7 years ago)
- Last Synced: 2024-09-28T17:20:53.213Z (3 months ago)
- Topics: elixir, macro, nil, null, useless
- Language: Elixir
- Size: 11.7 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```elixir
Deal.with! do
f(1)
g()
h()
end
```instead of:
```elixir
with
{:ok, a} <- f(1),
{:ok, b} <- g(a),
{:ok, c} <- h(b),
do: {:ok, c}
```You can checkout the [test file](test/deal_test.exs) for more examples.
## Installation
The package can be installed
by adding `deal` to your list of dependencies in `mix.exs`:```elixir
def deps do
[
{:deal, "~> 1.0.0"}
]
end
```Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/deal](https://hexdocs.pm/deal).