logoalt Hacker News

epolanskilast Monday at 9:10 AM2 repliesview on HN

Small OT but part of me dies when data types that respect some laws are just labeled monads.

Nobody calls an array a monad, even though an array admits a monad instance.

Option, Result, Array, Either, FunkyFoo, whatever you want are just data types.

They only become monads when combined with some functions (map, bind, apply, flatmap), and that combination of things respects a set of law.

But calling a data type alone a monad has done nothing but overcomplicate the whole matter for decades.


Replies

mrkeenlast Monday at 9:35 AM

Sure, but this article's Result implements Ok(), Map(), and Bind()

pjc50last Monday at 10:08 AM

I was wondering about that. "Monad" is a mildly obfuscatory term for "function that takes one argument and returns one value of the same type", and a List is not a function.

show 2 replies