Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The simplicity is an illusion. While monads are not complex, the concept is very abstract relative to the imperative languages most people program in.

Think about it. In python there's really no syntactic sugar to place something in a container, so the concept doesn't really exist in python until you invent it using other python language primitives. So when you tell a python guy about a burrito, he really has no language analogue to think about. When I tried to learning about the maybe monad, I looked up a tutorial that taught it in python... Big mistake. I was thinking why the hell would people go out of there way to wrap that shit up in a burrito when they can just do a goddamn try exception... It made no sense to me, and even now, it still doesn't make sense for python. Only when I learned about haskell did I realize how the maybe monad makes sense for haskell.

I think most people learn about monads through haskell or any other language with a similar type system. It'd be interesting to hear peoples' experiences about how they grokked the concept.



I think Maybe monad could be really useful in Swift (Apple's new language). Some people use it for chaining up the optional type. However, I found that the lack of functional feature such as curried parameters in swift makes it less useful.


You can write a Swift function with curried parameters.

    func addMultiple(#a: Int)(b: Int)(c: Int) -> Int {
      return a + b + c
    }
It can not auto-curry parameters, but at worst you can wrap functions in their curried couter-parts.


Interesting. Does addMultiple(7) bind a or c?




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: