Skip to content

Conversation

@MatthijsBlom
Copy link
Contributor

No description provided.

- The compiler is able to check that you handle all possible cases.
If you overlook some cases and use guards, the compiler will not help you.
But if you are pattern matching it will!
- When you use pattern matching, the compiler can use its understanding of your code to apply code transformations that improve performance.
Copy link
Member

Choose a reason for hiding this comment

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

When you use pattern matching, the compiler can use its understanding of your code to apply code transformations that improve performance.

I suggest linking to another resource that explains the code transformation that it applies. As someone starting to learn Haskell, I curious to what and how Haskell do the code transformations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this would be nice. However, I know of no (good) such resources off the top of my head. I'll look for a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't been able to find any and do not wish to delay merging for this, but would definitely welcome a PR in the future.

@MatthijsBlom
Copy link
Contributor Author

@ErikSchierboom Do you have comments?

@petertseng As far as I'm concerned this is ready to be merged.

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

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

I love the contents! I just have one comment on which file should contain the contents.



[learning-resources]:
https://exercism.org/docs/tracks/haskell/learning
Copy link
Member

Choose a reason for hiding this comment

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

trailing space to be removed

Suggested change
https://exercism.org/docs/tracks/haskell/learning
https://exercism.org/docs/tracks/haskell/learning

Please consult your other learning resources.
The track docs include an article on [Haskell learning resources][learning-resources].

Pattern matching with `case` has benefits over using guards:
Copy link
Member

@petertseng petertseng Feb 28, 2023

Choose a reason for hiding this comment

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

Will it be readily apparent to a learner that "using guards" refers to the above solution that includes | planet == "Mercury"? If it is already apparent, that was my only question about this pull request, so I think it is ready.

If it would not be apparent and needs to be made that way, mentioning guards somewhere around the sentence that reads "this is an anti-pattern" would make it clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I have changed

- This is an [anti-pattern][wikipedia-anti-pattern].
+ Using guards like this is an [anti-pattern][wikipedia-anti-pattern].

Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

well, in that case, let's go then. Thank you for your work and perseverance.

@petertseng petertseng merged commit 211c86b into exercism:main Feb 28, 2023
@MatthijsBlom MatthijsBlom deleted the approach-space-age branch February 28, 2023 13:38
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 this pull request may close these issues.

4 participants