joseds

joseds

Effective Haskell: B6.0, Chapter 2, p.83: Suggestion: Distinguish thunks by name

Hi, I got a bit sidetracked, but I now have time to continue with your book, which I am enjoying a lot. You explain the co-recursion in chapter 2 really well and I think that showing how the (lazy) evaluation works step-by-step is very helpful and corrected a wrong idea I had about how foldr operates, thanks!

I have just one recommendation regarding naming:

I think that all is very well explained, but some of the readers may get confused that all thunks are named <thunk> when in case of the Fibonacci numbers, in each step one is the tail of the other. So, to use different names for different things, maybe something like <thunk_n> and <thunk_n+1> could be helpful. Maybe it would even be enough to distinguish them “locally” as <thunk0> and <thunk1>.

Marked As Solved

RebeccaSkinner

RebeccaSkinner

Author of Effective Haskell

I’m glad you are enjoying the book! I see what you mean about the <thunk> references. My initial goal was to use a name that made it clear that we don’t know too much about what’s inside of the thunk, merely that it is some arbitrary thunk. I might try both your suggestion of adding clearly names, as well as an aside to explain that we don’t care too much about the details of the thunks, and see which one ends up seeming to be more clear when I try both approaches. I really appreciate the note!

Popular Prag Prog topics Top

jimmykiang
This test is broken right out of the box… — FAIL: TestAgent (7.82s) agent_test.go:77: Error Trace: agent_test.go:77 agent_test.go:...
New
jeffmcompsci
Title: Design and Build Great Web APIs - typo “https://company-atk.herokuapp.com/2258ie4t68jv” (page 19, third bullet in URL list) Typo:...
New
jamis
The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
New
Alexandr
Hi everyone! There is an error on the page 71 in the book “Programming machine learning from coding to depp learning” P. Perrotta. You c...
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
brunogirin
When running tox for the first time, I got the following error: ERROR: InterpreterNotFound: python3.10 I realised that I was running ...
New
dsmith42
Hey there, I’m enjoying this book and have learned a few things alredayd. However, in Chapter 4 I believe we are meant to see the “&gt;...
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
New
New
davetron5000
Hello faithful readers! If you have tried to follow along in the book, you are asked to start up the dev environment via dx/build and ar...
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
axelson
I’ve been really enjoying obsidian.md: It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
New
siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
New
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New

Latest in PragProg

View all threads ❯