# Understanding improper lists usage in elixir-plug

**URL:** <https://forum.elixirforum.com/t/understanding-improper-lists-usage-in-elixir-plug/47607>\
**Category:** Questions\
**Tags:** plug, dialyzer, learning-elixir, improper-list, elixir-plug\
**Created:** [May 6, 2022, 11:23am UTC](https://forum.elixirforum.com/t/understanding-improper-lists-usage-in-elixir-plug/47607 "2022-05-06T11:23:36Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![benwilson512](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/benwilson512/32/1457_2.png) [@benwilson512](https://forum.elixirforum.com/u/benwilson512)\
**Post date:** [May 6, 2022, 11:43am UTC](https://forum.elixirforum.com/t/understanding-improper-lists-usage-in-elixir-plug/47607/4 "2022-05-06T11:43:02Z")

</div>

> [@iamacube](#):
>
> Oh! i guess i was wrong about this!

You might not be wrong about this function, it just isn’t super obvious to me that Dialyzer is right either. Either way, check out this line: [plug/lib/plug/conn/query.ex at 274e44f9a149b922099bf60029d8267afe494968 · elixir-plug/plug · GitHub](https://github.com/elixir-plug/plug/blob/274e44f9a149b922099bf60029d8267afe494968/lib/plug/conn/query.ex#L214)

The `encode_pair` function is a `defp` and the output of that function is passed immediately to `IO.iodata_to_binary`. `iodata` is one of the real world uses for improper lists, because it reduces the overhead of building out a list front to back. The `iodata_to_binary` is able to handle improper lists and turn them into a single binary.

Dialyzer warns about improper lists because most of the time you do indeed want to warn for them. If the Plug core team used dialyzer they would probably put a `no-warn` invocation in there to tell dialyzer that this is intentional.

---

_[View the full topic](https://forum.elixirforum.com/t/understanding-improper-lists-usage-in-elixir-plug/47607)._
