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

Clarify type signature requirement in task 1 #598

Merged
merged 2 commits into from
Sep 13, 2023
Merged

Conversation

ceddlyburge
Copy link
Contributor

@ceddlyburge ceddlyburge commented Sep 9, 2023

Fixes #596

@ceddlyburge
Copy link
Contributor Author

@mpizenberg @jiegillet

@mpizenberg
Copy link
Member

Been away, I’ll check issues and PRs tonight. Thanks.

Copy link
Member

@mpizenberg mpizenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a while to grasp what was going on in this exercise as I had not seen it yet ^^. I think the changes are good. I've given some other options, I'll let you be the judge of if that's useful or not.

@@ -29,12 +29,14 @@ A `Chest` should hold the same data as a `TreasureChest` and should have two typ
Note that because `Chest` is using a phantom type, and should therefore be opaque to prevent its use anywhere outside of the `TreasureFactory` module.
In this case, it is not even exposed at all.

`secureChest` should take a `Chest` without specific conditions and return one wrapped in a `Maybe` that has the extra condition `securePassword : ()`.
`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.
Edit the type signatures of `secureChest` and `uniqueTreasures` to add the constraints using phantom types.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we be a tiny bit more specific by saying "using extensible records as phantom types"?

`secureChest` should take a `Chest` without specific conditions and return one wrapped in a `Maybe` that has the extra condition `securePassword : ()`.
`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.
Edit the type signatures of `secureChest` and `uniqueTreasures` to add the constraints using phantom types.
`secureChest` should take a `Chest` without specific conditions and return a `Maybe Chest`, with the extra condition `securePassword : ()`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here say something like "with the extra condition securePassword : () in its phantom record".

`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.
Edit the type signatures of `secureChest` and `uniqueTreasures` to add the constraints using phantom types.
`secureChest` should take a `Chest` without specific conditions and return a `Maybe Chest`, with the extra condition `securePassword : ()`.
`uniqueTreasures` should take a `List Chest` without specific conditions and return a `List Chest`, with the extra condition `uniqueTreasure : ()` added.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"with the extra condition uniqueTreasure : () added to the phantom record."

@ceddlyburge
Copy link
Contributor Author

Thanks matthieu :)

@ceddlyburge ceddlyburge merged commit 640fa3c into main Sep 13, 2023
5 checks passed
@ceddlyburge ceddlyburge deleted the ceddlyburge-596 branch September 13, 2023 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants