Questions tagged [elixir-iex]

Elixir’s interactive shell.

iex is Elixir’s interactive shell, which can be used to interactively run Elixir code from the command line.

150 questions
100
votes
4 answers

Is there a Phoenix equivalent to Rails Console

I'm just learning Phoenix and Elixir and I'm coming from Ruby/Rails where I work in the REPL using pry to inspect my database and application state. I'm trying to figure out how to interact with my database and models in a Phoenix app. I'm aware of…
Chase
  • 2,748
  • 2
  • 23
  • 32
84
votes
2 answers

Elixir Sleep / Wait for 1 Second

How to sleep / wait for one second? Best I could find was something like this (in iex): IO.puts "foo" ; :timer.sleep(1); IO.puts "bar" But both of my puts happen with no delay.
newUserNameHere
  • 17,348
  • 18
  • 49
  • 79
58
votes
2 answers

Pry while testing

I'm pretty new in Elixir, but have a lot fun with it! I came from Ruby world, so start looking analogy. And there is exist debugging tool pry. Using binding.pry I can interrupt any session. I found something similar in Elixir – IEx.pry. But it…
Dmitriy
  • 1,422
  • 15
  • 27
46
votes
4 answers

How do I save IEx history?

With IEx (Elixir's REPL), I'd like to be able to save my command history. For example: I can open up a new IEx session and execute a command. After executing the command I can press the up arrow and have my last-command pre-populated. After closing…
loeschg
  • 29,961
  • 26
  • 97
  • 150
37
votes
5 answers

Another way to exiting IEX other than ctrl-C

I know we can exit the IEX console with control-C. I'm curious if there's a command to type into the console that would also do the same thing.
User314159
  • 7,733
  • 9
  • 39
  • 63
29
votes
5 answers

Make elixir app recompile and reload on source code change

How to automatically recompile and reload my iex + mix application every time I modify the source code? If there's no way for iex + mix combination to do that, what's the easiest alternative? I've checked phoenix's way to do reload, and it doesn't…
ardhitama
  • 1,949
  • 2
  • 18
  • 29
19
votes
1 answer

Disable jumping cursor in Erlang shell

When typing () in IEx 1.2.4, the cursor would "jumping" to the matching parenthesis for 1s and move back. Even though it's not really jumping but it's kinda annoying to the eye. Is there a way to disable this feature in IEx? EDIT: While the…
sbs
  • 4,102
  • 5
  • 40
  • 54
18
votes
4 answers

Iex pry going step by step?

I want to use IEx.pry to go step by step in my elixir code, like byebug in ruby or debug point in Java. I tried looking into the documentation here :…
VoodooChild
  • 400
  • 1
  • 6
  • 18
15
votes
2 answers

What is the best way to round a float in elixir

I am trying to round a Float in elixir to 2 decimal places. If I have the number 12.555, I would like my rounding function to return 12.56 I originally thought that the Float.round was what I wanted but this function does not always return the…
RobStallion
  • 1,624
  • 1
  • 15
  • 28
14
votes
1 answer

Elixir - call a module function from the shell

In Elixir, is there a way to call a module function directly from the shell, without necessarily needing to start an iex -S mix session? Let me illustrate with a scenario: As part of my Phoenix app, I've written a helper module that is to be run…
skwidbreth
  • 7,888
  • 11
  • 58
  • 105
14
votes
3 answers

How to call an Erlang function in Elixir

What is the format to call an Erlang function in Elixir? Specifically, how can I call the function in iex and where can I find a list of modules and functions available from Erlang.
Gerry Shaw
  • 9,178
  • 5
  • 41
  • 45
12
votes
2 answers

Elixir -- Module was not compiled with docs

I just started learning elixir yesterday. I have a file User.exs. It looks like this: defmodule User do @moduledoc """ Defines the user struct and functions to handle users. """ # functions and stuff go here... end When I run…
Mark Karavan
  • 2,654
  • 1
  • 18
  • 38
12
votes
1 answer

How to colorize Elixir iex prompt?

Is it possible to add color and other effects to the iex prompt? Does iex have a resource file (like .irbrc for Ruby's irb)? Is there a customization API that allows prompt customization (like Ruby's IRB.conf)?
jwfearn
  • 28,781
  • 28
  • 95
  • 122
11
votes
1 answer

IEx Pry: Always allow / take over without prompt

When I run Elixir code with my debugger, Pry, then it always confronts me with Allow? [Yn] Can I pass a configuration option to always allow this? Thus, by default? Why is this question asked? What could be harmful?
Stobbej
  • 1,080
  • 9
  • 17
11
votes
1 answer

Attach an iex session to running elixir/OTP process

I have an elixir/OTP application running in production, that was started with mix phoenix.server. It has several processes that hold state. One of these is a stash, implemented as Agent, that currently have a state that I would like to manually…
Nagasaki45
  • 2,634
  • 1
  • 22
  • 27
1
2 3
9 10