mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Convenience helper for keyed locations.
This commit is contained in:
parent
ccbb3f1bb4
commit
e6429cee40
@ -79,6 +79,10 @@ public struct Location<A>: SequenceType {
|
||||
return Location(flip(weave), reconstruct >>> up, ts)
|
||||
}
|
||||
|
||||
public static func variadic<Key>(ts: [Key:A], _ weave: Weave, _ reconstruct: [Key:A] -> A)(_ up: A -> Location?) -> Location? {
|
||||
return Location(flip(weave), Dictionary.init >>> reconstruct >>> up, Array(ts))
|
||||
}
|
||||
|
||||
public static func explore(weave: Weave)(_ a : A) -> Location {
|
||||
return Location(it: a, down: flip(weave)(explore(weave) >>> Optional.Some), up: const(nil), left: const(nil), right: const(nil))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user