Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "monads"
-
If you know haskell, you know the pain of learning Monads, functors and applicatives, especially when coming from imperative background.
But this guy filtered out all the witchfuckery out of this seemingly complex subject. And there are pictures.
http://adit.io/posts/...6 -
me: "aye im a cool functional programmer, monads are useful, whats up loop using plebs'
also me: *passes input argument as terminating condition*1 -
One of the biggest barriers to the wide(r) scale adoption of functional programming languages like Haskell, F#, and Scala is how snooty and condescending your average FP developer is. And beginner-unfriendly.
Ask them a question about an intermediate topic (in my case, the Free monad) you're likely to get a whole torrent of category theoretic rubbish in return.
This is a common pattern I see when "experts" answer questions.
Now, it didn't bother me much because I've studied a fair amount of category theory and can usually follow such answers, but, for the sake of the general case, I'd like to shove these rules into the heads of everyone writing an answer to a question (not just FP):
1. If you can't illustrate a concept clearly without going into verbal diarrhoea with phrases like "monad homomorphism" and "just a monoid in the category of endofunctors" then you clearly haven't understood it properly (unless, of course, the answer absolutely requires it). An answer is not the place to show off your knowledge of a topic.
2. Please remember that everyone was a beginner at some point. Including you. Understand that some concepts can be extremely frustrating at first and yet incredibly simple after you grok them (eg. monads).
3. If the person asking the question is a beginner, using complex concepts in an answer just because it's a more "elegant" way to explain it doesn't really help them. They are more likely to get confused and drop the topic.
(Kudos to those people who give highly relevant, insightful, simple, and intuitive answers, you guys are the best).2 -
In PHP (yes, it's a language I... don't hate) I've always hated exceptions. They're like GOTO, in an OOP world with interfaces and contracts, try/catch is really odd as it breaks a promise about returning with a typed value.
But you can now do this in PHP8, which comes pretty close to Maybe/Either monads (Option, Result whatever it's called in other languages):
function getUser(): User | UserNotFound
PHP8 unions don't come with the same strong guarantees as in other languages but *pets PHP gently on the head* you did well, my boy.
Now I would really love it if PHP9 could do:
function getUsers(): Collection<User>
Type Tree<T> = Null | Node<T>;
function 🎄(): Tree<Branch<Ornament|Light|null>>15 -
A people person is only a people person to another people person. I fucking hate them. Most sales people I see don’t really have any skills per say. They think they do by claiming to be a people person. The entire sales community is like this. Fake as shit. They pay thousands to learn something that has been written in Medium or you could just Youtube. I think I can pretty much get the fact if you wanna make a video do well, you need a good title. They speak everything on the surface. And they claim to a be a layperson. Well, no. Fuck you. I not giving you an average. You are stupid as shit. They can’t write a proper fucking email. I have to go through kubernates and monads and they still make more money than devs via commission. They are too sober and fucking pretentious too. Fuck em fuck em fuck em.3
-
!rant
so the other day i was programming and suddenly i wanted to learn haskell. (i don't know why it hit me so suddenly, maybe because it's a 'pure' functional programming language and these 2 terms i knew nothing about)
and to be honest it's really hard coming from an imperative programming language (C/C++, yes, i know they are different in their ways). it's like learning to program again! you really have to get a different mindset and for me honestly it's hard to grasp the idea that 'variables' are immutable! like, that's soooo weird it still stucks to me. for example how did they define the max or min function without using a while loop? what are monads?
I am just 2 days in but it'll be a fun ride!6 -
Rust I think, it introduced me to using iterators and monads. I try to use them wherever I can, they're so cleeaan.
-
I don't write monads,
nor intricate templates,
my code shall be stupid
and simple - free of any
arbitrariness and superfluity.
Clear and evident.2 -
Personal favorite quotes from my cubemate...
- JIRA, God of Blunder!!
- trickle-down badge-o-nomics: when I have to ask someone else to lend me their badge because someone else borrowed mine
- Haskell users can kick a motherfunctor right in the monads
- You can't put monads in Go because they try to prefix everything with go-
- Always use live rounds when troubleshooting -- never blanks
- Equifax's Apache wasn't patchy enough
- I saw the last episode of the first season of The Last Kingdom
- You gnow it's good cause it's GNU1 -
It's nice that more and more languages are introducing async/await syntax, but by the example of Rust in particular I'm starting to wonder why we don't instead introduce this syntax for monads in general?
We could have a keyword (say, `bind`) which unwraps a value from any monad provided that the return value of the function is wrapped in the same monad. The ? operator does something a little similar, and I'll be intrigued whether it can actually be implemented for monads other than Result and Option once GATs are stabilized. In particular in the case of Rust, it would be possible to create a reference counting monad for heap-bound management of objects derived from references.9 -
Coworker: let's use Result monads in the project so that we're forced to deal with exceptions
Me: okay, sounds great!
Me: *implements Result monads *everywhere**
Coworer: how about we don't use results anymore in half the project? It makes the code look ugly. Let's just use exceptions.
Me: ...
Really? Why in your mind is it okay to only force us to handle a few exceptions and others we can just say fuck it and let them wander around?
Oh you want to use try-catch for these other exceptions.
So now we're back at square one, which is trying to remember/figure out which exceptions any method can throw (since the compiler doesn't do shit, not even warnings), but now we also have inconsistent and much less readable code. Isn't it great?
(╯°□°)╯︵ ┻━┻
I also can't do much about it, because I'm just a fucking intern and I do not want to cause trouble, so I just try to say that I disagree with it in the most polite of ways and that's that.4 -
Started looking into pseudo functional programming in JS.
Instant love...!!!
Writing monads composing together with curried function passing beautiful immutable data...
While listening to Fur elise Beethoven....!!
Coding bliss..!!!