如何在 PureScript 中发表评论?

Nic*_*ady 4 purescript

我想知道如何在 PureScript 代码中进行注释。

在 Python 中,等价的是:

# Here is a comment
Run Code Online (Sandbox Code Playgroud)

或者 JavaScript

// Another comment
Run Code Online (Sandbox Code Playgroud)

PureScript 中的等效项是什么?

sth*_*lzm 7

根据PureScript Language Reference,有单行注释

-- comment
Run Code Online (Sandbox Code Playgroud)

和多行注释

{- comment
   comment line 2
-}
Run Code Online (Sandbox Code Playgroud)

像这样的特殊评论-- |会被文档工具拾取。

  • 注意,`--` 编译为 js 中的 `//` 注释和 `{- ??? -}` 编译为 `/* ??? 尝试这些后在 js 中使用 */` (2认同)