News for hackers. Stuff that matters.
Re:Why study functional programming? (2012) by taeric on Tuesday August 02, 2022 @03:23PM (#32323133)
Not going to lie, I don't understand that explanation. It honestly sounds more like you are describing a form of encapsulation, as the contents of the box are hidden and someone else has the ability to open said box to get access to it.

I also find the appeal to a physical object to explain a functional concept is rather amusing.

Re:Why study functional programming? (2012) by solomonb on Tuesday August 02, 2022 @03:30PM (#32323210)
Not sure if you are looking for an explanation of Monads, but Monad tutorials are a long running joke in the haskell world. They are almost exclusively written by people for whom the concept just clicked and they either fail provide context for someone without that experience or they fail to actually describe the concept correctly.

I'm not gonna give you an explanation but I will say that IMO the best way to actually learn about them is to just look at the typeclass and a bunch of instances of it and how they are used. If you ignore all the theory (and the "theory") and just look at the code you will find that they aren't that hard to sort out from a usage perspective.

Re:Why study functional programming? (2012) by taeric on Tuesday August 02, 2022 @03:33PM (#32323244)
Apologies, I seem to have deleted a sentence where I think I can make my understanding fit that metaphor. I don't think they are completely unapproachable, but I am not at all clear that a physical metaphor works. And, I really wanted to shine a light on the amusing appeal to physical objects in a thread that is about the short comings of object oriented programming. :D
Re:Why study functional programming? (2012) by solomonb on Tuesday August 02, 2022 @05:45PM (#32324672)
No need for apologies! I 100% agree that the physical metaphor doesn't work and said so in another nearby comment.

If you go back to Phil Wadler's original paper on implementing monads in haskell, he doesn't talk about category theory or boxes or anything. He lays out a handful of common things you might do in programming but which seem totally unrelated. For each one he implements a solution and then reveals that all these solutions fit the same interface.

Re:Why study functional programming? (2012) by trebbble on Wednesday August 03, 2022 @02:43PM (#32335359)
At some point, it dawned on me that my problem wasn't that I didn't understand monads, it's that the idea's so simple I couldn't convince myself I understood it, and that what I actually didn't understand was why anyone gave a shit about them.

Like if a bunch of smart people keep going on and on about something called a "floobiz", and every time they try to explain it to you, it just looks like a fucking cup. The problem isn't that you don't understand what a cup (floobiz) is, it's that you don't get why they keep going on about them like they're something special.

Re:Why study functional programming? (2012) by ModernMech on Tuesday August 02, 2022 @04:10PM (#32323684)
> I also find the appeal to a physical object to explain a functional concept is rather amusing.

The challenge was to describe it to a 5 year old. 5 year olds are better with concrete thinking than abstract reasoning. This is what made using the turtle in Logo a genius move, as it allowed younger children to write programs by conceptualizing a physical turtle that can move, rather than thinking in terms of an abstract function that mutates data.

Re:Why study functional programming? (2012) by taeric on Tuesday August 02, 2022 @04:19PM (#32323772)
Fair, and I don't necessarily disagree. I think this leads rather close to object oriented software being easier to reason about concretely than functional programming, though. And since most people are trying to get a concrete job done, that feels like a significant claim.

For turtle geometry, it is also important to acknowledge the metaphor and shortcomings of a more traditionally analytic framing of drawings. Specifically, X and Y coordinates for a drawing are surprisingly hard to work with. For example, I challenge you to describe the fractal snow flake in an easier way than using directions as a metaphor. Same for the dragon curve. This can be seen akin to picking a different coordinate system, I presume?