Flow.from_enumerable/1 is undefined

I have recently started with Elixir. I am trying to implement a module to read data from stdio using Flow and I get the error below. I assume I need a require or some kind of dependency, but I cannot find anything to require. Has anyone an insight into this?

I have ubuntu 16.04 and whereis is as follows -

trevor@trevor-Lenovo-YOGA-510-14AST:~/elixir$ whereis elixir
elixir: /usr/bin/elixir /usr/lib/elixir /usr/share/man/man1/elixir.1.gz

Error -

** (UndefinedFunctionError) function Flow.from_enumerable/1 is undefined (module Flow is not available)
Flow.from_enumerable(%IO.Stream{device: :standard_io, line_or_bytes: :line, raw: true})
mmaze.ex:31: Solution.read_bin/0
(elixir 1.10.3) lib/code.ex:926: Code.require_file/2

Module -

defmodule Solution do

def read_bin() do
IO.binstream(:stdio, :line)
|> Flow.from_enumerable()
|> IO.puts
end

end

Solution.read_bin()

You need to add the :flow package to your :deps in mix.exs.

2 Likes

I did use mix for testing, but I thought mix was only used for limited testing. I am now using VS and using in CLI mode -

elixir [module_name]

to run the module. I have to deploy the module as source code later to an outside environment. I am unsure how mix could be deployed just with source code. Should I use a require or use statement?

Not sure what you mean by that.

mix is the tool to build and package elixir software.

It is quite uncommon to distribute elixir as bare exs files, but if you do, you basically have only the stdlib available.

What you probably actually want is to distribute as an escript.

3 Likes