Using IEx and helpers to understand types

Going back to our integer example, we saw that there were a few different protocols that integers implement that we can take advantage of, but they may not make immediate sense to us. Let's use String.Chars as an example, where we'll call the h helper on String.Chars to learn more about the module from its documentation:

iex(7)> h String.CharsString.CharsThe String.Chars protocol is responsible for converting a structure to a binary(only if applicable).The only function required to be implemented is to_string/1, which does theconversion.The to_string/1 function automatically imported by Kernel invokes thisprotocol. String interpolation also invokes to_string/1 in its arguments. Forexample, "foo#{bar}" ...

Get Phoenix Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.