-
Notifications
You must be signed in to change notification settings - Fork 193
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
add anchors for chapter 6 #378
add anchors for chapter 6 #378
Conversation
@@ -8,6 +8,8 @@ This motivating example for this chapter will be a library for hashing data stru | |||
|
|||
We will also see a collection of standard type classes from PureScript's Prelude and standard libraries. PureScript code leans heavily on the power of type classes to express ideas concisely, so it will be beneficial to familiarize yourself with these classes. | |||
|
|||
If you come from an Object Oriented background, please note that the word "class" means something _very_ different in this context than what you're used to. A type class serves a purpose more similar to an OO interface. |
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.
Feel free to nix my extra commentary. It seemed to me that immediately dispelling any preconceived notions about the word "class" might be helpful
text/chapter6.md
Outdated
@@ -123,16 +125,14 @@ No type class instance was found for | |||
Data.Show.Show (Int -> Int) | |||
``` | |||
|
|||
Type class instances can be defined in one of two places: in the same module that the type class is defined, or in the same module that the type "belonging to" the type class is defined. An instance defined in any other spot is called an "orphan instance" and is not allowed by the PureScript compiler. Some of the exercises in this chapter will require you to copy the definition of a type into your MySolutions module so that you can define type class instances for that type. |
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.
Again, feel free to nix my extra commentary. I thought it might confuse some readers why in every chapter up to this point, they've been given all the code they need already and can just start coding up the exercises, but in this chapter they suddenly have to copy+paste a bunch of types into their code.
Wow. That's some pretty annoying mdbook behavior. Opened rust-lang/mdBook#1626 to see if we can find a resolution. This might require making a PR to that project. |
Co-authored-by: milesfrain <milesfrain@users.noreply.github.com>
I struggled a lot with this one. Mdbook is very picky about indentation, and there seems to be some edge cases that weren't well thought out when it comes to indented code blocks with anchors. In particular, it seems Mdbook just pastes in the code directly, including whitespace, and doesn't indent further when the code block was indented. So if I had an anchor like
and I used that in a code block like
that would get translated into
which really throws off the document flow. The only three solutions I could come up with were
I opted for approach 1, but it feels really hacky, and I would welcome feedback on if any other approach should be taken.