travisf
I picked this pattern up from another dev and have made fairly extensive use of it with Multis:
@multi Multi.new()
...
@multi
|> Multi.put(:params, params)
|> Multi.run(:somefunc, &some_func/2
This ensures that pipechains start with a raw value and, I think, it looks a little cleaner. Does anybdy else do this? Are there any articles on this pattern? It’s fairly simple but there is some nuance due to the constraints of module attributes (I’ve only done it with Ecto.Multi.new/2 and raw values), I wonder if you would run into problems during compile time if you tried it with modules in your project. Of course you couldn’t do it with a function in the same module.
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Quite interesting article Google brought me. Didn’t find any mentions about it here.
What do you think in general? Would you use togethe...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Since we have deprecated our Erlang sections (as we have dedicated Erlang Forums now) let’s add this thread for those who’d like to post ...
New
What IDE or editor are you using for Elixir development?
Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
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
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
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
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 16 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
lud
I believe there is an option to allow arity-0 functions with this rule!
dimitarvp
I should have probably said this because this is what I ended up doing in my last 3 projects.
sodapopcan
I like the suggestions for when I accidentally do stuff like:
And credo is like, “You dummy, just use
flat_map!” It’s especially nice when you upgrade Elixir and it shows you all the places you can improve with stuff in the new version.…though I suppose this “artificial intelligence” everyone keeps talking about can also do that.
I do like the linting a lot, I just disable a bunch of checks.
dimitarvp
Yeah same, I use Credo as an advisor a few times and then just drop it. It’s been helpful but not by a lot.
andyleclair
We don’t use that rule at work (we
cp from project to projectmaintain a custom set of credo rules), it’s one of the most annoying rules. For my personal projects, I don’t use Credo at all!dimitarvp
It has been a while since I religiously used Credo but I have to say that if I understand that rule correctly then I disagree with it. If for no other reason than this thread exactly: it’s completely valid to start a pipe with a value that’s generated by a function i.e.
Ecto.Multi.new().andyleclair
Sorry, what I meant was “use a credo rule to enforce this”
sodapopcan
I was confused by “make sure it starts with a raw value” and how this pattern would solve it. I probably should have just asked but instead I ass-u-me’d you meant to ensure you use
Ecto.Multi.new()over%Ecto.Multi{}. Credo in this case could just make sure that the latter isn’t used anywhere other than on the left hand side of a pattern match (or guard, I suppose).dimitarvp
As a guy working with Elixir for 8 years now, I am confused as well.
al2o3cr
I’d be surprised if starting a chain with
Multi.new()triggers that Credo check - there is specific code to allow that shape when there are no args:https://github.com/rrrene/credo/blob/v1.7.5/lib/credo/check/refactor/pipe_chain_start.ex#L205-L211