Skip to content

Commit 125dcf1

Browse files
Răzvan C. Rădulescumilesfrain
andauthored
Ch6 - Clarify 2nd hashes exercise (#230)
* Clarify 2nd hashes exercise * More detailed instructions for arrayHasDuplicates Co-authored-by: milesfrain <[email protected]>
1 parent 1876aa6 commit 125dcf1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

text/chapter6.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ The source code for this chapter includes several other examples of `Hashable` i
770770
## Exercises
771771

772772
1. (Easy) Use PSCi to test the hash functions for each of the defined instances. _Note_: There is no provided unit test for this exercise.
773-
1. (Medium) Write a function `arrayHasDuplicates` which tests if an array has any duplicate elements. Use hash-equality from the `hashEqual` function as an approximation to value equality. Remember to check for value equality using `==` if a duplicate pair is found. _Hint_: the `nubByEq` function in `Data.Array` should make this task much simpler.
773+
1. (Medium) Write a function `arrayHasDuplicates` which tests if an array has any duplicate elements based on both hash and value equality. First check for hash equality with the `hashEqual` function, then check for value equality with `==` if a duplicate pair of hashes is found. _Hint_: the `nubByEq` function in `Data.Array` should make this task much simpler.
774774
1. (Medium) Write a `Hashable` instance for the following newtype which satisfies the type class law:
775775

776776
```haskell

0 commit comments

Comments
 (0)