mirror of
https://github.com/github/semantic.git
synced 2024-11-29 02:44:36 +03:00
Diff catamorphisms.
This commit is contained in:
parent
e152b0084c
commit
95cc7e7768
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user