There is also the [Happy](https://hex.pm/packages/happy) library, which is
like `with` but can do what you want (and more, while using `=` instead of
`<-` while having the same features, and more). I use it extensively
On Wednesday, August 24, 2016 at 4:03:42 PM UTC-6, Gilbert wrote:
>
> Hi, I am in the process of learning Elixir, and let me first say I am
> astounded at how polished the language and build tools are. A grand
> applause is well deserved to everyone who has helped Elixir get this far!
>
> I have only a minor suggestion. It seems to be easy to do, so here it goes.
>
> The `with` clause is excellent. This works, for example:
>
> msg =
> with {:ok, data} <- read_line(socket),
> {:ok, command} <- KVServer.Command.parse(data)
> do
> KVServer.Command.run(command)
> end
>
> However, I'd like to write it in this style, in effort to reduce line
> width (and, IMO, increase readability):
>
> msg =
> with \
> {:ok, data} <- read_line(socket),
> {:ok, command} <- KVServer.Command.parse(data)
> do
> KVServer.Command.run(command)
> end
>
> But, as you can see, I need to add a backslash after the `with` keyword
> for it to compile.
>
> Is there a technical reason for the backslash requirement? Or could
> perhaps Elixir be updated to support this style of formatting, without the
> backslash? :)
>
> I am using Elixir 1.3.2
>
> Thanks for reading,
> Gilbert
>
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/e6089c2d-f48d-4524-865b-b463630c7038%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.