Apemb

Apemb

Chain - An easy way to chain functions that return ok/error tuples

Hello all,

I have been using Elixir for a bit of time, and each time I wrote code like this I wondered if there were not a better way than chain with functions.

So I created Chain https://github.com/Apemb/chain

What do you think ?
Do you see it as useful ?

Most Liked

NobbZ

NobbZ

Additionally to @kokolegorille s list:

  • ok_jose
  • auto_pipe
  • and there was at least another one which name I can’t remember…
kokolegorille

kokolegorille

With witchcraft, it would look like this…

data
>>> load_shift_aggregate/1
>>> verify_shift_can_be_edited/1
>>> create_update_command/1
>>> update_shift_aggregate/1
>>> save_updated_shift_aggregate/1
>>> load_updated_shift_entity/1
>>> return_shift_entity/1

But there are more operators… https://github.com/witchcrafters/witchcraft#operators

kokolegorille

kokolegorille

Hello and bienvenue…

You don’t like to use with?

There is also witchcraft, which might have a similar purpose.

kokolegorille

kokolegorille

There is also ok library, by @Crowdhailer

ondrej-tucek

ondrej-tucek

Maybe I’m wrong, but isn’t the catching thrown error anti-pattern?:

  • Avoid using exceptions for control-flow
  • Avoid working with invalid data

Also you can use the result library, for example this a way.

Where Next?

Popular in Libraries Top

josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
RobertDober
Earmark is a pure-Elixir Markdown converter. It is intended to be used as a library (just call Earmark.as_html), but can also be used as...
239 11851 134
New
hpopp
After just over two years in development, this latest version of Pigeon is what I finally consider done in regards to my original vision ...
New
kevinlang
Hey all, We have made an Ecto3 Adapter for SQLite3, ecto_sqlite3! We have successfully on-boarded the full suite of integration tests (...
New
cjen07
parameterized pipe in elixir: |n> edit: negative index in |n> and mixed usage with |> are supported example: use ParamP...
New
benlime
I created a new library GitHub - benvp/ex_cva: Class Variance Authority for Elixir which aims to make it very easy to define different va...
New
alisinabh
Hey everyone i’ve developed a library for Jalaali calendar for elixir which supports converting Gregorian dates to Jalaali and vice vers...
New
josevalim
Yes, yet another parser combinator library! Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
159 18262 141
New
tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: https://github.com/tmbb/phoenix_ws Phoenix channels are a great...
New
Hal9000
Here is my first stab at this. README pasted below. https://github.com/Hal9000/elixir_random Comments and critiques are welcome. Th...
New

Other popular topics Top

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Sub Categories:

We're in Beta

About us Mission Statement