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)

Feature flag article image

Create a feature flag in your IDE in 5 minutes with LaunchDarkly’s MCP server ⏰

How to create, evaluate, and modify flags from within your IDE or AI client using natural language with LaunchDarkly's new MCP server. Follow along with this tutorial for step by step instructions.

Read full post

👋 Kindness is contagious

Explore this insightful write-up embraced by the inclusive DEV Community. Tech enthusiasts of all skill levels can contribute insights and expand our shared knowledge.

Spreading a simple "thank you" uplifts creators—let them know your thoughts in the discussion below!

At DEV, collaborative learning fuels growth and forges stronger connections. If this piece resonated with you, a brief note of thanks goes a long way.

Okay