Slight refactoring of `KVServer.Command` from Getting Started guide

So I’m doing the Getting Started guide.

I’ve applied with as suggested in the next part, but I didn’t want to get rid of streaming, so this is what I ended up with:

While it works, I’d love to get some feedback if this style has got any issues or is against some Elixir conventions.

Thanks!

Putting the with in a function is quite nice imo; it increases readability of the pipeline (“Oh, I see: this ‘with’ handles the command …”) … nicely done :slight_smile:

I guess the only thing to be aware of is that if any part of the with fails, write_line will try to write out the error-causing value! … which probably won’t work out well as gen_tcp.send/2 expects iodata.