You can define implementations for one or more of the following types:
The type BitString is used in place of Binary.
The type Any is a catchall, allowing you to match an implementation with any type. Just as with function definitions, you’ll want to put the implementations for specific types before an implementation for Any.
You can list multiple types on a single defimpl. For example, the following protocol can be called to determine if a type is a collection:
defprotocol Collection do
defimpl Collection, for: [List, Tuple, BitString] do
def is_collection?(_), ...