Hacker News new | past | comments | ask | show | jobs | submit login
“Monads,” huh? Bro, have you even read Leibniz? (mrh.io)
2 points by markhenderson on Jan 30, 2017 | hide | past | favorite | 2 comments



I know what a monad is from Leibniz.

I know what a monad is in APL. (APL is the second computer language I learned, following Fortran IV.)

I know that "Monads come out of the sky and they stand there." from Yes.

dictionary.com tells me that monad is

1. Biology.

any simple, single-celled organism.

any of various small, flagellate, colorless ameboids with one to three flagella, especially of the genus Monas.

2. Chemistry.

an element, atom, or group having a valence of one. Compare dyad (def 3), triad (def 2a).

3. Philosophy.

(in the metaphysics of Leibniz) an unextended, indivisible, and indestructible entity that is the basic or ultimate constituent of the universe and a microcosm of it.

(in the philosophy of Giordano Bruno) a basic and irreducible metaphysical unit that is spatially and psychically individuated.

any basic metaphysical entity, especially having an autonomous life.

4. a single unit or entity.

I liked this article. It was well-written and easy to understand. I thought I might have learned something about a stumbling block which I encounter every time I try to learn what FP is about.

coolsunglasses then says that the article is all wrong but gives very little information about what FP monads really are.

> It's a useful pattern that can be reified in a sufficiently expressive type system.

Is that not usually called a template?

All of my programs were functional. If they didn't function, I would not have been paid.


>small functions that lift types from simple to complex.

That's not what Monad is.

Monad isn't core to FP, but it's a convenient way to express some common things in functional programs.

>In the Haskell language, and many other modern languages, the definition is more complex. Here, a monad is also function, but it is a special type of function. Monads typically “lift” a primitive variable types (Integer, String, etc), to more complex types (MutableString, NullableInt).

This is completely wrong.

>we can define the Haskell monads as that which takes one singular state and outputs another.

This is also wrong.

>Thus, we can arrive at a definition of the computer science monad as a fundamental unit of computation.

It's not at all fundamental to computation. It's a useful pattern that can be reified in a sufficiently expressive type system.

There's no relationship between Leibniz monads and the Monad you see in FP. Sorry.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: