116 points · by amalinovic · 3y ago · 62 comments
I think the author is just writing down their opinions (which are worth discussing!) and not seriously trying to start a new GHC frontend. Personally, I think Haskell is approximately stuck in a local maximum, which can only be escaped by embracing dependent types (which are actually simpler than where Haskell has been heading) rather than building increasingly complex approximations of them. Once you try a dependently typed language like Agda, Lean, Coq, or Idris, it's hard to go back to the complexity of having two (or more!) separate languages for types and programs.
Regarding the proposals in the article, the most interesting to me is (2), although I'm not sure about some of the specifics. In general, I think Haskell needs a way to graduate (or retire) language extensions, rather than having them accumulate unboundedly. It's harder to talk about Haskell when everyone is using a different flavor of it.
To give a counter point, there seem to be lots of small wins that aren't taken, possibly in part because people seem to wait for the big ideas.
Take partial functions like head: You can do what Haskell and Java do and throw an exception. Or you can have dependent types and statically prevent the function from being applied to an empty list. But the obvious and easy solution in the current language would be to return Maybe, which isn't done because there's a feeling that it's not a big enough step to be worth the effort, and dependent types will eventually solve this anyway.
That's not why it's not done. listToMaybe already exists[1] and you can't change the type of head without breaking everyone's code, so head in the next version of base will come with a warning[2] and that's about as much as you can do whilst still maintaining backwards compatibility.
[1] https://www.stackage.org/haddock/lts-21.14/base-4.17.2.0/Dat...
[2] https://github.com/haskell/core-libraries-committee/issues/8...
This is all tied into how inflexible the base/Prelude story is currently, etc. If the Prelude were a fully independent library where you could just depend on any old version you like, then there'd be no problem changing the signature. (Other than the usual diamond dependency problems). Of course you can choose NoPrelude and go from there, but then you're already in a place where changing 'head' doesn't matter to you, only the maintainer of your alternative Prelude.
People are working on both of these aspects, and that's got me really excited about where Haskell is going these days!
(I've always loved Haskell as a language, but there have been undeniable ecosystem issues.)
(I do see how a function like that is useful, but I don’t think it’s a good replacement for head.)
Something is eventually going to pattern match on it. But it might well be some handler way way up at the top of my program, and all I want to do right now is `map` and `bind` as normal.
That is what the standardization process is for. I don't think that the parties that could write a new Haskell standard have the time, resources, or bandwidth to work on one. That's why for now we're stuck with 98, 2010 and a bunch of extensions.
It’s just really, really expressive without trying to solve the halting problem via some unification failure mode.
Type classes and GADTs already give you 10x the canvas you can get without trouble anywhere else, and if you keep it tight, you have the tooling to really tune it up.
Idris is awesome, do that if you’re doing that. Haskell is changing all the time: it became a serious production tool: I’d really like for it to stay one.
very much second that! haskell has band-aid type-level programming that is so awful, but sometimes so useful, that it's really hurting a lot. I would just really like to deprecate type-families and would like to see as a the first step some non-dependently typed type-promoted functions. There's a great, pragmatic, proposal I would really like to see implemented. I, personally, don't need dependent types thaaaaaat much but type families are so unergonomic and really a dead-end I think. It's just stupid.
it's sad to see that the dependent haskell progress is losing steam and, as it is my impression, getting maybe a bit lost in the weeds?
That sounds like the Extension lifecycle framework proposal https://github.com/ghc-proposals/ghc-proposals/pull/601
Another minor thing that happens to annoy me very much is how everything about Haskell's syntax and standard conventions is so diff-unfriendly.
To see what I mean, I picked the first "official" example I could find. Here are a few lines of code from the one of the examples in the Haskell playground (https://play.haskell.org/ -- it seems to pick a random one each time you load it):
data Visitor
= Member Profile
| NonMember (Maybe T.Text)
deriving Show
data Profile =
Profile
{ name :: T.Text
, birthday :: Time.Day
} deriving Show
You see Haskell code like this all the time, and the (IMO old-fashioned) lack of an optional trailing comma practically forces you into something like this. But just imagine inserting another variant to Visitor before Member, or removing the name field from Profile!A more practically minded language might allow a syntax like this:
data Visitor =
| Member Profile
| NonMember (Maybe T.Text)
deriving Show
data Profile = Profile {
name :: T.Text,
birthday :: Time.Day,
} deriving Show
Bamm, each line is identical, editing is easy, diffs are clean. TypeScript, for example, has something like this for union types. Haskell unfortunately doesn't.Back when I first learned Haskell, I strongly got the impression that the Haskell community just... didn't like programming? I kept running into endless papercuts like these, language extensions which were poorly documented and mutually incompatible but basically mandatory due to widespread usage, and libraries which were considered "top-of-the-line" but where anything beyond the happy path was considered an open research topic.
All in all, it felt more like a loose collection of unfinished PhD theses than an actual programming language. Which is a real shame, because it has quite a few excellent concepts which are a genuine pleasure to use. Unfortunately I think languages like Rust and F# are essentially killing any chance it has at gaining a mainstream foothold: they bring over enough of the good parts of Haskell into mainstream programming that it simply isn't worth having to deal with the bad parts anymore.
I often hear complaints about mutually incompatible language extensions, but when I aske I hardly ever find anyone who can name two! Can you?
I can't think of anything else that could be incompatible. I would also disagree GP's claim that extensions are poorly documented. GHC is very well documented, including all its extensions.
In my particular case I would also prefer for that subset to be chosen with a conservative and considerably less PLT-enthusiastic mindset, i.e. bog standard `RIO` style that prefers imperative code working on bags of mutable values of different types when solving problems.
But yeah, Haskell is a wide language and that's why it's so hard to adopt. People tend to learn ostensibly the wrong things, oftentimes from people who've never actually written any real production code but like to theorize and hypothesize about "the best pattern for X" and so on.
This is such a peculiar value judgement, and for the life of me I can’t work out what leads you to think this way.
If you don’t like Haskell, that’s fine. You don’t have to. But people who work with Haskell are generally happy and productive, just like most other programmers in most other general purpose programming languages.
I suspect what is being referred to is that many Haskell people have a very strong academic background and are much more interest in working on Haskell rather than using Haskell to write 'normal' programs.
That's the problem: I do like most parts of Haskell! It's a language I really want to use more often, as many parts of it are miles beyond most other languages. Just the fact that it has proper first-class support for tagged unions makes programming an absolute joy.
All the "introduction to Haskell"-level stuff made me fall in love with the language, and I basically wanted to rewrite all my code into Haskell. But then I started trying to actually write production-level code and engage with the larger ecosystem, and I basically drowned into a marsh of incomprehensible language extensions which were somehow required for pretty much every single library - and more than once I ran into severe project-breaking design limitations only after investing dozens of hours into the library.
There are plenty of languages I really can't give a rat's arse about, but I like Haskell too much to just ignore it. To me Haskell is the one that got away, and I am eagerly waiting for someone - like this project - to essentially create a "Haskell for programmers".
Yeah, to me Haskell is the experimental forefront of programming language theory and the most developed concepts get incorporated into the actual programming languages over time.
I’ll note that in Haskell circles, the usual proposal is a leading comma, which would look like this:
data Profile =
Profile {
, name :: T.Text
, birthday :: Time.Day
} deriving Show
The commas essentially end up like bullets — a style I thoroughly like. data Profile =
Profile
{ name :: T.Text
, birthday :: Time.Day
} deriving Show
(You can't write `,` directly after `{`.)This is also why the commas are _not_ like bullets, no matter how you format them. The first one is always special.
I agree that somebody should make a language extension that allows what the parent posts says.
Doing this does not need a language split / new frontend; this is what language extensions do very well. If they are popuplar, they become part of a new (de-facto) standard, such as GHC2021: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/cont...
And there is precedent for this: There is one place where trailing commas for good diffability are already allowed: Module exports.
module MyModule (
fun1,
fun2,
main,
) where
Many language extensions exist to remove such "papercuts"; this looks like a good candidate. the usual proposal is a leading comma
You're right that it's not valid Haskell but that wasn't the goal here.(I'm not only talking about ReasonML, Reason, ReScript etc. There was a more officially proposed revised syntax too: https://caml.inria.fr/pub/old_caml_site/camlp4/tutorial/tuto...)
Haskell-like syntax, row polymorphism, nice interface for records. Warts removed from standard libraries. Everything is a total function, but otherwise names and type signatures will be very familiar. Strict evaluation. The primary compile targets is JavaScript, second most popular is Erlang. Excellent FFI.
1. decide on a decent non GHC extended standard. (maybe the last one was good enough? not been following)
2. build out a decent standard library to cover all the usual things from datetime handling to web serving without using GHC extensions
Then let everyone use that
Even better have a JVM/CLR type target for syntax experimentation. I think they have this already.
This should really by going though proposals 1 by 1. Not as a features-someone-likes.
Cons list syntax is the worst proposal
[1]:https://hackage.haskell.org/package/ListLike-4.7.8/docs/Data...
Seriously? Mainstream languages are busy adding tuples because they make code so much cleaner when used appropriately. Leaving them out of Simple Haskell™ would be a big mistake, IMHO.
Dollar signs are so noisy and opaque.
mySet
toList mySet
reverse . toList mySet
reverse . toList $ mySet
The first three look pleasing to the eye, but the fourth is ugly. I want to write the third one, not the fourth. (reverse . toList) mySet
Or: let fun = reverse . toList
in fun mySetIt was Haskell with S-Expressions (Lisp like) as it's front end.