Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong instruction about makeTreasureChest in part 1 of the description in the learning exercise Treasure factory #596

Closed
rjpgt opened this issue Sep 7, 2023 · 5 comments · Fixed by #598

Comments

@rjpgt
Copy link

rjpgt commented Sep 7, 2023

In Part 1 of the instructions( just above the Note) this is stated:
"makeTreasureChest should take a List of Chest without specific conditions and return a List of Chest, with the duplicates removed, and the extra condition uniqueTreasure : () added."

But the type signature of makeTreasureChest is already given as part of the requirements later and does not have a List as either input or output.

@ceddlyburge
Copy link
Contributor

I think it should read as follows (makeTreasureChest is replaced with uniqueTreasures):

"uniqueTreasures should take a List of Chest without specific conditions and return a List of Chest, with the duplicates removed, and the extra condition uniqueTreasure : () added."

Does this wording make sense to you?

@rjpgt
Copy link
Author

rjpgt commented Sep 7, 2023

Yes, but this would be a repetition of the instruction in part 3. I think that the offending statement can be simply removed.

@ceddlyburge
Copy link
Contributor

Part 1 of the instructions is just to edit the type signatures, not to implement the function. I agree its confusing though, especially as the function already has a type signature. The idea is to edit the type signature to add the phantom type conditions.

How about something like this:

Edit the signatures of secureChest and unique treasures to the constraints using phanton types.
secureChest should take a Chest without specific conditions and return one wrapped in a Maybe that has the extra condition securePassword : ().
uniqueTreasures should take a List of Chest without specific conditions and return a List of Chest, with the extra condition uniqueTreasure : () added.

@rjpgt
Copy link
Author

rjpgt commented Sep 8, 2023

Looks fine.

@ceddlyburge
Copy link
Contributor

Awesome, thanks for the feedback. The PR is here if you want to review it
#598

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants