Elchemy

Language with Elm's syntax and Erlang's platform

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:

  1. First doc comment in a file always compiles to a @moduledoc
  2. Doc comments before types compile to @typedoc
  3. Doc comments before functions compile to @doc
  4. Doc comments before type aliases don't compile to anything and for now should be avoided
  5. 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
 """