tssm / up-to-date-real-world-haskell Goto Github PK
View Code? Open in Web Editor NEWI'm trying to update the Real World Haskell book
License: Other
I'm trying to update the Real World Haskell book
License: Other
On the readme, it sounds like several chapters are in the todo / started status. But I'm not sure if the readme is still current.
Sorry, I didn't know how else to contact you. It would be great if there was a way to contribute. I for one, am interested. :-)
Perhaps the chapter on exceptions can talk about async exceptions? cf. https://tech.fpcomplete.com/haskell/tutorial/exceptions
I follow the codes in chapter 14 and find some little problems.
charClass_wordy
defined but not used, I think maybe the charClass
function should be modified as following:charClass (']':cs) = (']':) <$> globToRegex' cs
charClass (c:cs) = (c:) <$> charClass_wordy cs
According to monad fail, from GHC 8.8+, the fail
function will not be supported. I suggest change the fail
function to error
or other implementation.
charClass_wordy also lacks a matching form, which should be added as follows:
charClassWordy "" =
error "No more input"
This is from Chapter 1, "Getting Started":
ghci> 7 ^ 80
40536215597144386832065866109016673800875222251012083746192454448001
it :: Integer
But with latest ghc
, we get:
ghci> 7 ^ 80
40536215597144386832065866109016673800875222251012083746192454448001
it :: Num a => a
I couldn't figure out how to rewrite that section and also preserve the lesson about Integer
.
Lets track it here for now.
Here is how. This means I should add the source files somewhere.
DerivingVia
instead of GeneralizedNewtypeDeriving
Functor
and Applicative
instances boilerplateIn "Chapter 6: Using Type Classes" at "The dreaded monomorphism restriction" it states that the following code results in an error.
myShow = show
But in ghci I get no error
GHCi, version 8.10.2: https://www.haskell.org/ghc/ :? for help
Prelude> myShow = show
Prelude>
I think this is a great effort / project.
I am sure I'm not the only one who would be willing to sponsor the project monetarily. And I'm sure some folks would even be willing to play a more active role in the development of the updated book.
That is all ❤️
Hi,
I was reading Chapter 6: Using Type Classes. I found several lines missing (for the declaration of UniqueId
was unclear):
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.