mirror of
https://github.com/github/semantic.git
synced 2025-01-01 11:46:14 +03:00
Parametric JSON conversion for Free.
This commit is contained in:
parent
44d2804367
commit
22b77ecd76
@ -163,3 +163,12 @@ extension Free where A: Hashable, B: Hashable {
|
||||
return hash(ifPure: Hash.init, ifRoll: Hash.init)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - JSONConvertible
|
||||
|
||||
extension Free {
|
||||
public func JSON(ifPure ifPure: B -> Doubt.JSON, ifLeaf: A -> Doubt.JSON) -> Doubt.JSON {
|
||||
return analysis(ifPure: ifPure, ifRoll: { $0.JSON(ifLeaf: ifLeaf, ifRecur: { $0.JSON(ifPure: ifPure, ifLeaf: ifLeaf) }) })
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user