Resource
public class Resource<F, A> : ResourceOf<F, A> where F : Bracket
Resource models resource allocation and releasing. It is specially useful when multiple resources that depend on each other need to be acquired and later released in reverse order. Whn a resource is created, one can make use of the use
method to run a computation with the resource. The finalizers are guaranteed to run afterwards in reverse order of acquisition.
-
Safe downcast.
Declaration
Swift
public static func fix(_ value: ResourceOf<F, A>) -> Resource<F, A>
Parameters
value
Value in higher kinded form.
Return Value
Value casted to Resource.
-
Initializes a resource.
Declaration
Parameters
acquire
Function to acquire the resource.
release
Function to release the resource.
Return Value
A Resource that will run the provided functions to acquire and release it.
-
Undocumented
Declaration
Swift
public func combine(_ other: Resource<F, A>) -> Resource<F, A>
-
Undocumented
Declaration
Swift
public static func empty() -> Resource<F, A>