Aetherus
Elixir 1.14.1 Protocol issue (Protocol.UndefinedError) - works in Elixir 1.14.0, but not in 1.14.1
The following code works in Elixir 1.14.0, but not in 1.14.1:
defprotocol Foo do
def foo(x)
end
###################
defmodule Bar do
defstruct []
defimpl Foo, for: __MODULE__ do
def foo(x) do
...
end
end
end
##################
Foo.foo(%Bar{})
In 1.14.1, when the last statement is called, the following error is raised (I was trying this in Livebook):
** (Protocol.UndefinedError) protocol Foo not implemented for %Bar{} of type Bar (a struct)
#cell:enx47nczjxo7awjw44j4cdlxiv536l3w:1: Foo.impl_for!/1
#cell:enx47nczjxo7awjw44j4cdlxiv536l3w:2: Foo.foo/1
#cell:2zzjhjq5howfzuc33tjy7lttvaatqq2r:1: (file)
I compared the source code in these 2 versions, and the only difference I saw is
- elixir/protocol.ex at a285e5876b6f69e7c340d04851aae63c8a32bf1d · elixir-lang/elixir · GitHub
- elixir/protocol.ex at c5151e6890b5ac8df13276459696f0f47a8e634b · elixir-lang/elixir · GitHub
I don’t know if this is relevant. Please take a look. Thanks
Marked As Solved
LostKobrakai
You can do this to define an implementation for Bar, but I’m positive your version is not supposed to break as well.
defmodule Bar do
defstruct []
defimpl Foo do
def foo(x) do
...
end
end
end
2
Also Liked
al2o3cr
FWIW, this is an issue that will be fixed in 1.14.2:
2
Aetherus
Thank you for your quick reply. Saved my day. ![]()
1
Popular in Questions
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
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
Hi,
is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
Hey guys.
I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
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
Other popular topics
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
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
by Lance Halvorsen
Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
New







