benonymus
Hey,
I am trying to build a Plug pipeline, it’s pretty simple and works great, my function is the last in the chain and I am getting this warning when I am trying to run in an env with empty list as param.
I am getting the env
@unavailable_countries Application.get_env(:app, :unavailable_countries, [])
The warning is present if I explicitly set the env as a .
defp is_available?(%{
city: %{
country: %{iso_code: iso_code}
}
})
when iso_code in @unavailable_countries do
false
end
defp is_available?(_), do: true
There is another warning for the iso_code that it is unused.
I know I could pass the list to the function and check, but I have other clauses as well with other lists, and then I couldn’t do it in the guard.
Is there a way to go around this?
I know that it will always yield the same result, I understand the warning.
Thanks
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
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
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
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
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
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
- #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 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benonymus
Well I can put in
[""]as the default for one.fuelen
Which warning?
benonymus
Sorry I put it as the title:
This check/guard will always yield the same resultjosevalim
Yes, the compiler is warning you that the guard will always fail, because no input will ever satisfy it.
benonymus
So ideally should I write the function differently, or for dev environment passing just an empty string in as a possibility is fine?
hauleth
You can conditionally add the first head:
Or simplify it to:
benonymus
I will try the first thanks!
I think the simplified version wouldn’t work because I only want it to return if the item is in the list otherwise not, but this could return both true or false.
Edit: the check with the if around the function works, thanks!
hauleth
I have fixed the “fixed” example to match your needs.