Reputation: 19128
Sorry if this is a simple question but I am very new to elixir, and I don't have a erlang background.
I am trying to run the following code, but It gives a error.
~ cat foo.ex
defmodule Math do
def add(a, b) do
a + b
IEx.pry
end
end
IO.puts(Math.add(1, 2))
~ elixir foo.ex
** (CompileError) foo.ex:5: tried to invoke macro IEx.pry/0 but module was not required. Required: Integer, Kernel, Kernel.Typespec, Record
src/elixir_dispatch.erl:209: :elixir_dispatch.expand_macro_fun/7
src/elixir_dispatch.erl:197: :elixir_dispatch.expand_require/6
src/elixir_dispatch.erl:116: :elixir_dispatch.dispatch_require/6
lists.erl:1329: :lists.mapfoldl/3
lists.erl:1330: :lists.mapfoldl/3
src/elixir_translator.erl:59: :elixir_translator.translate_each/2
lists.erl:1329: :lists.mapfoldl/3
I don't see any reference for that modules: Integer, Kernel, Kernel.Typespec, Record in the docs. So I don't know how to proceed.
I am using the Elixir 0.11.1-dev
version.
Thanks in advance
Upvotes: 3
Views: 645
Reputation: 51349
You need to explicitly require the IEx module before using it:
require IEx
IEx.pry
And you should be good to go.
Upvotes: 5