Crowdhailer
Creator of Raxx
I have been updating a library that allows you to pipe between functions that use the erlang result tuple convention.
Assuming you have a double function with the spec double(int()) :: {:ok, int()} and safe dividing function. safe_div(int(), int()) :: {:ok, int()} | {:error, term()}.
Ok now can be used to create a pipeline that looks very much like the native pipe operator.
iex> {:ok, 6} ~>> safe_div(3) ~>> double
{:ok, 4.0}
iex> {:ok, 6} ~>> safe_div(0) ~>> double
{:error, :zero_division}
I have opened a pull request for this new version and pushed a release candidate. Hopefully it’s now interesting to people.
Trending in Announcing
Hey everyone!
Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application.
This library uses Erlang esaml to provide
plug enabl...
New
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi all!
I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas.
You...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
New
It’s not that it’s vocabulary is too advanced. It’s something worse.
I get lost trying to follow even a paragraph written by Claude. It’...
New
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New
Introductory paragraph
I’ll be looking for a keen junior or someone that has a couple of years experience in the real world (so you’ve be...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ibgib
Very concise syntax for tagged fluent builder statements!
And I’m planning on more, slightly longer factory methods just like these and this helps clean things up very nicely. Thanks!
Crowdhailer
Thanks for the feedback. I haven’t really thought about the builder pattern in elixir, I normally have a great map I pass to a single function if need be but it’s certainly a nice usecase and one where you get to ensure that functions behave the way you want.
Crowdhailer
Version 0.2.0 released.
I will make a 1.0 release soon as there is almost no API to decide on. The one change that I think perhaps should be made is renaming the
OKmodule toOkso is follows mix patterns for capitalization?OvermindDL1
I’d recommend
Okas well as it is common vernacular now. However,OKis correct as it is short for (what is considered by etymologists(sp?)) Oll Korrekt, a vernacular of “All Correct” popularized in 1840’s New York (told to me by google ^.^).So, although I tend to use
Okmyself, technicallyOKis correct.Crowdhailer
Awesome tangential knowledge. I may well have to add some documentation to the effect of recording that.
brainbag
Someone wrote a great article about railway programming in Elixir. They used the
>>>operator but it’s quite similar!Here’s the link: Railway Oriented Programming in Elixir
mkunikow
Nice finding.

I assume this is based on article Railway oriented programming from great F# blog http://fsharpforfunandprofit.com/
Crowdhailer
Would you describe railway programming as a pattern or a technique.
I see that that article gives a bunch of examples on implementing the macros. My life would have been much easier if i had found that first.
Crowdhailer
Would you have a use for any of the other concepts, such as the tee. I haven’t noticed them missing from my code. I think it might be an 80/20 rule.
~>>gives the vast majority of the benefits and the rest are just minor improvementsbrainbag
Although I love the concept, I found some issues with the implementation in practice for user errors, which is where this pattern is intended to be used. In particular:
{:ok, :name, %metadata{}}which wouldn’t fit.Map.fetch/2for example just returns:error.:errorin context, I was doing it somewhere down the line. Often this meant I had to reconstruct context in order to provide a meaningful message to the UI.To resolve #1, I decided to change how it measured the results and tested either the
result == :error || elem(result, 0) == :error, and any other result was just passed through. This worked better for me and allowed for the shapes to be different. It could be expanded to capture more errors, but it still assumes that it would know all error conditions.Overall, after using it for a while, it felt more like I was using
try/catchor GOTO for flow control, which I am not fond of. I found it to basically be just a prettier but less comprehensible/usable version ofwith.I still love the idea of a flow chart for flow control, though!