From aef4e185182ed5addd9e3fc147bcd16cfb1f477f Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 23 Oct 2015 17:19:07 -0400 Subject: [PATCH] Map over Syntax. --- prototype/UI/index.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 21d8c1065..dbcb9d77a 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -239,6 +239,13 @@ return this; } + // forall a b. Syntax a -> (a -> b) -> Syntax b + Syntax.prototype.map = function(transform) { + if (this.indexed != null) { return new Syntax(this.indexed, transform); } + if (this.keyed != null) { return new Syntax(this.keyed, transform); } + if (this.leaf != null) { return new Syntax(this.leaf, transform); } + } + function Diff(json) { if (json.pure != null) { this.pure = new Patch(json.pure);