https://github.com/zweifisch/maybe
Utils to deal with errors
https://github.com/zweifisch/maybe
Last synced: 2 months ago
JSON representation
Utils to deal with errors
- Host: GitHub
- URL: https://github.com/zweifisch/maybe
- Owner: zweifisch
- License: mit
- Created: 2015-12-16T12:24:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-17T23:26:41.000Z (over 10 years ago)
- Last Synced: 2025-03-22T18:45:13.397Z (over 1 year ago)
- Language: Elixir
- Size: 3.91 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Maybe
[![Build Status][travis-image]][travis-url]
Utils to deal with errors
## Installation
First, add maybe to your dependencies in `mix.exs`:
def deps do
[{:maybe, "~> 0.0.1"}]
end
Then, update your dependencies:
$ mix deps.get
## Usage
import Maybe
Poison.encode(payload)
|> ok(fn(encoded)-> HTTPoison.request(:post, url, encoded) end)
|> ok(fn(%{body: body})-> Poison.decode(body) end)
|> ok(fn(decoded)-> process(decoded) end)
|> error(&IO.inspect/1)
[travis-image]: https://img.shields.io/travis/zweifisch/maybe.svg?style=flat
[travis-url]: https://travis-ci.org/zweifisch/maybe