Add Hashable typeclass
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
- 20/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
Hướng nghiên cứu
The issue proposes adding a Hashable typeclass to the prelude and deriving support to the compiler, but names no files or tests. Start by reviewing the existing Eq and Ord typeclasses and the linked purescript-unordered-collections implementation. Done means agreeing on the design and adding the prelude typeclass and compiler deriving support; the thread has had no comment for years, so check whether the proposal is still wanted.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I would like to add a Hashable typeclass to the prelude and deriving support for it to the compiler. It is intended as an approximation of equality for use in hash-based algorithms and data structures, such as hash maps, not cryptographically secure digests or password hashes.
class Eq a <= Hashable a where
hash :: a -> Int
There are two reasons for adding it to the prelude instead of having a standalone library:
- Dependencies: To be useful in general data structures, as many datatypes as possible should be hashable. Ideally, whenever a datatype is
Eq, it should also haveOrdandHashableinstances, if possible. Most packages depend on the prelude already.[citation needed] This should make it easier to convince authors to addHashableinstances, because they do not need to add another dependency, all that is required is one more deriving line below the lines forEqandOrd. - Performance: Usually, the main goal of hashing is to avoid expensive comparisons. One could write a generic hash function in terms of
purescript-generics-rep. This would be fine for many applications, but for hash-based data structures etc., the hash function should really be as fast as possible.
I am more than happy to make an initial pull request (based on https://github.com/fehrenbach/purescript-unordered-collections/blob/master/src/Data/Hashable.purs) and work on deriving support.
What do people think?
- Ngôn ngữ chính
- PureScript
- Star
- 168
- Fork
- 90
- Merge trung bình
- 3 ngày 1 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của purescript/purescript-prelude
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 57/100
purescript/purescript-prelude#317 · 1 reaction ·
-
Int bottom is not safeĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 32/100
purescript/purescript-prelude#312 · 5 bình luận ·
-
add liftCompare & friendsĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
purescript/purescript-prelude#310 · 5 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 24/100
purescript/purescript-prelude#308 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
purescript/purescript-prelude#307 · 1 bình luận · 1 reaction ·
Tất cả issue của purescript/purescript-prelude
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
ManageSieve proxy: a backend's NO/BYE greeting is skipped as a capability line and reported as EOFĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ManageIQ/manageiq-pods#1476 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
prime-radiant-inc/evener#6366 ·
Maintainer thường phản hồi trong vòng 1 ngày