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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions exercises/concept/treasure-factory/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 extensible records as phantom types.
`secureChest` should take a `Chest` without specific conditions and return a `Maybe Chest`, with the extra condition `securePassword : ()` in its phantom record.
`uniqueTreasures` should take a `List Chest` without specific conditions and return a `List Chest`, with the extra condition `uniqueTreasure : ()` added to the phantom record.

~~~~exercism/note
Elm tests have access to exposed functions, but not to type signatures, it is therefore impossible for tests to verify that you are using the right signatures.
Of course, the strongest indication that you have the right signatures is to succeed in getting the module and tests to compile and run.
We hope to use the analyser to check this in the future, but for now, no check is performed.
~~~~

## 2. Select secure chests
Expand Down