Functional Programming and Spiritual Practice

As I get deeper and deeper into Haskell and functional programming, the fundamental principles of FP starts to make more sense to me, and a light bulb goes up in my mind: actually there is a deep connection between them and one's spiritual practice.

The first one I made such a connection is laziness. If you really ponder about, it is almost the same as the patience we are trying to cultivate in our practice. you play the long game, wait, and only act when called upon.

That moment of insight got me wondering about the other tenets of functional programming. What's a function? Well a function is just a service. What does purity mean? That means integrity, ethics, and wholeness. And what about composability, the number one reason, in my opinion, of doing FP in the first place? Here I want to say composability implies everything is connected, and nothing is standing alone, which is most important insight to have real compassion for other people. Once you realize there is nothing special about me or myself -- it's just one node in the vast, fully connected universe, compassion comes natural to us, and it's easy. so in that sense composability or composition is essentially the compassion in our spiritual practice.

So here is the connections I see between functional programming and spiritual training:

  • Function == Service
  • Laziness == Patience
  • Purity == Ethics
  • Composability == Compassion