Favorite Books in 2021

Now that we are done with 2021, it is time to list some of my favorite books from last year.

Read more…

Refresh - 2022

After a fairly long hiatus, I am hoping to resume blogging in 2022. This is a test post to ensure that all the tooling (Hugo, my theme etc.) works as expected. Time to hit refresh!

→ Do You Need Self Discipline To Have Fun?

I can relate to this excellent post by Scott Young, where he makes the case that ease of doing an activity and its enjoyment aren’t the same.

Read more…

Applicative Laws for ((->) r) Type

Haskell’s function type ((->) r) is an Applicative functor. Similar to the previous two posts in this series, in this post I will verify that the applicative laws hold for the ((->) r) type.

Read more…

Applicative Laws for [] Type

Haskell’s list type [] is an Applicative functor. Similar to the previous post, this post will verify that the applicative laws hold for the [] type.

Read more…

Applicative Laws for Maybe Type

Applicative functors come with a set of laws that apply for all Applicative instances. These laws are as follows:

  • Identity: pure id <*> v = v

  • Homomorphism: pure f <*> pure x = pure (f x)

  • Interchange: u <*> pure y = pure ($y) <*> u

  • Composition: pure (.) <*> u <*> v <*> w = u <*> (v <*> w)

Read more…

Maybe as an Applicative Functor

Maybe type is made an instance of the Applicative type class as follows:

instance Applicative Maybe where
    pure = Just
    Nothing <*> _ = Nothing
    (Just f) <*> something = fmap f something

Read more…

Pascal’s Triangle

One of the exercises in Structure and Implementation of Computer Programs deals with generating elements of the Pascal’s Triangle.

Read more…

Index Based List Operations Using folds in Haskell

When working with lists in Haskell, occasionally there’s a need to perform index based operations, such as adding an element at a particular index. As a Haskell newbie, using foldl or foldr is not the first idea that comes to mind when indices are involved. However, there is a general pattern that can be applied when using folds for index-based list operations.

Read more…

→ Talking About Money

Patrick McKenzie wrote an excellent post about compensation and salary transparency. The entire post is really informative, but for me, this passage is a true gem. Every word here is absolutely true:

Read more…