5 ms·
A short list off the top of my head: It is very easy to get over eager and use more abstraction than you need or can handle. This is perhaps the worst of them.
by philzook 7y ago
A short list off the top of my head:
It is very easy to get over eager and use more abstraction than you need or can handle. This is perhaps the worst of them.
Strings shouldn't be [Char]. OverloadedStrings should be the default.
There are partial functions in base. head for example
It is easy to spring space leaks due to laziness.
Relatedly, choosing between foldr foldl foldl'
Incomplete pattern matching (which will be a warning) or sometimes default _ casing. If you add to the type, the compiler won't save you.
It is not necessarily so obvious to a beginner when you are doing tail call recursion.
Maybe overuse of typeclasses when records work better?
Over use of Template Haskell can raise an eyebrow.
A minority of extensions are ill advised.
All in all, I think the level of footguns in Haskell is in a different universe than C++, but I am trying to see it from the other perspective.
http://dev.stephendiehl.com/hask/#what-to-avoid http://dev.stephendiehl.com/hask/#what-to-avoid
http://dev.stephendiehl.com/hask/#the-dangerous http://dev.stephendiehl.com/hask/#the-dangerous
- tome 7y agoThanks and agreed! However, I was more asking for HelloNurse's opinion, since I can't think of any Python footguns that are on the same level as C++'s. The ones you cite are more on the level of Python's.
- HelloNurse 7y agoA nice article from slightly over 1 year ago https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated-guide-to-haskell-in-2018/ https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated... was linked on HN today. It explains organized footgun management, with a discussion of what language extension should and should not be enabled, and some specific library threats (e.g. String and ByteString).
- philzook 7y agoThat is an excellent article. String vs ByteString is a beginner footgun in Haskell. It won't make incorrect or crashing code, but it will show up as poor performance on text heavy processing.