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

Content missing in webpage preview #35

Open
ftxi opened this issue Sep 5, 2020 · 0 comments
Open

Content missing in webpage preview #35

ftxi opened this issue Sep 5, 2020 · 0 comments

Comments

@ftxi
Copy link

ftxi commented Sep 5, 2020

Hi,
I was reading Chapter 6: Using Type Classes. I found several lines missing (for the declaration of UniqueId was unclear):

screenshot

However, as I looked into the source, these lines are still there:


#+BEGIN_NOTE
The type and newtype keywords

Although their names are similar, the ~type~ and ~newtype~
keywords have different purposes. The ~type~ keyword gives us
another way of referring to a type, like a nickname for a friend.
Both we and the compiler know that ~[Char]~ and ~String~ names
refer to the same type.

In contrast, the ~newtype~ keyword exists to /hide/ the nature of
a type. Consider a ~UniqueID~ type.

#+CAPTION: Newtype.hs
#+BEGIN_SRC haskell
newtype UniqueID = UniqueID Int
    deriving (Eq)
#+END_SRC

The compiler treats ~UniqueID~ as a different type from ~Int~. As
a user of a ~UniqueID~, we know only that we have a unique
identifier; we cannot see that it is implemented as an ~Int~.
#+END_NOTE

Perhaps this is a problem, but I am not sure at which level it arises.

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

No branches or pull requests

1 participant