I can't believe I wasted my whole afternoon with this

happy_sad
happy_sad

suddenly get interested in monads for some reason
know jack shit about Haskell, but might as well try to find some general definition about why are they such a big deal
open some StackOverflow answers since they usually give answers for ADHD people such as myself
"it's this, except it isn't, so read some really fucking dense papers about endocrine disfunctors"
comments tell user he is wrong (as usual, nobody in StackOverflow is right even if the answer works), some weird mathbabble mumbojumbo
start to think monads may be related to closures, from what I understood
search about "closures vs monads"
"monads have absolutely nothing to do with closures, please go kill yourself"
keep searching
go to c2
first replies are pure mathbabble
"monads describe sequential computations"
so some sort of procedural macro?
"monads don't need to be sequential"
"monads are kind of like the ultimate exploitation of closures"
"monads are like functions that take global state as their parameter" (seriously, functional programmers? Is this your ultimate weapon against impurity?)
"monads are like burritoes!"
haskell examples (was this language specifically designed to look cryptic?)
unreadable implementations of monads in other language that don't really make clear which part of the code is trying to represent the monad
are monads just lists of closures/recursive closures?
more PhD. in maths shit
whenever someone makes a wild guess, someone else jumps in and pedantically points out the person who said that is wrong
find another article that claims that monads are just macros
some people consider it to be a function generator that gets constructed in some really specific way
start to think monads are just whatever you want them to be, man
the official Haskell page with their math wiz definitions isn't being helpful
finally find one article https://wiki.haskell.org/Monads_as_containers
So, that's it? Are monads just sets of wrapped objects that can be processed by a function that wraps them, then unwrapped just to be put inside a wrapped objects inside another set? Is it just mapping a set of wrap(a) to another set of wrap(b), where wrap(*) is a type of object that can only be transformed in some explicitly specified functions?

All urls found in this thread:
https://wiki.haskell.org/Monads_as_containers
http://www.seas.upenn.edu/~cis194/lectures.html
https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch1.html
https://en.wikipedia.org/wiki/Monad_%28functional_programming%29
https://github.com/Cipherwraith/alacrity
https://docs.oracle.com/javase/tutorial/extra/generics/methods.html
iluvmen
iluvmen

@happy_sad
wrap wrap warp function wrap object wrap warp warp function function wrap haskell warp wrap object?

Inmate
Inmate

Monads are strongly-typed mixins. Happy now?

likme
likme

Haskell is a meme langauge that rarely leaves academia so it's intentionally obtuse to generate papers. It's not worth bothering to understand their lingo. None of them know how any of the language works at the assembly level, anyway.

Playboyize
Playboyize

learn a bit of mercury. By "hello world" you should realize that monads are just a hack that allows Haskell source to look prettier than the corresponding Mercury source. Like most of Haskell, it's a feature that only exists to make Haskell's self-flagellating bullshit sort of work.

Then go and try to apply your understanding of monads to some more straightforward language. It can be C, or something more flexible like Lisp or Forth. Yes, you can find blog posts where people have already done monads in C. When you realize that this is fucking pointless, you'll come to reaffirm the "wasted" part of your title. Why solve fake problems created by stupid features when you could use a better language and solve real problems? Manager- instead of language-designer-inflicted problems.

Gigastrength
Gigastrength

a monad is just a monoid in the category of endofunctors

Crazy_Nice
Crazy_Nice

Monads are a meme. From what I understand, they're used as a way to sweep under the carpet all those nasty evil side-effects and pretend really hard that "pure" functional programming is relevant for real world applications. In the end, everything they do can be accomplished in a more straightforward and comprehensible manner by other, well-established means (as long as you're not obsessed with the appearance of mathematical purity).

MPmaster
MPmaster

@happy_sad
does anyone else find s2 haruhi ugly as fuck

Soft_member
Soft_member

@happy_sad
monads are the ultimate meme

Bidwell
Bidwell

doesn't know Haskell or FP
complains that he doesn't understand an intermediate/advanced concept of it and the examples given in that language
complains that the abstract explanations are too abstract
complains that the research papers about it are too mathematical

I bet you're the kind of guy that shits on every PL and ends up coding spaghetti C by default.

If you're serious about learning a new language/paradigm then go through a proper book/course.

Haskell:
http://www.seas.upenn.edu/~cis194/lectures.html
JS:
https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch1.html

Poker_Star
Poker_Star

I use xmonad and it's great!
I didn't even have to learn Haskell at all.
Fuck your shit OP.

Flameblow
Flameblow

@Bidwell
If you can't present the concept as it would look in C then you don't understand it. If it looks retarded in C then you've discovered it was retarded to begin with.

TechHater
TechHater

@Flameblow
It's very easy to handle in C but it's not as useful unless you want first-class blocks. It also makes the stack explode.

for example, the basic building block of haskell represented in c is

struct {
int ready;
union {
void* (*thunk)();
void* done;
}
}

It's not necessarily useful to represent it in C, you see.

Nojokur
Nojokur

@happy_sad
try to learn something
waste of time
Pick one faggot.

So sorry you "lost" time you could have spent watching cartoons for children.

Nude_Bikergirl
Nude_Bikergirl

@Bidwell
What's the benefit of Haskell vs other FP languages?

@Nojokur
He's right though. There's a quality component to learning.

Harmless_Venom
Harmless_Venom

@Nude_Bikergirl
Funnily enough it has had the most work put into it. If you're going to spend your time optimizing a high-level program out the ass, you should probably do it in Haskell. It has a reasonably well selected feature set: if the type system can control something it's either easy or balls-out hard, so you can tell if it's worth it pretty quickly.

Bidwell
Bidwell

So, you found 5 answers to your question, but since you immediately shit your pants whenever you see math, you couldn't comprehend them.

At least try to feel inadequate, and maybe your dumb ass will do something about it.

CodeBuns
CodeBuns

Maybe it's easier to start with some concrete monad, not an abstract concept. What programming language are you most familiar with?

If you know Java 8: Stream and Optional are monads, sort of. Notice both have a map() method, which returns monadic type. This is why we say, these are monads.

The return type of map is essential. Everything is wrapped in monad. Remember: You can't get anything out of the monad.

That's just like my opinion about monads, anyway.

SomethingNew
SomethingNew

@Nojokur
Concept is actually "it's just a mappable collection of special-typed objects"
Find who knows how many explanations, some of them intentionally obscured to look more complicated than it actually is, some of them downright nonsensical
Spend the whole day reading explanations by people who may have even gotten the concept wrong
Not a waste of time when it would have just been as simple as telling it like it is

@Bidwell
Say, you have three teachers trying to teach you about concept X. The first teacher tells you concept X means A, but the second teacher says concept X is actually B, while the third teacher says the previous teachers are wrong and it's more like C except it isn't so you are more or less back to square one.

Are you stupid for not understanding it or do you think they could have argued between them to get their shit together before shoving it down your throat?

w8t4u
w8t4u

https://en.wikipedia.org/wiki/Monad_%28functional_programming%29

Wikipedia actually has a pretty good explanation about it.

askme
askme

this is what happens when you try to understand meme languages using pseudoparadigms that have completely nothing to do with how the application works on the machine

Bidwell
Bidwell

@MPmaster
she's better than the uncanny valley between 90' and 00' anime which was first haruhi

idontknow
idontknow

@CodeBuns
Can't say I am an expert of Java 8, but I have worked a bit with its streams and lambdas so I thought I understood them well, but then I looked at the API and map()'s return type is defined as <T> Stream<T>. Is this special syntax/notation for something? As far as I know, when using map(), I can chain another Stream operation to it, so I thought it returned a Stream<T> and not whatever <T> Stream<T> means.

HW let me post

TalkBomber
TalkBomber

@MPmaster

KyoAni went full-moeblob with K-On! and never recovered, ruining both Haruhi Season 2 and pretty much all of anime in the process.

Thanks, KyoAni!

tfw I pointed this out when it Season 2 came out and everyone told me "it was fine".

No, it wasn't. It wasn't fine.

LuckyDusty
LuckyDusty

So what can I do with Haskell that justifies its existence? It seems like it's overcomplicated and you spend most of your time solving problems the language creates rather than the problem you intended to solve.

StonedTime
StonedTime

@LuckyDusty
You could write some articles in academic babble.

GoogleCat
GoogleCat

fun fact: Leeky Forums runs on haskell now
https://github.com/Cipherwraith/alacrity

StrangeWizard
StrangeWizard

@idontknow
<T> Stream<T> is the same as Stream<T>.The extra <T> is just a declaration that T is a type parameter. The compiler needs to know that is doesn't have to go look for a class named "T" in the classpath.

This is necessary because in Stream#map, T can be any type. It does not have to be the type of the stream.

For instance, you could map a stream of Strings to their lengths. In that case T would be java.lang.Integer.

Fuzzy_Logic
Fuzzy_Logic

@StrangeWizard
forgot the link: https://docs.oracle.com/javase/tutorial/extra/generics/methods.html

Lord_Tryzalot
Lord_Tryzalot

@GoogleCat
Really? Because I would argue it is not running most of the time. :^)

Evil_kitten
Evil_kitten

@LuckyDusty
You could jerk yourself off to type theory or this:
import Data.List (partition)
qsort :: (Ord a) => [a] -> [a]
qsort [] = []
qsort (x:xs) = qsort less ++ [x] ++ qsort more
where
(less, more) = partition (<= x) xs

farquit
farquit

@SomethingNew
That would be because it isn't just a mappable collection of objects. It's anything that has certain properties. There are useful monads which aren't burritos.

@LuckyDusty
You could write a blog post explaining prisms.
It's actually really easy to use but most of the people who use it like complicated things so most the material around it is complicated.

Firespawn
Firespawn

They basically let you define a type with some hidden boilerplate logic and a set of compatible functions. With do notation they can do some nutty shit because you're really writing a bunch of nested functions that are being applied with your particular monad's logic.

New_Cliche
New_Cliche

@Evil_kitten
That looks like it must be very slow. Normally qsort is done in place. Is it able to magic up that optimization under the hood?

whereismyname
whereismyname

@New_Cliche
It isn't unless you're doing quick select and you carefully handle your concatenation. Real quick sort requires mutation so it's longer -- about as long as it is in C.

Spamalot
Spamalot

itt mostly plebs
this thread is pure fucking cancer.

w8t4u
w8t4u

@Spamalot
Thank you for your specific criticisms.

Nojokur
Nojokur

@w8t4u
Specifically, he means that people who don't smoke Haskell cock are cretins who can't into programming and can probably barely control a turtle graphics app in qbasic.

Haskell has a lot of good stuff in it. It also has lazy semantics, and therefore is a worthless meme language. The truth is, people who can't make that distinction tend to be cretins who've never seen the good stuff anywhere else, so they accept the bad as somehow unavoidably bound together with the good.

Raving_Cute
Raving_Cute

god is a monadic quantum consiousness

Disable your ad blocker to access the content

Disable your ad blocker to access the content