Functor >> Applicative >> Monad

Functional programming is out there. Partly rumor, partly practiced, partly understood. I have been writing about them for around 6 months. In this post, I want to summarize the main terminologies (jargons) very concisely, with example and best of all, with swift code. For a full explanation, I will link to my previous blogs and external resources as we go along. Lets get going.

Read More

Monadic Networking: I Promise!

This post abstracts handling async tasks and come up with declarative linearized API model. Async tasks includes nested networking, nested animation and even nested multi-threading compute intensive code blocks. Async task is one of side effect programming technique. Side effect is integral part of programming; mutating state, printing to screen/paper, asynctask to download JSON, keeping a running counter, locking/unlocking thread are all examples of side effect programming technique. Any useful programming language must provide a way to interact with side effects.

Read More

Monadic Computation in Swift. Why?

I won’t go into the details of what a Monad is and what exactly it solves. What we will do here is try to come up with a monadic type to encapsulate network result. We will do a side by side comparison with the traditional/classical/imperative and the functional (monadic) approach. In the end you should be able to appreciate and hopefully use the monadic style of wrapping network result without being bothered about the nitty gritty details of what a monad is?

Read More