Hacker News new | ask | show | jobs
by mrkgnao 3247 days ago
The solution isn't more "pragmatism", it's an actual "incredibly powerful type system" like Haskell's. In my projects JSON decoding is just

    instance FromJSON Foo
and that's it.
2 comments

It's the same with `rust` and `serde`; it's a great feeling!
I can imagine :) I think over in Rust-land it's something like

   #[derive(FromJSON)]
isn't it?

  #[derive(Serialize, Deserialize)]
but yeah, same difference.
Ah. That derives both "ToJSON" and "FromJSON", as Aeson calls them. Cool!
Yeah, and it's actually more general than that: it describes how to serialize and deserialize them generally, so you could use, say, serde_json to get json, or serde_yaml to get yaml.
Huh, nice.
Nope. The solution is actually "more pragmatism", not "here's a thing that requires a PhD in type theory to understand".
Type classes are basically interfaces from Java. I'm guessing from your other comments that you know Java (and have read LYAH), so this is actually trolling. The majority of people writing the goddamned Haskell compiler don't have PhDs, they're people using it in industry.
"People using something in industry" is rarely an indicator of anything, really.

Industry uses everything and anything. Heck, Javascript is (arguably) world's most popular programming language, used everywhere.

Haskell is used by Chase Bank. J and K are used by banks (J is used by SAP AFAIK). There are stories of Smalltalk running entire factories. There's Active Oberon in a nuclear plant in France. Excel is the world's most widely used FRP environment (unsurpassed, I might add, by anything anyone can offer).

For almost any programming language you name, I will probably find examples of people using it in an industry somewhere, no matter how good, or bad, or obscure, or popular, or well designed, or badly designed a language is.

"You need a PhD in type theory" is a hyperbole which I use to say "to proceed to any advanced level in Haskell you will need to dive quite deep into type theory as it's highly likely you will not even understand how most of the libraries you use work. Most of documentation and material around Haskell is riddled with incomprehensible jargon that often assumes the reader is already versed in any number of obscure Haskell things. Haskell has always been and remains a language designed to specifically test multiple theories of language and types design, and will remain such a language for a foreseeable future, no matter how people try to make it 'more approachable' or 'more pragmatic', and no matter how many people 'use it in the industry'."

> Haskell is used by Chase Bank.

Also a ton of other financial services companies: Morgan Stanley, Standard Chartered, and so on. Facebook has, in the recent past, hired a lot of well-known Haskellers. Bunch of hedge fund-ish things do too. Jane Street uses OCaml and does a lot of AdWords targeting at Haskell users :P

I don't know a shred of "type theory" (although I'm interested): you probably mean something else. Monad transformers aren't even categorical abstractions; they evolved from the needs of Haskell users.

> Haskell has always been and remains a language not opposed to testing multiple theories of language and types design

There, fixed that for you. Seriously, why don't you make a good-faith effort to dive into Haskell (as opposed to learning just enough of the jargon to be able to troll with apparent seriousness) before lambasting the things that make it a joy to work with?

> why don't you make a good-faith effort to dive into Haskell (as opposed to learning just enough of the jargon to be able to troll with apparent seriousness)

Why don't you make a good-faith effort to assume that your opponent has actually done some good-faith efforts?

99% of Rust programmers don't have PhDs, I'm sure, and yet they use typeclasses (called traits in Rust) just fine...
At this point you just sound like a troll.
Nope. It's a genuine feeling.

Basically, in an ideal world we would have a "pragmatically typed" programming language. Basically something in between "weak dynamic typing of Javascript" and "strong static typing of Haskell".

No such language currently exists, and this makes me sad. It's also hard to come up with a proper definition for such a language :)

> Basically, in an ideal world we would have a "pragmatically typed" programming language. Basically something in between "weak dynamic typing of Javascript" and "strong static typing of Haskell".

Souunds like one of the many strong dynamic languages with optional static typing/typechecking.

Yeah. I like approaches taken by OCaml/ReasonML and Typescript. But they are not without their warts :)
> Nope. It's a genuine feeling.

That's not exclusive with being a troll.

> Basically, in an ideal world we would have a "pragmatically typed" programming language.

Yes, it's called Haskell. Or, if you don't like purity, either OCaml or F#.

I strongly believe Haskell is very very far from being a "pragmatically typed" language.

This reminds me, I need to write a blog post (which is tangentially about Haskell, but mostly about statically typed languages)