Generic mapN and zipN

Đang mở
#173 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Read the issue’s proposed map2–map10 and zip2–zip10 signatures, then inspect the existing zip implementation and the project’s typeclass conventions. Decide which abstraction can support the proposed generic operations and how Tuple and Tuple2 should differ; done means the API design and its supported types are agreed before implementation.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

status: blocked

Proposing we add these mapN functions, and make them available to more than just List.

map2 :: forall a b c f. Functor f => (a -> b -> c) -> f a -> f b -> f c
map3 :: forall a b c d f. Functor f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
...
map10 ...

We can then use the mapN functions to create zipN functions:

-- This already exists, but it would be nice to offer a more generic version:
zip :: forall a b f. Functor f => f a -> f b -> Tuple a b
zip = map2 Tuple

-- Likely needed to fill the gap between the seemingly-identical
-- (but actually different) `Tuple` and nested `Tuple2`.
zip2 :: forall a b f. Functor f => f a -> f b -> f (Tuple2 a b)
zip2 = map2 Tuple2

zip3 :: forall a b c f. Functor f => f a -> f b -> f c -> f (Tuple3 a b c)
zip3 = map3 Tuple3
...
zip10 :: ...
zip10 = map10 Tuple10

We probably need a different typeclass than Functor though. What about Zippable?

A motivation for adding these functions is to get closer to Elm's usability in this area:
https://package.elm-lang.org/packages/elm/core/latest/List#map2

Ngôn ngữ chính
PureScript
Star
61
Fork
50
Merge trung bình
2 ngày 6 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của purescript/purescript-lists

Tất cả issue của purescript/purescript-lists

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.