miciek / grokkingfp-examples

All examples and exercises from the Grokking Functional Programming book
https://www.manning.com/books/grokking-functional-programming?utm_source=michal&utm_medium=affiliate&utm_campaign=book_khan_grokking_6_26_19&a_aid=michal&a_bid=7c041142
146 stars 52 forks source link

Some Examples don't work (resource download from Manning) #49

Open sysarcher opened 2 years ago

sysarcher commented 2 years ago

First of all, THANK YOU for this book!

I downloaded the examples as a zip file from Manning's resources (GrokFP_examples_rev210715). Running sbt console and trying out the examples don't seem to work. (permalink to comment on livebook

HOWEVER, using this repo's main branch seems to be fine. I would suggest updating the resources on the LiveBook so that more people aren't confused.

Thanks again! I'm learning sooo much and am so excited to be around the half-way point..

miciek commented 2 years ago

Thanks @sysarcher! Great that you were able to get a working code by going to GitHub. However, it's definitely not an experience I'd like readers to have. I uploaded the new archive and let Manning know. It should be updated pretty soon.

If you have any other feedback about the code snippets or the book in general, please let me know 😃

sysarcher commented 2 years ago

@miciek I guess somehow a great onboarding experience is also missing. I mean, I'm not living the JVM life but I am fairly familiar (more than an average computer user I guess?).

I worked on the first few chapters (until Ch. 07) with Scala worksheets (in IntelliJ Idea) instead of the scala console (sbt console) ... that way I am able to pick up from other computers or from where I left off. Since the current chapter (Ch. 08: IO as Values) depends on already implemented modules, and IntelliJ seems to have issues with Scala3 worksheets, the overall experience has deteriorated for me.

I'm now thinking of checking if I can work with worksheets in VS Code, but not too hopeful since worksheets seem to be an IntelliJ thing from what I've read.

sbt console (as the book suggests) works very well but it's not persistent. That's my gripe.

Again, thanks for the efforts you're putting in the book. It's a great resource! Idk but will you implement the examples in other languages? Maybe OCaml/Racket because the whole JVM thing is confusing AF!

I also don't remember where the book stated that the book uses Scala3 (it should be made clearer I'd suggest)

miciek commented 2 years ago

I also don't remember where the book stated that the book uses Scala3 (it should be made clearer I'd suggest)

That's mentioned in chapter 1 and then a few times later in the book. Did you encounter problems in this area? E.g., installed Scala 2 instead?

Since the current chapter (Ch. 08: IO as Values) depends on already implemented modules, and IntelliJ seems to have issues with Scala3 worksheets, the overall experience has deteriorated for me.

What problems are you encountering with Scala3 worksheets? I think it's great that you were able to use them for seven chapters. Chapters 8 and beyond are more advanced and I optimized their sbt console experience as much as possible (e.g., automatic imports and import references in the book). But you are right that they need to be consumed in a single sbt console session.

I am working on implementing an online service for book examples. I think this would make the onboarding experience seamless, especially for non-JVM people. If you are interested, I will let you know when the first version is online.

Thank you for your feedback, it's very helpful.

sysarcher commented 2 years ago

I think the Scala3 support is fairly broken in IntelliJ Idea. My worksheet looks like this at the moment: So you see the error on the right is (I think) that IO isn't recognized even though I explicitly import the cats library (import cats.effect.IO (import resolves correctly! but using it afterwards doesn't work as expected)

I believe it's due to unimplemented support in IntelliJ Idea but as I mentioned earlier, this isn't an environment I'm too familiar with, unfortunately.. so I don't have more intelligent comments here.

image

I am working on implementing an online service for book examples. I think this would make the onboarding experience seamless, especially for non-JVM people. If you are interested, I will let you know when the first version is online.

Y.E.S!!! I'm thinking of reimplementing many of the book's examples in OCaml/Racket because there, the experience is straightforward (apt-get install or brew install and you're done... no playing around with sdkman or update-alternatives etc.)