real talk, are #monads just a way of sending you to mathematical hell & back before you're allowed to write ordinary series-of-statements imperative programs in a #functionalprogramming language
#monads #functionalprogramming
Is understanding #monads a career bucket list item for you? #functionalprogramming #fp
#monads #functionalprogramming #fp
best way to learn #monads seems to be using a bunch of different monad instances and let the magical pattern matching part of your brain pull out the common structure. if you try to just stare at the type definition it looks like complete abstract nonsense.
so far this presentation of #monads has basically been "here is why golang's if err != nil return err pattern is utterly idiotic"
New blog post: In search of better error handling for #golang:
https://articles.orsinium.dev/p/notes-go/monads/
TL;DR: I experimented with different approaches for implementing #monads. Turns out, Go isn't a good #FP language. Who knew? ๐ Regardless, it was a fun dive to see why exactly it doesn't work. And along the way, I found a few things that you already can use on the prod.
lol i loved this introduction so much that I added it to the Haskell wikiโs โMonad tutorial timeline.โ
https://wiki.haskell.org/Monad_tutorials_timeline#year_2017 #monads #haskell #ocaml
Whenever someone writes a blog or tries to explain #monads they claim its just a simple concept with fancy words... and then completely fail to explain the concept. Lots of verbiage about functions and closures and math theory, but no actual explanation of what they are in a common language like Python or Java or Swift, etc. Just Haskell (and strangely, C#, but not helpful to me, at least).
Finally discovered that its coming from the Functional Programming camp, which explains why the gaslighting about being "simple". I guess its simple if you assume you are working in a completely functional programming -- but if you don't state that out loud, all the "simple explanations" in the world don't matter if your description isn't grounded in something I know about.
Turns out that the Apple Combine Framework is close to monads (and functional programming) --- I get that its not exactly the same, but at least I can ground my understanding now...
https://www.hackingwithswift.com/interviews/daniel-steinberg-what-are-monads
Surprisingly controversial take:
#FunctionalProgramming discourse: #CategoryTheory is all about analogies.
But also FP discourse: #Monads are not spacesuits!
#functionalprogramming #categorytheory #monads
can anybody help me track down "How to Compose Monads (Thinking Machines Corporation tech. report, 1993) - Guy L. Steele, Jr."
#functionalprogramming #monads #haskell
More monads in guix.
A nice evening reading on guix scheme api and functional programming tricks for managing side effects.
https://guix.gnu.org/en/blog/2023/dissecting-guix-part-2-the-store-monad/
https://www.youtube.com/watch?v=SN8nTQiWOYY&ab_channel=PBSSpaceTime
#Philosophy #PhilosophyOfScience #PhilosophyOfPhysics #PhilosophyOfCosmology #Science #Physics #Cosmology #Newton #Leibniz #Monad #Monads #Einstein #SpecialRelativity #GeneralRelativity #GR #Relativity #Spacetime #AbsoluteSpacetime #RelationalSpacetime #PBS #SpaceTime #PBSSpaceTime #MattOdowd
#mattodowd #pbsspacetime #pbs #relationalspacetime #absolutespacetime #spacetime #relativity #gr #generalrelativity #specialrelativity #einstein #monads #monad #leibniz #newton #cosmology #physics #science #PhilosophyOfCosmology #philosophyofphysics #philosophyofscience #philosophy #real #time #space
@underlap
I second monadic #parsers, both useful and #elegant in the extreme. But this doesn't just apply to parsers of languages, it applies to parsers of binary, and of wire protocols as well.
My next favorite use case for #monads is sort of the inverse operation of parsers: #ProceduralGeneration. Think of list comprehension (which in #Haskell is just syntactic sugar around a monad), but applied to any data structure at all (trees, directed graphs). You define a monad that contains state and constraint rules, and then use the monad to define the production rules for each node of the structure.
When I define a parser, I also often define a procedural generator to test the parser. It is easier to generate than to parse, so I can quickly write tests that genreate random grammatically correct syntax trees and see if the parser can parse anything I throw at it.
#parsers #elegant #monads #proceduralgeneration #haskell
@abcdw The #Haskell syntax is easy, that is for sure.
Functors, Applicatives, and #Monads are best learned by example, in my opinion. When I first learned about them, they were so simple that I thought I was missing something. Knowing their definition (which is very simple) doesn't help one understand how it relates to modeling computational procedures until one actually sees examples of how these concepts are used for that purpose.
When I read half of the Haskell book and already thought it was easy, I went to the local hackerspace to haskell seminar and was met by Applicative-Functor-Monad-Type-Inference all that thing.
#processalgebra for verification is even worse than #monads in functional programming languages