unisonweb/unison

Add a Lisp-like syntax for Unison

Open

#1,842 创建于 2021年3月17日

在 GitHub 查看
 (1 评论) (12 反应) (0 负责人)Haskell (304 fork)batch import
help wantedparser

仓库指标

Star
 (6,624 star)
PR 合并指标
 (平均合并 12天 19小时) (30 天内合并 6 个 PR)

描述

We eventually want to make the syntax for Unison pluggable. At the moment there's only one parser and pretty-printer, but in principle we can have as many syntaxes as we want. A good second syntax would be a Lisp-like one, since it should be particularly easy to implement.

The syntax of Clojure is particularly thoughtful and would be good to emulate since it's not just straight S-expressions.

E.g.

(ann mapReduce (Fn [loc -> (Fn [a -> b]) -> (Fn [b -> b -> b]) -> (List a) -> b]))
(defn mapReduce [loc fun ifEmpty reduce data]
  (match [(split data)]
    [Empty] ifEmpty
    [(One a)] (fun a)
    [(Two left right)]
      (let
        [fl (at loc '(mapReduce loc fun ifEmpty reduce !left))]
        [fr (at loc '(mapReduce loc fun ifEmpty reduce !right))]
        (reduce !fl !fr))

贡献者指南