Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 356 Bytes

protocols.livemd

File metadata and controls

28 lines (21 loc) · 356 Bytes

Untitled notebook

Section

defprotocol Utility do
  @spec type(t) :: String.t()
  def type(value)
end
defimpl Utility, for: BitString do
  def type(_value), do: "string"
end

defimpl Utility, for: Integer do
  def type(_value), do: "integer"
end
Utility.type("string")

Utility.type(123)

Utility.type([])