hauleth
Simple and clean library that is inspired by discussion in Elixir’s issue tracker and uses operator suggested by @josevalim (however it may change, other operator that I was considering was &_)
Short example of how this works:
# Old pipes work as it have been before
iex> 5 |> Integer.to_string()
"5"
iex> 5 |> Integer.to_string(2)
"101"
# You can use `...` to mark the point where the expression should be inserted
iex> 5 |> Integer.to_string(10, ...)
"20"
For now it works only with function calls, so unfortunately no support for stuff like {:ok, ...}, [..., 2], or %{a: ...}. It also do not work with things like 1 |> struct(URI, port: ...) as the ... operator must be top level.
I wanted to create another one (the other one is @Qqwy’s CapturePipe) to test out using another operator, that would be IMHO less confusing than &1 in CapturePipe.
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
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
Hello
Published a new library - ProcessHub!
ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
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
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
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
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #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
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #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)
bluejay
Nice work. It might be obvious to others, but you may wish to add in the docs that you need to
use Magrittenotimport Magritte.hauleth
Yes, I am still writing the docs to be clearer on the usage.
Qqwy
I’m very eager to see how this will develop. CapturePipe has two disadvantages, both related to the fact that
&is already used in a somewhat different way in existing code:&will be shuffled around, so it will very much clobber the pipelines that contain it.Magritte has neither of these disadvantages. I personally do not like using
...as chosen ‘fill in’ argument that much because it is used in many other programming languages to stand for multiple (e.g. variadic) arguments. I’d definitely be a proponent of using&_. This still does need some thought (unless a new dedicated token is added to Elixir for it) because whilefoo(1, &_, 3)works fine,&_ + 2will be parsed as if it was the (nonsensical) capture&(_ + 2). Maybe there is a way to deal with this gracefully, I don’t know at this time.hauleth
I was also thinking about
^_which would bind stronger than&_, but would be surprising behaviour once again, as it is “non standard” usage of^operator.hauleth
For anyone interested, I have created small GitHub Poll about which is the preferred operator for such “here be dragons” behaviour in
|>:https://github.com/hauleth/magritte/pull/1
I would
to hear your opinions.
shd42
Since it’s directly related to the capture operator, i’d argue that anything who doesn’t contain
&would cause more confusion, after all, it’s an “extension” of the current behavior, so it should stay on track with what it uses now. I’m not sure that i’d like&_, but at least, it keeps consistency with the overall use of this operator.Note: I’ve clicked on
, but my vote goes for
...in your poll, because i didn’t realise it would not open a page for me to select an option&_.josevalim
I like
...honestly.&is already overloaded, so sometimes I worry about adding new meanings....is relatively safe, doesn’t cause precedence issues, and is unlikely to be used as a variable.hauleth
Thanks for pointing this out, I have added the info in top post.
That was my reasoning for this choice as well. I just wanted to know what others think about it.
shd42
To me, this is simply a consistency point of view, it really looks like using a completely different operator, with “only” the objective of extending the capabilities of what’s already there. It’s like having two different syntax to, in the end, do something quite similar to what the capture operator already does, hence why i though that using something like
&_was a better idea.The
&issues means that it’s better to just put it out of the options ?lud
...could be a variable !?