News for hackers. Stuff that matters.
Re:Reflecting on Haskell in 2017 by MBCook on Sunday December 03, 2017 @11:36PM (#15841474)
> Writing Haskell is almost trivial in practice. You just start with the magic fifty line {-# LANGUAGE ... #-} incantation to fast-forward to 2017, [...]

This was my biggest frustration with Haskell the last time I used it, I find it sad that it doesn’t seem like they’re trying to fix it.

Re:Reflecting on Haskell in 2017 by Tehnix on Monday December 04, 2017 @03:26AM (#15842444)
Haskell prime[0][1] is an effort to consolidate some of these features into "Haskell 2020" - so there is work going on in that regard.

Semi-related: I wanted to voice that while it can be tedious to enable extensions, what they do give us is a great way to explore several solution spaces without making the whole ecosystem commit to any in particular. Some become defacto, while some are more controversial and change the actual semantics of the language. The freedom to choose is both a burden and a gift though!

[0] https://prime.haskell.org

[1] https://github.com/haskell/rfcs

Re:Reflecting on Haskell in 2017 by tathougies on Monday December 04, 2017 @12:13AM (#15841602)
You can set all the flags in your cabal file. How is this not a fix? This is like specifying your compiler version.

We have a fairly hefty haskell code base at work, and we never use LANGUAGE pragmas anywhere.

Re:Reflecting on Haskell in 2017 by Tarean on Monday December 04, 2017 @09:33AM (#15844054)
There are some extensions like UndecidableInstances or OverloadableSyntax which are great in specific files but which would be awful in the entire codebase.
Re:Reflecting on Haskell in 2017 by MBCook on Monday December 04, 2017 @12:54AM (#15841765)
As a Java programmer, I don’t have to have the equivalent of 75 LANGUAGE pragmas to be able to use the features in Java 8 instead of what Java 1.1 shipped with.

It’s nice there’s a way not to put them at the top of every single file but they still exist.

There must be some reasonable subset that basically everyone uses and should just be included in the language.

Re:Reflecting on Haskell in 2017 by topogios on Monday December 04, 2017 @01:58PM (#15846437)
One of the declared goals during the initial design phase of the Haskell language was to "... be usable as a basis for further language research." From "A History of Haskell: Being Lazy with Class" available at https://www.microsoft.com/en-us/research/wp-content/uploads/.... Language pragmas feels like a nice tool to support this goal.
Re:Reflecting on Haskell in 2017 by Jaxan on Monday December 04, 2017 @02:17AM (#15842109)
I think the equivalent is packages which provide annotations. There are plentiful of such packed providing variations of "notNull". It seems even worse than extensions, as they are third party.
Re:Reflecting on Haskell in 2017 by marcosdumay on Monday December 04, 2017 @11:49AM (#15845258)
> There must be some reasonable subset that basically everyone uses and should just be included in the language.

Well, there is. The problem is that the last reasonable subset is 7 years old, and Haskell is evolving quickly.

There's a new standard scheduled to 2020.

Re:Reflecting on Haskell in 2017 by tathougies on Monday December 04, 2017 @06:57PM (#15848692)
There used to be -fglasgow-exts, but they removed that. I honestly don't really see the big deal. It's like feature flags for C or C++ compilers
Re:Reflecting on Haskell in 2017 by merb on Monday December 04, 2017 @05:50AM (#15842959)
actually in java you can have compiler extensions aswell. they are just not included by default.
Re:Reflecting on Haskell in 2017 by donovanm on Monday December 04, 2017 @01:33AM (#15841902)
Getting everyone to come to a consensus on what should or shouldn't be included would be very difficult. Then there's also the issue of backwards compatibility. At the end of the day they're opt in so you can just simply not use them.
Re:Reflecting on Haskell in 2017 by bunderbunder on Monday December 04, 2017 @10:21AM (#15844459)
Optimizing individually for every individual has a tendency to de-optimize the community as a whole.

This is one of those things that seriously limits Haskell's growth. It's something for new users to bounce off of, and that contributes to Haskell's reputation as a write-only language.

Re:Reflecting on Haskell in 2017 by tree_of_item on Monday December 04, 2017 @12:34AM (#15841687)
Hiding the ways in which your code isn't really Haskell (e.g. isn't going to be compatible with other random Haskell code) doesn't strike me as a fix. Why are there so many extensions in the first place?
Re:Reflecting on Haskell in 2017 by dualogy on Monday December 04, 2017 @02:02AM (#15842042)
"Extensions" has just turned out to be a sub-optimal moniker. They're not some third-party-compiler-plugins-to-be-installed-into-GHC, they're more like (rather involved) syntax sugars you can enable if needed. Each such "language feature" amounts to a tiny sub-compiler necessitating additional "core-to-core" and "core lint" (Core being the intermediate Typed Lambda Calculus representation all Haskell syntax sugars, built-in or "extension", compile down to) passes during compilation, which in GHC feels pretty sluggish to begin with.

So in pragmatic terms, enabling/disabling "extensions" lets you prevent some unnecessary processing loads during compilation.

Obviously one can do everything in "vanilla" (no-"extensions") Haskell just like one could express everything in raw Lambda Calculus. Syntax sugars as always allow for reducing patterns of verbosity --- those provided by "extensions" tend to be such patterns-of-verbosity that don't always occur in-all-projects-all-the-time, just in enough-projects-much-of-the-time.

Most of the aversion to them seems kneejerk "but my other language had another (or none at all) approach to this" --- never understood the strong opinions about GHC extensions. "Other-language" typically also delights in a culture of repetetively verbose syntax itself and no such APIs to hack new language constructs into the compiler in a plug-and-play manner (without forking).

And yes one can enable these via cabal file or GHC -X flags, but there's something to be said for per-module pragmas: they only activate where needed, and it aids the code reader as to what non-vanilla syntactic constructs are used in the-module-at-hand.

Re:Reflecting on Haskell in 2017 by tree_of_item on Monday December 04, 2017 @02:41AM (#15842238)
I'm aware that they're syntax sugar. I'm saying syntax sugar is bad. It's especially bad when there are dozens of mutually incompatible sugars. It's double especially bad when the base language is already one of the most complicated ones around.
Re:Reflecting on Haskell in 2017 by tome on Monday December 04, 2017 @03:31AM (#15842470)
> there are dozens of mutually incompatible sugars

If you think there are dozens then I challenge you to name a few ...

(I can't, off the top of my head, think of any but I don't deny there may be some.)

Re:Reflecting on Haskell in 2017 by njs12345 on Monday December 04, 2017 @07:05AM (#15843269)
The base language is actually very small - you do need to know a lot on top to get anything done but arguably that's true with most languages.
Re:Reflecting on Haskell in 2017 by tathougies on Monday December 04, 2017 @06:59PM (#15848706)
There are very few mutually incompatible sugars.
Re:Reflecting on Haskell in 2017 by tome on Monday December 04, 2017 @02:40PM (#15846763)
> Hiding the ways in which your code isn't really Haskell (e.g. isn't going to be compatible with other random Haskell code) ...

Haskell code with any extensions enabled is pretty much always compatible with Haskell code with any other extensions enabled.

(I only said "pretty much" to hedge my bets. I literally can't think of any case where extensions could make your code incompatible with other code across a module boundary.)

Re:Reflecting on Haskell in 2017 by MBCook on Monday December 04, 2017 @12:56AM (#15841776)
Honestly this bugs me too. I don’t really see why the community doesn’t just decide the GHC really IS Haskell.

I’m aware there are other compilers but basically everyone uses GHC. So all these things that have to be turned on because they’re not “compatible“ with all the other compilers that no one else uses just add complexity for new users (and I suppose current users.)

Re:Reflecting on Haskell in 2017 by marcosdumay on Monday December 04, 2017 @11:51AM (#15845266)
GHC or not, you simple do not want all the extensions active all the time.
Re:Reflecting on Haskell in 2017 by yorwba on Monday December 04, 2017 @01:40AM (#15841948)
But are all those options compatible with each other?
Re:Reflecting on Haskell in 2017 by jeremyjh on Monday December 04, 2017 @06:58AM (#15843241)
Yes they are but they may not be compatible with all existing code as it is presently written. For example turning on OverloadedStrings can introduce type ambiguity in existing code where the type of a string literal cannot be deduced.
Re:Reflecting on Haskell in 2017 by forkerenok on Monday December 04, 2017 @02:35AM (#15842203)
No, they are not, and some are useless

Edit: I guess not useless, but over time rendered as anti-features

Re:Reflecting on Haskell in 2017 by tome on Monday December 04, 2017 @05:22AM (#15842867)
Can you name some extensions that are not compatible with each other. I can't, off the top of my head, and I've been using Haskell for some years. (I don't deny there might be some, but I'm finding it hard to think of any.)
Re:Reflecting on Haskell in 2017 by shmish111 on Monday December 04, 2017 @11:05AM (#15844858)
GeneralizedNewtypeDeriving and DeriveAnyClass (although this is fixed in 8.2)
Re:Reflecting on Haskell in 2017 by jcelerier on Monday December 04, 2017 @04:37AM (#15842702)
yeah and we should also have decreted that IE6 was Internet in 2003 because that's what everyone was using too
Re:Reflecting on Haskell in 2017 by tome on Monday December 04, 2017 @03:31AM (#15842466)
If that's your biggest frustration then what a language!
Re:Reflecting on Haskell in 2017 by alien_at_work on Tuesday December 05, 2017 @07:56AM (#15851423)
I disagree with this, I like how it is right now. For certain kinds of code I need things like FlexibleInstances that I absolutely wouldn't want enabled everywhere. As it currently stands in Haskell I can turn it on only in the files that need it and it doesn't leak to the rest of the program. And having them at the top lets me know ahead of time that things I would normally view as syntax errors are in effect for this file.

The biggest complaints I see people make about Haskell are language extention lines and imports but for me these are both IDE issues. I'm not aware of many readable languages that end up with lots of imports for any non-trivial code.

Re:Reflecting on Haskell in 2017 by _sdegutis on Sunday December 03, 2017 @11:49PM (#15841514)
Yep. Here's an interesting list of extensions as of a couple years ago: https://www.reddit.com/r/haskell/comments/2z248l/language_ex... ... But that many extensions being pretty much necessary had definitely wore me down and turned me away from Haskell.
Re:Reflecting on Haskell in 2017 by nerdponx on Monday December 04, 2017 @12:10AM (#15841592)
What's the point of adding "optional" extensions, versus just incorporating them as features in later compiler versions?
Re:Reflecting on Haskell in 2017 by mrkgnao on Monday December 04, 2017 @04:48AM (#15842735)
Some extensions are considered bad ideas later, e.g. -XImplicitParams.

Some extensions can make existing code fail to compile, e.g. -XOverloadedStrings.

Some extensions are fairly specialised and their use can cause error messages that are confusing if you don't know what the extension does, e.g. -XAllowAmbiguousTypes.

Some extensions can cause certain pathological pieces of code to suddenly start behaving weirdly, e.g. if you turn on -XApplicativeDo for a type whose Applicative instance isn't lawful, but whose Monad instance is.

Of course, many, many extensions could be enabled by default without making the UX worse or restricting the set of allowed programs at all: a large section of Haskell users is likely in favour of enabling syntactic conveniences like LambdaCase or MultiWayIf, or automatic code-generation utilities like DeriveFoldable, DeriveTraversable, and so on. That's what Haskell Prime is for, I suppose.

Re:Reflecting on Haskell in 2017 by marcosdumay on Monday December 04, 2017 @11:53AM (#15845291)
And lets not forget about UndecidableInstances and its ilk, that enable amazing pieces of functionality if used well, but incredibly dangerous if you are not careful
Re:Reflecting on Haskell in 2017 by whateveracct on Monday December 04, 2017 @01:35PM (#15846260)
UndecidableInstances is actually not bad. I turn it on all the time and don't feel scared when I do. Worst-case, I write some bad instances and the compiler fails due to the recursion limit. IncoherentInstances is the one that really has no place since it can make code unsound.
Re:Reflecting on Haskell in 2017 by aetherspawn on Monday December 04, 2017 @02:26AM (#15842148)
Because sometimes you have to explore a space to figure out if it’s any good. No point arbitrarily adding stuff to the language if it doesn’t turn out to be that useful.

That’s how you end up with situations like ‘null’.

Some of these extensions are nuts, too. They can make the type system behave in ways where it basically has to multivariate solve or do things that are overly clever. You probably don’t want that most of the time..

Re:Reflecting on Haskell in 2017 by gizmo686 on Monday December 04, 2017 @12:26AM (#15841645)
Mostly politics. It is a lot easier to add opt-in features than get consensus to change the language.

Opt in extensions also allow you to avoid worrying about the longtail of backwards compatability.

Re:Reflecting on Haskell in 2017 by erik_seaberg on Monday December 04, 2017 @12:13AM (#15841605)
You might want to know which code is relying on an extension that's found to be a Bad Idea(tm) and rolled back or seriously changed.
Re:Reflecting on Haskell in 2017 by pjmlp on Monday December 04, 2017 @02:57AM (#15842317)
They were supposed to come out with an update to Haskell 2010, but I think the effort died.