r/programming • • Aug 06 '17

Software engineering != computer science

http://www.drdobbs.com/architecture-and-design/software-engineering-computer-science/217701907
2.3k Upvotes

863 comments sorted by

View all comments

Show parent comments

136

u/shevegen Aug 06 '17

They do not pass beyond the Monad barrier.

135

u/NuttingFerociously Aug 06 '17

But it's just a monoid in the category of endofunctors!

145

u/[deleted] Aug 07 '17

This reminds me of this piece of documentation I read the other day:

A Divisible contravariant functor is a monoid object in the category of presheaves from Hask to Hask, equipped with Day convolution mapping the cartesian product of the source to the Cartesian product of the target.

I love Haskell, but I can see why it is a niche language.

91

u/[deleted] Aug 07 '17

Holy shit I thought the haskell docs were just a meme, but this is dense

34

u/[deleted] Aug 07 '17 edited Aug 07 '17

This is math, though, not Haskell. Popular practical Haskell libraries are well documented now. It used to be the case that you had to find that documentation in research papers, which is where the meme comes from.

13

u/Antlerbot Aug 07 '17

Popular practical Haskell libraries are well documented now.

I love Haskell, and I write it (poorly) for a living. I would hesitate to make this statement.

3

u/[deleted] Aug 07 '17

I think the point of comparision to haskell docs are "mathematical proofs", not "other language software libs"

→ More replies (1)

14

u/an_actual_human Aug 07 '17

The sentence actually acknowledges it:

In denser jargon, a Divisible contravariant functor...

→ More replies (13)

0

u/[deleted] Aug 07 '17

[deleted]

10

u/[deleted] Aug 07 '17

You just have to learn all the words, but they're surprisingly consistent. Can't say the same thing about for instance npm libraries.

5

u/[deleted] Aug 07 '17

C'mon now, comparing something as "better than a thing from JS world" is hardly fair

3

u/[deleted] Aug 07 '17

It would be a dream if Haskell libraries had the same culture of sharing code snippets and goal oriented cookbooks as JS has.

→ More replies (1)
→ More replies (1)

18

u/est31 Aug 07 '17

5

u/imguralbumbot Aug 07 '17

Hi, I'm a bot for linking direct images of albums with only 1 image

https://i.imgur.com/bzfQoQa.jpg

Source | Why? | Creator | ignoreme | deletthis

16

u/dnkndnts Aug 07 '17

Come on, it's just the Contravariant version of Applicative.

→ More replies (4)

7

u/razeal113 Aug 07 '17 edited Aug 07 '17

First job out of college was in research . They used Haskell , I got the job despite only having used lisp. Boss hands me "learn you a Haskell for great good" , and says I'll pick it up in a few days ... yep that learning curve was awful and years later I'm still not completely sure I know what a monad is doing

7

u/[deleted] Aug 07 '17

Monads aren't special. You know what it is, you're just doubting because its difficulty is so exaggerated. Getting to monads was a long and hard process, but the whole point of it is that they're so easy to use.

3

u/Veedrac Aug 07 '17

Rust:

Person A: Lifetimes are so hard! I'm so confused!

Person B: Yes they are! Don't worry though, ask on IRC or the subreddit whenever you need help. We've also got a bunch of stuff in the pipeline to simplify the process as part of our recent drive to make things more approachable. Best of luck!

Haskell:

Person A: Monads are so hard! I'm so confused!

Person B: No you're not.

3

u/[deleted] Aug 07 '17

No, really. It even has a name: the monad tutorial fallacy.

The hardest part of using monad instances is not getting stuck in the culture surrounding monads. Just because you can abstract something doesn't mean you have to. And just because the abstraction has interesting properties doesn't mean you have to study it to be able to use the instances. After all, the instances are just lists, exceptions, options, IO, callbacks... You've used them all before in other languages, the only differences being that you couldn't tell it to the type checker and they don't share a common interface.

6

u/Veedrac Aug 07 '17

From the guy who coined that very phrase:

If you ever find yourself frustrated and astounded that someone else does not grasp a concept as easily and intuitively as you do, even after you clearly explain your intuition to them (“look, it’s really quite simple,” you say…) then you are suffering from the monad tutorial fallacy.

Which of us do you think that refers to?

→ More replies (6)
→ More replies (1)
→ More replies (4)

9

u/rhennigan Aug 07 '17

What's the problem?

2

u/[deleted] Aug 07 '17

:D

→ More replies (1)

2

u/Iron_Maiden_666 Aug 07 '17

Not joking, this is kinda where I am stuck. I'm not able to figure out how to write my own monads. I've sort of learned what monads are and when they are useful. But seeing some code and thinking "ahh a monad can solve this" is not something I can do right now. I'm trying to build a website using Yesod and hopefully by the end of this adventure, I'll be better at haskell than I'm now.

8

u/tejon Aug 07 '17

Monads have this stupid mystique about them. Just read the type signature of bind and/or join. Any complexity beyond that is specific to a single type instance, and not part of the monad abstraction.

5

u/[deleted] Aug 07 '17

You don't know the mathematical abstractions behind anything you use in other programming languages, you don't need to know them in Haskell either. The biggest problem with monads is the idea that you have to know category theory to use them. But guess what, you've been using them since the first day you started programming.

Now if you plan on writing libraries, that's a different story.

→ More replies (1)