Haskell

Today I can finally say that I "understand" Haskell: it took me about 9 years, 7 books, tens of papers (I can't remember exactly how many, but probably less than 30) and hundreds of hours of trial and error. It was hard, really really fucking hard, but now I can write useful programs in Haskell.

I started with Learn you a Haskell for Great Good, but that was obviously not enough for doing anything real... These are the books I had to read to reach enlightenment:
>- Topology (Second Edition) by Munkres
>- Principles of Mathematical Logic by Hilbert and Ackermann
>- Categories for the Working Mathematician by Saunders
>- Types and Programming Languages by Pierce
>- Advanced Topics in Types and Programming Languages by Pierce (didn't finish it yet)
>- Programming in Haskell by Hutton
>- Purely Functional Data Structures by Okasaki

Maybe the thing that helped me the most was to read the GHC source code and implement my own tiny Haskell JIT with LLVM: that's when I understood the whys.

Let me know if you Jow Forumsuys have any questions.

Attached: haskell.png (1200x847, 15K)

Why would anyone bother learning Haskell when all the cool kids have already moved on to Prolog?

What's a monad?

That's actually quite an excellent feat, user. Good job, yo.

Has it become your choice to write things in, now that you're useful in it? Or do you fall back to whatever languages you were writing stuff in for the past 9+ years ?

what makes you think he's actually written any Haskell code?

Cuz he claims that he did, which i guess is good enough for me currently.

I'm taking a logic course right now where the Prof used a lot of their research to help rewrite the Haskell back end not too long ago, and I wanted to try making a tool to convert between Haskell programs and natural deduction style proofs (a la coq) as a final project. This makes me feel like I have a totally inadequate understanding of Haskell to actually even begin working on the project.

The best short explanation I can say is that a monad is a monoid in the category of endofunctors. I know this is taken as a "joke" by many, but it's absolutely correct.
Thanks. It's actually really nice to write programs in Haskell, but to be honest I am now more interested in Idris, so I am trying to use it for all my new personal projects.

I am also learning homotopy type theory, I believe the future is there.

What is a monoid and what is the category of endofunctors?

You should try it anyways!

So, what have you done with it? Any worthwhile projects? Do you have a haskell job?

now get a job

Do you know anything about abstract algebra? it will be a bit difficult to explain otherwise.
Some relatively small interpreters, compilers and computer algebra systems, which were "worthwhile" only for me. Unfortunately there are no many Haskell jobs (except for those in academia).

I do not know anything about abstract algebra. Can you teach me? it is said that a way to make sure you know something is to be able to teach it to someone else

Attached: ezgif-4-51628759817e.gif (498x372, 2.82M)

>The best short explanation I can say is that a monad is a monoid in the category of endofunctors. I know this is taken as a "joke" by many, but it's absolutely correct.
if you can't even explain what a monad is in normal terms you didn't understand shit

When people ask you "what is a Monad?", your answer should not be the definition of a monad, but the general use case of a Monad--it's purpose for existence, why it is "better" than other equivalent methods of implementing the same logic, and why it might be important that "something" is actually a monad when looked at through a peculiar lens.

that's a good explanation of how to explain monads

>a monad is a monoid in the category of endofunctors.
Ah so it's a troll thread.

Now explain them

Why do people always bring up category theory with Haskell? Hask isn't even a category and even if you pretend like it is the category of Haskell types is profoundly boring.

Is... This some bait I'm to dumb to understand? Do people actually spend so much time learning Haskell??

Did I ever claim to understand Monads beyond their autistic jargon definition?

Attached: F432F8D2-DE6F-4220-AF45-4A02E39B7A79.jpg (933x933, 85K)

lmaoing at dis fugen nig

So what you’re saying is, you are the dumbest fucking person to ever grace this site?

Because if you spent 9 years, read ten books, and thirty papers to learn a single programming language, which you then admit there are no professional opportunities for - that’s only something someone criminally insane or stupid would do, right? Normal people would stop at some point. Even irrational people would invent a reason to. Nine fucking years. You are the biggest brain dead monkey I have ever seen manage to create a thread before. That is time you will never get back. You could’ve done anything else with that time. You could have learned several real life, non-meme, non-computer languages in the time that you dedicated to this fucking absurdity. It pisses me off how stupid you are. Do you have children? A wife? Did you ever have to explain to them “no Johnny, I can’t play catch with you because I’m spending my time learning this Jow Forums peddled abstract nonsense computer programming language. No, honey, it won’t lead to any job opportunities. I’m never actually going to use it, I’ll be using Idris after this is all over.” Please, never devote yourself to anything ever again. You have no sense of opportunity cost, no ability to manage your own time. You would be better off put into a managed labor camp where at least after a decade of work you would have a mound of coal to show for your efforts. I’m an ardent capitalist, but you are the kind of person that makes people believe the nanny state is the only solution to the mind boggling level of insanity amongst members of the public. Fucking Christ.

based

show me on the doll where Haskell touched you, user... it's ok, you're in a safe place now.

Attached: laugh2.gif (187x155, 1.87M)

Monads are a way of mapping a type that has context over an applicative functor. A functor is something that can be mapped over.

>no Johnny, I can’t play catch with you because I’m spending my time learning this Jow Forums peddled abstract nonsense computer programming language. No, honey, it won’t lead to any job opportunities. I’m never actually going to use it, I’ll be using Idris after this is all over.
keks hasklel programmers absolutely btfo

>it took me about 9 years
wasted time
Haskell is meme, you infested now

A N N I H I L A T E D

Attached: 1543624562183.png (764x670, 306K)

Don't worry, the OP's just memeing.

I'm pretty sure I've seen a paper on translating Haskell to Coq. IIRC they wanted to write proofs about the Haskell code. I want to say it was at CPP 2018 but I don't remember for sure.

Is this pasta?

Attached: tenor.gif (360x346, 170K)

>Haskell
Traditional math thying to do something begore death
now the only legit orm of knowlege- a computer programm (not Haskell-on, cose Haskell suck)

Do you need an ambulance or is that just cerebral palsy?

>learning new things is pointless unless you can make money off of them
Jesus Christ and God Almighty, please strike down these nu-Jow Forums posters where they stand

Pretty much my thoughts exactly, and an excellent pasta sauce. Well done. Enjoy the (you)s.

I know the OP is memeing but my programming language theory Prof has every book he mentioned prominently displayed in her office so it's not as far from the truth as I'd like it to be. I'll see if I can dig up that paper and just implement it for my project, thanks for pointing me in the right direction.

Haskell confirmed glow n(gger trigger word

>I’m an ardent capitalist
Opinion discarded.

Daily reminder that you can learn new things just for fun, in fact the only point to make money is to have time for such things.

Learning the different forms of animal shit is learning new things, as well. Do you think this is a good idea spending the most valuable thing you have on?

haskell nigger btfo
>I wrote a haskell jit and read all these papers, I'
m so smart hurr durr
>can't explain a simple concept of a monad, repeats meme that makes him feel smart

Attached: 1548942196108.gif (500x281, 1.6M)

>he's not a scatman

Attached: 1554676131796.png (512x424, 214K)

Prolog is based. Majority of people just haven't been exposed to it.

My prediction the next wave after people jump on the functional programming train is declarative programming with languages like Prolog.

t. nu-Jow Forums

If you enjoy learning about animal shit, then sure, have at it
It seems like OP enjoys learning about programming. Jow Forums used to be full of people like that, not that you'd know

You could've just learned JS and earned 300k in the first year, how silly of you.

I spent a week figuring how to make a cli snake game in haskell, then I wrote haskell on my CV
I was contacted by a guy because of it.
Turns out, he had made a gui tic tac toe

neat, how much do you make?

This. Anyone who understands something is able to explain it with normal words.

based and redpilled

>Haskell is only useful as a mean to pass through stupid resume word filters
nice

cuck

>you don't need to understand computer architecture to program in C
that's how stupid you sound

You need to know category theory to do abstractions without creating spaghetti code in any language.

So it's a static function that operates on class instances?

I can explain to you what monads are with words. But I can't make you understand monads with just words. It would be like teaching someone how to make wood carvings with just words.

Monads are just functions that compose functions with side effects.

I tried to learn prolog when I was about 11 years old..I didn't understand it. :(

Why does every monad need it's own specific transformer? Couldn't there be a generic transformer like
transform :: (Monad m,Monad n) => m (n a) -> MonadCompose m n a

Wrong, monads go well beyond the concept of "function".

I'm talking about monads in programming, not the mathematical concept.

I think its because monads aren’t composable and transformers are a workaround for this. Which is a bit ironic considering monads themselves are a workaround for allowing only pure functions.

how do i funcitonal programming

Programming in Haskell 2nd Edition by Graham Hutton.

A monad in Haskell is a set of functions, and a rule for composing them. There's no general rule for composing functions with side effects, so you need to write your own.

Haskell weenies dead

well pasta'd my friend

Attached: 5-14+meatball.jpg (338x244, 18K)

Meanwhile I'm getting shit done with Scala. An actually useful language.

Traditional math thing to do something before death not the only legit form of knowledge- a computer program (not Haskell-on, cose Haskell suck)

Attached: drink-because-youre-boring1.jpg (430x702, 92K)

>Haskell doesn't even support dependent types
oh am I laffin

Shush now the adults are talking

As someone who never gets further than some basic tuts. Here are some basic things that I am always too shy to ask for on SO.

I heard that you cannot implement a IO monad in pure haskell, true/false?

If true, isn't that retarded design

If I understand correctly the IO monad is only a marker that "this computation is dirty and uses IO" it also handles failure, is this the correct mental model?

How does one stack multiple monads? Can I have something like an Either IO String.. that uses continuations as a newtype or some stuff?

What's up with template haskell, from what I understand it has horrible performance. Isn't existance a sign that the language is flawed?

Whats up with optics, why do I need literal autism to "modify" some structures?

nice pasta

true
no
true
no idea
no
yes

Haskell is for 130+ only, and I say this unironically.

not OP.

Traditional math truing to do something before death. Now the only legit form of knowledge- a computer program (not Haskell-on, cose Haskell suck)

Attached: XANAX.jpg (685x385, 19K)

Humor me for a sec anons. I've been interested in Haskell before ever visiting Jow Forums. I've done some free to take university courses, attended guest lectures. I've only barely grasped the use case of monads other than a fancy way or error handling, and making the code somewhat imperative in style (hurts my soul). My proudest works are 3rd degree spline interpolation, and filtering a 2bil list to search-able sizes in

You cunt.
Now I cant' unsee the logo in my wallpaper.

Attached: 0001.jpg (2560x2560, 1.88M)

n00b

> I heard that you cannot implement a IO monad in pure haskell, true/false?
True, virtually by definition.

> If true, isn't that retarded design
A main function has type `IO ()`, it is consist exclusively of side-effects. You can do those yourself, but say your (pure) program just takes stdin and produces stdout (i.e. has type `String -> String`), there is a function called `interact :: (String -> String) -> IO ()` which turns it into a suitable `main` and hides all impure IO.

> the IO monad is only a marker that "this computation is dirty and uses IO" it also handles failure
Yes, but there are often better ways to deal with failure, see next point

> How does one stack multiple monads? Can I have something like an Either IO String.. that uses continuations as a newtype or some stuff?
Through monad transformers. Most pure monads* have a transformer variant that allows them to wrap around an existing monad. In your example that would be EitherT Error IO String, where (EitherT Error) is called the transformer. But EitherT is called ExceptT since it's just adding exceptions of type Error to the underlying monad.

> What's up with template haskell, from what I understand it has horrible performance. Isn't existance a sign that the language is flawed?
Most languages don't have template metaprogramming, are they flawed? Template Haskell sucks, but the reason Haskell has so much cool shit is that the GHC people fairly liberally try new features and aren't afraid to remove/drastically rewrite parts of the language. I think everybody hopes that TH is deprecated at some point.

> Whats up with optics, why do I need literal autism to "modify" some structures?
Like with monads, it's easier to start using them than to understand them. With monads, using them means you can use do-notation, and with optics you get OO-style field accessors. Once you have a feel for them you can start wondering about the mathematics, which isn't that hard at that point.

Not all monads can be monad transformers.

Idris, my dear, you have no ecosystem. But tomorrow I will have dependent types and you will still not have an ecosystem.

So your saying books on wood carving are impossible to write? As it's impossible to explain it with words?

when you wrap a static class around your object, it's that.

whats the side effect of the Maybe monad?

This is pretty great desu.

Thoughts on Haskell Book? Moronuki et al

Usefull for parsers untill people realised Applicative was enough for most cases.

include me in the screencap

Attached: asuka_towels_peace.jpg (320x240, 29K)

A monoid is a set of elements with one operation on the elements of the set and one neutral element.
For example natural numbers with addition as the operation and zero as the neutral element of adfition are a moboid.

>a monad is a monoid in the category of endofunctors
An endofuctor is a functor from and to the same category.
A functor is mapping from category to category.
A category simply said is a set or ring.
A monoid is nicely summed up by As such, a monad is a given set of endofunctors - one if which is the neutral element (probably the identity function) -, and a given operation that "works as" addition (likely function composition).

So, if you have a category, and a bunch of functions "in" it, a monad helps you compose them. Is that right?

Wait a minute: are monads just a shitty design pattern to allow IO interoperability in "purely" functional languages? this is fucking stupid

Monads can be used to accomplish impure operations in a pure language, yeah. But they're a lot more general.

Purity and functionality are different terms, as far as I know.

Pure --> no side effects.
Functional --> no sequences, only compositions (as opposed to imperative programming)

IO is kind of a type constructor to signal that given type is not pure, because there is a side effect (reading or writing). The functions that IO function composes are likely pure. And all of these are written in a functional language.

Not OP but way too fucking long and verbose.

Has it ever occurred to you that one can learn a programming language (or anything, for that matter) just because he enjoys it?
If everything you do revolves around getting jobs and making money, you need to heal yourself.

template haskell has great performance, it has terrible everything else

Where does the word "IO" appear in that post?
>Purity and functionality are different terms
They're the same literally by definition.

this meme is so stupid
there are so many things that can't be given layman explanations but people (experts) still can know and understand very much about

>explain in normal terms
He just did. Perhaps you meant in "dumbed down terms"?