Add Hashable typeclass
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Ambito
- backend
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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?
- Lingua principale
- PureScript
- Stelle
- 168
- Fork
- 90
- Merge medio
- 3g 1h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di purescript/purescript-prelude
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 57/100
purescript/purescript-prelude#317 · 1 reazione ·
-
Int bottom is not safeAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 32/100
purescript/purescript-prelude#312 · 5 commenti ·
-
add liftCompare & friendsAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
purescript/purescript-prelude#310 · 5 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 24/100
purescript/purescript-prelude#308 · 2 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
purescript/purescript-prelude#307 · 1 commento · 1 reazione ·
Tutte le issue di purescript/purescript-prelude
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
ManageSieve proxy: a backend's NO/BYE greeting is skipped as a capability line and reported as EOFApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Mend: dependency security vulnerability
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Mend: dependency security vulnerability
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
ManageIQ/manageiq-pods#1476 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
prime-radiant-inc/evener#6366 ·
I maintainer di solito rispondono entro 1 giorno