// ///|
// pub(all) struct Functor_1[T, T2, A, B] {
// map : (T, (A) -> B) -> T2
// }
// ///|
// // pub(all) type Kind_1[A] (Id, A)
// ///|
// // type Id String
// ///|
// trait HKT {
// id(Self) -> String
// }
// ///|
// impl[T] HKT for Kind_1[Array[T]] with id(arr) { arr._.0._ }
// let array: Functor_1[Array[Unit], Int, String] = {
// map: fn(array, f) {
// array._.
// }
// }
///|
// fn get_functor_1[A, B]() -> Functor_Array[A, B] {
// { map: Array::map }
// }
///|
// pub(all) struct Functor_Array[A, B] {
// map : (Array[A], (A) -> B) -> Array[B]
// }
///|
#external
priv type MapFunctor
///|
fn[K : Hash + Eq, A, B] MapFunctor::map(
map : Map[K, A],
f : (A) -> B
) -> Map[K, B] {
map
.iter()
.map(a => match a {
(k, v) => (k, v |> f)
})
|> Map::from_iter
}