5 ms·
> Writing Haskell is almost trivial in practice. You just start with the magic fifty line {-# LANGUAGE ... #-} incantation to fast-forward to 2017, [...] This
by MBCook 9y ago
> 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.
- _sdegutis 9y agoYep. Here's an interesting list of extensions as of a couple years ago: https://www.reddit.com/r/haskell/comments/2z248l/language_extensions/ 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.
- nerdponx 9y agoWhat's the point of adding "optional" extensions, versus just incorporating them as features in later compiler versions?
- erik_seaberg 9y agoYou 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.
- gizmo686 9y agoMostly 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.
- aetherspawn 9y agoBecause 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..
- mrkgnao 9y agoSome 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.
- marcosdumay 9y agoAnd 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
- whateveracct 9y agoUndecidableInstances 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.
- tathougies 9y agoYou 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.
- tree_of_item 9y agoHiding 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?
- MBCook 9y agoHonestly 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.)
- yorwba 9y agoBut are all those options compatible with each other?
- forkerenok 9y agoNo, they are not, and some are useless Edit: I guess not useless, but over time rendered as anti-features
- tome 9y agoCan 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.)
- pjmlp 9y agoThey were supposed to come out with an update to Haskell 2010, but I think the effort died.
- Tehnix 9y agoHaskell 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 https://prime.haskell.org [1] https://github.com/haskell/rfcs https://github.com/haskell/rfcs
- tome 9y agoIf that's your biggest frustration then what a language!
- alien_at_work 9y agoI 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.