In Elchemy there is several types of comments.
-- My comment
Which are always ignored by the compiler and won't be included in the compiled output file
Second type of a comment is a block comment
{- block comment -}
Which are included in the output file, but can only be used as a top level construct
Another one and probably most important is a doc-comment.
{-| Doc comment -}
Doc-comments follow these rules:
- First doc comment in a file always compiles to a
@moduledoc
- Doc comments before types compile to
@typedoc
- Doc comments before functions compile to
@doc
- A doc comment with 4 space indentation and containing a
==
comparison in it will be compiled to a one line doctest
Doctest example:
{-| My function adds two values
myFunction 1 2 == 3
-}
Would end up being
@doc """
My function adds two values
iex> my_function().(1).(2)
3
"""