1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

Diff catamorphisms.

This commit is contained in:
Rob Rix 2015-10-23 20:27:12 -04:00
parent e152b0084c
commit 95cc7e7768

View File

@ -211,6 +211,14 @@
});
}
}
// forall a. Diff a -> (Syntax a -> a) -> a
Diff.prototype.cata = function(transform) {
if (this.pure != null) { return this.pure; }
if (this.roll != null) {
return transform(this.roll.unwrap.map(function(diff) { return diff.cata(transform); }))
}
}
</script>
</head>
<body>