Refresh - 2021

Time to hit refresh, and restart my blog. This is a test post to ensure that all the tooling (Hugo, my theme etc.) works as expected.

→ 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…

Sublime Text & Haskell

There are several excellent posts about setting up the Haskell development environment. One of the best ones is Tony Lawrence’s Configuring Your Haskell Environment. I encourage you to take a look at his post first.

Read more…