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
Razor54672
The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
New
jeremyhuiskamp
Title: Web Development with Clojure, Third Edition, vB17.0 (p9) The create table guestbook syntax suggested doesn’t seem to be accepted ...
New
digitalbias
Title: Build a Weather Station with Elixir and Nerves: Problem connecting to Postgres with Grafana on (page 64) If you follow the defau...
New
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
New
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New
kolossal
Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
New
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
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
Exadra37
I am thinking in building or buy a desktop computer for programing, both professionally and on my free time, and my choice of OS is Linux...
New
AstonJ
We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
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
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
PragmaticBookshelf
Author Spotlight Erin Dees @undees Welcome to our new author spotlight! We had the pleasure of chatting with Erin Dees, co-author of ...
New
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New

Latest in PragProg

View all threads ❯