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

Add a constructor for Free over arbitrary TermType.

This commit is contained in:
Rob Rix 2015-10-14 13:52:43 -04:00
parent 6f886356aa
commit 4fb38d612e

View File

@ -18,6 +18,10 @@ public enum Free<A, B>: CustomDebugStringConvertible, CustomDocConvertible, Synt
self = .Roll(fix.out.map(Free.init))
}
public init<Term: TermType where Term.LeafType == A>(_ term: Term) {
self = .Roll(term.out.map(Free.init))
}
public func analysis<C>(@noescape ifPure ifPure: B -> C, @noescape ifRoll: Syntax<Free, A> -> C) -> C {
switch self {