Comments
In Elchemy there is a couple types of comments.
First one are regular elm comments:
-- My comments
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 be only used as a top level construct
Another one and probably most important is a doc-comment.
{-| Doc coment -}
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
- Doc comments before type aliases don't compile to anything and for now should be avoided
-
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 add two values myFunction 1 2 == 3 -}
Would end up being
@doc """ My function and two values iex> my_function().(1).(2) 3 """