Day 10 - Either or Maybe, Building and Testing, and a general update on things

I had to take a week off my #100DaysOfCode because my parents were visiting me for a few days. They’re on a summer break so they decided to visit my sister and me. So I had to halt the #100DaysOfCode for a few days before resuming.

On the bright side, they cleaned up and organized everything in my apartment, and in the words of Alvina, it looks very much livable now. My kitchen is so clean right now I almost can’t believe it’s my kitchen. My fridge also has supplies other than ready-made food packs. They left for my sister’s place yesterday so I’m back to my 100-day track, except in a much better place.

Day 10 has been pretty good for me. I covered three chapters from Haskell from First Principles, which were about handling bottom values with Maybe and Either, building Haskell projects using Cabal and Stack, and finally testing code with Hspec and QuickCheck. It was a pretty nice break from all the theoretical stuff that I’ve been studying with the book, and kind of made me feel that connection back to the real world of programming.

I especially enjoyed the chapter on Testing code, although I feel a few more examples would have really helped. But one can also argue that testing in itself is a huge topic and there are usually whole books about it, so looking at it from that perspective, the book has covered a lot. Because of the vastness of the topic, I felt like it was missing the verbosity in terms of examples compared to the previous chapters.

The chapter on testing code also sort of marks a halfway point in the book, the part till which most of the basics have been touched upon. The upcoming chapters introduce new concepts but not much in terms of syntax and such. Looking through the table of contents, the next few chapters are on Monoids, Functors, Applicatives, Monads, Foldables, Traversables and so on.

Surprisingly, the chapter on Monads is pretty short compared to the others. I’m only guessing but I think it’s because of the chapter build up. I remember from my previous experience with Haskell how functors, applicatives and monoids are taught before monads, and often described in some relation with them. It’s surprising because one would like to think that the chapter on Monad would be really long and complicated given just how many people are scared of it, and how it’s about burritos and spacesuits.

I’m pretty excited about the following chapters in the book, partly because I know this is where the interesting stuff begins and partly because this book has been a real joy to read and it has given me the push I really needed in this direction. I guess it’s just the comfort of knowing that the book was written keeping in mind people like myself.

I won’t be sharing any code or anything in this post; most of what I studied on Day 10 has been about testing and setting up projects. So there isn’t much for me to share code-wise. Also, I’m about to start studying for Day 11 in about half an hour from now, so the restlessness to dig into monoids isn’t letting me write much. I’ll try to put up a more informational blog entry next time :3 I pwomise.

Seeya and good day!

comments powered by Disqus