1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

CofreeTypes have a static curried Wrap constructor function.

This commit is contained in:
Rob Rix 2015-10-22 18:04:19 -04:00
parent c6962c798d
commit 9ff1840e4a

View File

@ -121,6 +121,12 @@ public protocol CofreeType: TermType {
var extract: Annotation { get }
}
extension CofreeType {
public static func Wrap(annotation: Annotation)(syntax: Syntax<Self, Leaf>) -> Self {
return Self(annotation, syntax)
}
}
extension Cofree: CofreeType {}
extension CofreeType where Self.Annotation == Range<String.Index> {