DictionaryK
public final class DictionaryK<K, A> : DictionaryKOf<K, A> where K : Hashable
DictionaryK is a Higher Kinded Type wrapper over Swift dictionaries.
-
Safe downcast.
Declaration
Swift
public static func fix(_ fa: DictionaryKOf<K, A>) -> DictionaryK<K, A>
Parameters
fa
Value in the higher-kind form.
Return Value
Value cast to DictionaryK.
-
Initializes a
DictionaryK
.Declaration
Swift
public init(_ dictionary: [K : A])
Parameters
dictionary
A Swift dictionary.
-
Obtains the wrapped dictionary.
Declaration
Swift
public func asDictionary() -> [K : A]
Return Value
A Swift dictionary wrapped in this value.
-
Zips this dictionary with another one and combines their values with the provided function.
Declaration
Swift
public func map2<B, Z>(_ fb: DictionaryK<K, B>, _ f: (A, B) -> Z) -> DictionaryK<K, Z>
Parameters
fb
A dictionary.
f
Combining function.
Return Value
Result of zipping the values of both dictionaries and combining their values.
-
Zips this dictionary with a potentially lazy one and combines their values with the provided function.
Declaration
Parameters
fb
A potentially lazy dictionary.
f
Combining function.
Return Value
Result of zipping the values of both dictionaries and combining their values.
-
Sequential application.
Declaration
Swift
public func ap<AA, B>(_ fa: DictionaryK<K, AA>) -> DictionaryK<K, B> where A == (AA) -> B
Parameters
fa
A dictionary.
Return Value
A dictionary with the result of applying the functions in this dictionary to the values in the argument.
-
Applies the provided function to all values in this dictionary, flattening the final result.
Declaration
Swift
public func flatMap<B>(_ f: (A) -> DictionaryK<K, B>) -> DictionaryK<K, B>
Parameters
f
Transforming function.
Return Value
A dictionary with the outputs of applying the function to all values in this dictionary.
-
Declaration
Swift
public func combine(_ other: DictionaryK<K, A>) -> DictionaryK<K, A>
-
Declaration
Swift
public static func empty() -> DictionaryK<K, A>