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 Pragmatic Bookshelf topics Top

johnp
Hi Brian, Looks like the api for tinydb has changed a little. Noticed while working on chapter 7 that the .purge() call to the db throws...
New
ianwillie
Hello Brian, I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
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
edruder
I thought that there might be interest in using the book with Rails 6.1 and Ruby 2.7.2. I’ll note what I needed to do differently here. ...
New
leba0495
Hello! Thanks for the great book. I was attempting the Trie (chap 17) exercises and for number 4 the solution provided for the autocorre...
New
brunogirin
When I run the coverage example to report on missing lines, I get: pytest --cov=cards --report=term-missing ch7 ERROR: usage: pytest [op...
New
New
dtonhofer
@parrt In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
New
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
AstonJ
A thread that every forum needs! Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
New
dasdom
No chair. I have a standing desk. This post was split into a dedicated thread from our thread about chairs :slight_smile:
New
PragmaticBookshelf
Design and develop sophisticated 2D games that are as much fun to make as they are to play. From particle effects and pathfinding to soci...
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
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
New
PragmaticBookshelf
A Hero’s Journey with Chris Pine @chrispine Chris Pine, author of Learn to Program, Third Edition, discusses his journey to beco...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New

Latest in Effective Haskell

Effective Haskell Portal