case expression inference
This commit is contained in:
@@ -103,6 +103,15 @@
|
||||
(defn LitExpr [_ l]
|
||||
[:code (str l)])
|
||||
|
||||
(defn Alter [colours a]
|
||||
(pprint a)
|
||||
[:code "<alter>"])
|
||||
|
||||
(defn CaseExpr [colours e as]
|
||||
[:<> "case " [Expr colours 0 e] " of { "
|
||||
"<alters>"
|
||||
" }"])
|
||||
|
||||
(defn Expr [[c & colours] p {e :e t :type}]
|
||||
(match e
|
||||
{:InL {:tag "LamF" :contents [bs body & _]}}
|
||||
@@ -118,6 +127,9 @@
|
||||
[Typed c t [LetExpr colours r bs body]])
|
||||
{:InL {:tag "LitF" :contents l}}
|
||||
[Typed c t [LitExpr colours l]]
|
||||
{:InR {:tag "CaseEF" :contents [scrut as]}}
|
||||
(maybe-parens (< ppr/app-prec1 p)
|
||||
[Typed c t [CaseExpr colours scrut as]])
|
||||
:else [:code "<expr>"]))
|
||||
|
||||
(def rainbow-cycle (cycle ["red"
|
||||
|
||||
Reference in New Issue
Block a user