pennychase

pennychase

Effective Haskell Chapter 11

@RebeccaSkinner
In Effective Haskell Chapter 11 (~ p 410 in ePub), when creating the Encode and Decode instances for String, pack and unpack are used, but given all the imports, ghci couldn’t resolve them so I needed to use the qualified names, BC.pack and BC.unpack.

Serializing FileMode (approx p. 413 in ePub) doesn’t work on Macs since CMode wraps a Word16, not Word32. I was baffled because the documentation on Hackage said CMode wraps a Word32, not realizing that the Hackage docs were probably generated on a Linux box. I ended up writing the encoding/decoding for Word16 so GHC could pick the right one.

When defining Encode to have encode and encodeWithSize (approx p 415 in ePub), the MINIMAL pragma is missing the # at the opening ( {- instead of {-# )

I assume there was some refactoring going on because the FileData type was defined with record fields: fileName, fileSize, filePermissions, and fileData, but the Encode instance uses packedFileName, packedFileSize, packedFilePermissions, and packedFileData.

The file pack example is a fun one for getting at these different data encodings.

Most Liked

RebeccaSkinner

RebeccaSkinner

Author of Effective Haskell

Thanks for the comment and the PR. As I mentioned on the PR, I want to make some space to show off reader solutions and call out people who have found bugs so that future readers can be warned, and so the folks who find the bugs are getting public credit.

Popular Pragmatic Bookshelf topics Top

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
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
herminiotorres
Hi @Margaret , On page VII the book tells us the example and snippets will be all using Elixir version 1.11 But on page 3 almost the en...
New
jskubick
I found an issue in Chapter 7 regarding android:backgroundTint vs app:backgroundTint. How to replicate: load chapter-7 from zipfile i...
New
brunogirin
When trying to run tox in parallel as explained on page 151, I got the following error: tox: error: argument -p/–parallel: expected one...
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
oaklandgit
Hi, I completed chapter 6 but am getting the following error when running: thread 'main' panicked at 'Failed to load texture: IoError(O...
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
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New

Other popular topics Top

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
DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
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
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
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
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
New
New

Latest in Effective Haskell

Effective Haskell Portal