-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Conversation
Been away, I’ll check issues and PRs tonight. Thanks. |
There was a problem hiding this 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. |
There was a problem hiding this comment.
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 : ()`. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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."
Thanks matthieu :) |
Fixes #596