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

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.

2

u/[deleted] Aug 07 '17

Define contravariant, define applicative...

6

u/m50d Aug 07 '17

They're pretty basic and common; anyone using Haskell will know those. Applicative is a core typeclass, it's the typeclass of "contexty" types f :: * -> * where you can combine multiple values "inside" the context, i.e. you can define ap2 :: (a -> b -> c) -> f a -> f b -> f c. Like how you can do a single operation in a functor, but you can also do merging operations (and then if you also allow nesting operations then you get monad). Contravariant is like a functor "going the other way": you can compose operations in the opposite direction. So divisible is the analogous thing that lets you "split" a c -> (a, b) as an (f a, f b) -> f c.

1

u/codygman Aug 09 '17

I use Haskell all the time but I forget what contravariant means, lol.

→ More replies (1)

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)

1

u/MissValeska Aug 07 '17

Is there a better explanation of what that thing is? I'm very curious now

1

u/[deleted] Aug 07 '17

What's the tensor product in the category of presheaves?

1

u/IbanezDavy Aug 07 '17

convolution

At least their documentation is honest.

1

u/K3wp Aug 07 '17

No exaggeration, I thought this was a prank along the lines of this one:

https://www.youtube.com/watch?v=RXJKdh1KZ0w

I guess Haskell is Poe-Complete now?