Skip to content

Commit b4c90bd

Browse files
authored
Unzurry (#15)
* Unzurry And some general cleanup * fix
1 parent 1230006 commit b4c90bd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Sources/Overture/Zurry.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,19 @@
66
public func zurry<A>(_ function: @escaping () throws -> A) rethrows -> A {
77
return try function()
88
}
9+
10+
/// Wraps a value in a function.
11+
///
12+
/// - Parameter value: A value.
13+
/// - Returns: A wrapper function.
14+
public func unzurry<A>(_ value: @autoclosure @escaping () -> A) -> () -> A {
15+
return value
16+
}
17+
18+
/// A throwing variant of `unzurry`.
19+
///
20+
/// - Parameter value: A value.
21+
/// - Returns: A wrapper function.
22+
public func unzurry<A>(_ value: @autoclosure @escaping () throws -> A) -> () throws -> A {
23+
return value
24+
}

0 commit comments

Comments
 (0)