DEV Community

Pankaj Sharma
Pankaj Sharma

Posted on • Edited on

1

In a nutshell: Monads and Functors

Functors

Any object that provides a method with following signature is a functor

map :: (a -> b) -> m a -> m b

m is a container, map opens up the container and converts type a to b.

Monads

Any object that provides a method with following signature is a monad

(flatMap) :: m a -> (a -> m b) -> m b

m is a container, flatMap opens up the container converts a to mb and if in the process multiple mb's are created then it flattens them to return a single mb.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay