3 ms·
Am I the only one who never tried Haskell but who when reading discussion about it ends up thinking real-world (with GHC extensions) Haskell has way too much (s
by BoingBoomTschak 2y ago
Am I the only one who never tried Haskell but who when reading discussion about it ends up thinking real-world (with GHC extensions) Haskell has way too much (sometimes historical) cruft? It really detracts me from it.
- kreetx 2y agoWhat cruft?
- tasuki 2y agoThe standard library is atrocious, mainly I believe for historical reasons: - map only works on Lists (one needs fmap for functors) - head throwing exceptions instead of returning Maybe - dependent types bolted on later: they're much nicer in Idris
- kreetx 2y ago- map is easier on newcomers. Once you you understand functor, you'll remember to use fmap anyway. Also, I still use map for lists after 10+ years. - I don't fully understand this, but do you mean that every `IO a` function would be better off being `IO (Maybe a)`? - AFAIK, there are no dependent types in Haskell yet, but say that the type level programming you can do today is what you mean then you are already in quite advanced territory. Yeah, I guess it could be more polished.
- tasuki 2y agoI mean that `head` should be `List a -> Maybe a` rather than `List a -> a`. If you really really want an `a`, you should provide `NonEmptyList a` or something.
- tromp 2y agoHaskell provides https://hackage.haskell.org/package/base-4.21.0.0/docs/Data-List-NonEmpty.html https://hackage.haskell.org/package/base-4.21.0.0/docs/Data-...
- kreetx 2y agoI agree! The current `head` should be renamed `unsafeHead` (or something), and the new `head` should have the type you wrote.
- tome 2y ago> head throwing exceptions instead of returning Maybe The choice is keep it is it is, or change it. Changing it would break vast amounts of existing code. Which option do you prefer?
- kqr 2y agoI think this was given as an example of necessary-but-annoying cruft, not as a suggestion for change.
- simonmic 2y ago“atrocious” ? I don’t think that’s any Haskeller’s experience. We can point to a few things we’d like to be different for modern Haskell dev, which are slow to improve because of legacy etc, and a certain fragmentation across different packages, but relatively speaking, base and other core libs provide a wealth of high quality, well documented, principled utilities.
- EE84M3i 2y agoExceptions n+k patterns Lazy IO
- Vosporos 2y agoIt's a thirty year-old language, it's bound to have cruft. However modern codebases tend to showcase a pretty efficient combination of language features, oftentimes optimised for productivity rather than research in lazy FP. Such codebases are https://github.com/flora-pm/flora-server https://github.com/flora-pm/flora-server or https://github.com/change-metrics/monocle https://github.com/change-metrics/monocle
- asplake 2y agoAm I right in thinking that there are efforts to provide a better out-of-the-box experience, with some of that cruft dealt with for people who don't need the backwards compatibility? For myself, I found long prologues of extensions/options/whatever massively off-putting.
- mrkeen 2y agoSure, use {-# LANGUAGE GHC2024 #-}
- aranchelk 2y agoIn practice it only detracts a little bit. You can enable GHC extensions project-wide and there are alternate standard libraries (preludes) that are more modern. If you want a language that is very Haskell-like without the historical baggage or the laziness, PureScript is very good. It’s main compile target is JavaScript, so it’s built for different use cases.