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:
parent
6f886356aa
commit
4fb38d612e
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user