17 ms·
Why does Haskell, in your opinion, suck?
- bojo 11y agoVery interesting and constructive thread. A lot of information about various Haskell warts, problems people have, and possible solutions to overcome some of them.
- zzzcpan 11y agoMost of these apply to other languages as well: "Haskell sucks because compilation takes too long." "Aye. And it takes too much memory too." "My major gripe with haskell was that I could never tell the space/time complexity of the my code without serious analysis (that among other things involves second-guessing the compiler's ability to optimize). This makes writing good quality code harder than it needs to be." "Debugging boils down to wolf-fences and print-statements most of the time" "Profiling is needed for any stack traces, and is not enabled by default, so you end up spending hours rebuilding your sandbox just to get a stack trace of an error." "Coming from a Scala background, the tooling seems terribly cumbersome and immature. I couldn't get it to work in IntelliJ." "You need to turn on dozens of language extensions to do pretty much anything." "I'm a developer on a pretty large Haskell codebase, and we're in a corner of 'can't add any libraries without them conflicting with each other." Which is OK, by itself, but leads to my biggest complaint of 'why aren't API changes reflected by major/minor versioning'." "Haskell sucks because both the standard library and the ecosystem lack guiding ideas."
- YeGoblynQueenne 11y agoFor those who, like me, wondered what wolf-fencing is: "Wolf fence" algorithm: Edward Gauss described this simple but very useful and now famous algorithm in a 1982 article for communications of the ACM as follows: "There's one wolf in Alaska; how do you find it? First build a fence down the middle of the state, wait for the wolf to howl, determine which side of the fence it is on. Repeat process on that side only, until you get to the point where you can see the wolf."[10] This is implemented e.g. in the Git version control system as the command git bisect, which uses the above algorithm to determine which commit introduced a particular bug. [https://en.wikipedia.org/wiki/Debugging https://en.wikipedia.org/wiki/Debugging] So now you know what that thing you always end up doing is called :)
- manojlds 11y agoSo, binary search? Why did a new name come up for this well known thing in CS?
- vog 11y agoBisection is also a well-known term, in mathematics as well as computer science.
- tedmiston 11y agoWolf fencing is new to me too. It seems to be used only in the context of debugging. While with git bisect, we are also repeatedly ~halving the remaining search space, the list of commits isn't "sorted" like the precondition for binary search. You could argue that commits are sorted against time. But I would say that's different because we don't know which commit hash we're looking for -- we just want to find the point in time when our code stopped working, not that I've ever had to use it before ;).
- vog 11y ago*> the list of commits isn't "sorted" like the precondition for binary search. Good point. One may think that in some sense, it is sorted: The history is sorted into "good" commits (before the bug was introduced), which are followed by "bad" commits (after the bug was introduced). However, the bisection algorithm also works if "good" and "bad" commits are mixed. Even then it will find one commit where the bug was introduced (although there may be other places where it had been fixed and later reintroduced). This works because bisection doesn't require a sorted list, it just needs a continuous function. And any sequence is just a special case of that.
- x1798DE 11y ago> However, the bisection algorithm also works if "good" and "bad" commits are mixed. Even then it will find one commit where the bug was introduced (although there may be other places where it had been fixed and later reintroduced). I don't understand this comment. Need for sorting the list is essentially the same in both cases, because "the bug was reintroduced" is essentially equivalent to "a lower number showed up later". A binary search makes the assumption of sorting because it's premised on the idea, "Whatever number I find, every number that comes after it will be larger". Same with bug-finding in a git history, it assumes "If I find a point in the history where the problematic behavior exists, it exists at all points after that for the same reason." If you had an "unsorted" history where a bug was fixed and then reintroduced in another way, your binary search may fail to find the immediate cause of your problems in the same way that an "unsorted" binary search would fail to find what it's looking for.
- hacker_9 11y agoI think this shows that the tooling is just as important, if not more important, when choosing a language. Good debugging tools are a must simply because things always go wrong, and if I don't have an IDE that can highlight the line for me and allow to mouse hover over variable values, then the whole experience becomes a lesson in frustration. Additionally if you expect me to 'write, build, run, repeat' just to test my code, then you better hope you have a fast compiler else I'm going to start associating using your language with the same amount of interest as watching paint dry.
- marcosdumay 11y ago> if I don't have an IDE that can highlight the line for me and allow to mouse hover over variable values, then the whole experience becomes a lesson in frustration. What does that even mean in a language with no explicit model for code sequencing?
- nightski 11y agoWell Haskell has a well defined execution order. I think the large problem is that compiled Haskell doesn't represent the original source at all making this tricky if not impossible.
- marcosdumay 11y agoThe execution order is only defined on the IO monad or when there is data dependency. Independent chunks of pure code can be executed in any order.
- deleted 11y ago[deleted]
- nightski 11y agoThe key word being independent. There is still a natural baked in dependency ordering. That is all that I meant. I realize I could of phrased it better.
- sisu 11y ago"My major gripe with haskell was that I could never tell the space/time complexity of the my code without serious analysis (that among other things involves second-guessing the compiler's ability to optimize). This makes writing good quality code harder than it needs to be." This problem is significantly worse in Haskell than in most other languages. Usually you lose at most a constant factor in performance if the compiler doesn't optimize as much as you expected, but the lazy evaluation can actually change the asymptotic memory complexity. I have been bitten by lazy evaluation several times by writing code that I expect to run in constant space and then finding it require linear amount of memory because of the evaluation order.
- vog 11y ago> My major gripe with haskell was that I could never tell the space/time complexity of the my code without serious analysis This is really a serious issue. The only other language where I ever had this issue was SQL. I had a project where we have lots of nested Views. We had to rephrase the SQL in sometimes very non-obvious ways, introducing intermediate Array results, CTEs, switching between sub SELECTs and JOINs -- all this just to convince the Query Planner to use a different Query Plan. That made a difference between < 1 second or a few minutes. In the end, this is why I prefer languages OCaml or SML over Haskell. (Rust on the horizon) Roughly speaking, in Haskell you can prove "just" correctness, while in OCaml you can prove correctness as well as performance.
- revelation 11y agoOf course they do. The point here is exactly that all of those things apply to Haskell, simultaneously.
- dllthomas 11y agoAnd yet, most of us posting these things still choose Haskell.
- js8 11y ago"My major gripe with haskell was that I could never tell the space/time complexity of the my code without serious analysis (that among other things involves second-guessing the compiler's ability to optimize). This makes writing good quality code harder than it needs to be." It seems to me that there is some connection/analogy with garbage collection. Garbage collection also makes reasoning about space usage of programs difficult, since it happens in some future, yet unspecified, time. Yet GC is almost always regarded as good (although historically there was a lot of fight against it), yet lazy evaluation is regarded as bad by many. Maybe the issue really is "good enough compilers"?
- neutronicus 11y agoIt's really easy to fuck up what will be evaluated, when, and wind up with disastrous performance ramifications. As an example, I wanted to accumulate a list of summary data as I iterated through a recursive function. Through a coding error, the elements of the list (although not the list itself) were not evaluated until all the iterations were complete. This meant that, instead of a list of structs, which I thought I had, I had a list of zero-argument functions that, when called, would yield structs, _each of which contained a reference to a large array computed at an earlier iteration of the computation_. So, I hemorrhaged space. This was a fuck-up, not a missed optimization.
- Peaker 11y agoIt is similar to garbage collection, but maybe an order of magnitude worse. The benefits of lazy evaluation are also very nice, though.
- angerman 11y agoHaving these kinds of threads, I think, is very important for the community. On a related note, there has been quite some fallout from the haskell compilation times got worse thread, which resulted in the development of tooling around improving the situation.
- tome 11y agoI agree. Thanks to everyone contributing ideas!
- amelius 11y agoMy biggest complaint would be about incomplete documentation of GHC. Given that Haskell is a pure functional language, it should be possible to easily use any part of the compiler, and include it in your own project. However, the documentation is rather incomplete, difficult to understand, and always behind the current state of the code. That said, the scientific literature on Haskell is the complete opposite, and contains beautiful work. Also, I'm wondering why there are so few fully compliant implementations of the internet RFCs. Such specs seem an excellent opportunity to showcase the power of functional languages, yet the implementations keep lacking.
- lallysingh 11y agoI haven't found a language where that isn't the case.
- TheEzEzz 11y agoThe Roslyn C# compiler is exposed as various libraries (and is open source) and is quite nice to work with. I was able to utilize it to make a C#-to-HLSL/GLSL compiler fairly easily.
- nemoniac 11y agoYou should check out Scheme. It has thorough documentation even including a complete formal denotational semantics.
- nickpsecurity 11y agoOberon... maybe VLISP Scheme.
- POSIXprog 11y agoBryan Cantrill's take: https://youtu.be/0T2XFSALOaU?t=2021 https://youtu.be/0T2XFSALOaU?t=2021 My answer would be lazy evaluation by default. It's extremely unusual, and I've never seen a convincing enough justification for it, and it gives rise to performance bugs (space leaks) that can be fiendishly difficult to track down and fix and are disastrous in production. With the arrival of Idris, I think we can pretty conclusively say this was a mistake and that the Miranda branch of the PL family tree is likely to prove to be an evolutionary dead-end.
- Tyr42 11y agoMy perspective on this is that lazy be default made sticking to purity much more compelling as if you just dropped print statements in you weren't sure exactly when they get evaluated. This lead to important developments like IO (they started with user input just being a lazy list! Very possible to accidentally block trying to read too much), which might not have happened otherwise. But now, I do feel like lazy is best kept for core data-structures and places where you know you can use it, and a strict by default variant of Haskell would be better, now that we have learned most of the lessens from lazyness.
- oldmanmike 11y ago"My perspective on this is that lazy be default made sticking to purity much more compelling as if you just dropped print statements in you weren't sure exactly when they get evaluated." And that's basically a death sentence to the feature because it reduces it to a silver lining of desperate post-mortem optimism. As far as my understanding goes, lazy evaluation was originally included in the language because it was perceived to be a powerful optimization technique enabled by pure functional programming. You reduce the amount of work a program is doing dynamically at runtime while not trading off on readability or modularity. All win. Except there were subtle trade-offs that have made themselves clear over the years and like you said, most would agree that lazy-by-default is too extreme of a feature and doesn't really pay its share of the rent at the end of the day. My main gripe with lazy evaluation is that it's implicit behavior. It's to evaluation what garbage collection is to memory or dynamic types are to types. It hides something from the programmer that is useful to know more often than not.
- YeGoblynQueenne 11y ago>> Haskell sucks because both the standard library and the ecosystem lack guiding ideas. The former often feels like it is an amalgamation of PHD theses that have been abandoned soon after being complete. That's a bit on the nose. [1] [1] As in "ouch".
- Findeton 11y agoI just prefer to use languages without a Garbage Collector.
- njharman 11y agoMan! I'd never want to code in language that forces me to manage memory. A boring, solved problem the compiler/run time should handle for me.
- Peaker 11y agoI enjoy both kinds of languages. I do think garbage collectors are overrated. When using certain styles in C or C++, memory management is really a tiny aspect you have to spend a tiny minority of your time thinking about -- but you gain so much determinism of execution in return. I've been burnt by garbage collection killing my programs' performance many times -- having to tune the garbage collector has taken more time than just writing manual memory management in some cases! Also, dynamic memory allocation and garbage collection just injects so much dynamism and uncertainty in your program's execution. I dislike it for the same reason I dislike dynamic typing. I want to be able to statically reason about the resource use of my program, just like I want to statically reason about any other aspect of my program.
- njharman 11y agoDeterministic! My usual coding projects (distributed, networked, multi-process/multi-thread) are so far from determinism and my problems so many levels above the concerns of C/C++. Both are needed. Just saying I'm glad other devs work on the lower level stuff for me ;)
- Peaker 11y agoNon-determinism comes in many forms. I don't think it's an all or nothing thing. Eliminating non-determinism is always nice, even if lots of other non-determinism remains. Having predictable and understandable resource use is a nice plus. Removing dynamic memory allocation also tends to increase locality, remove indirections, and remove error handling paths from your code.
- akavel 11y agoHaven't seen it listed neither here nor there, so not sure if I'm the only one, but: for me, the first and currently blocking obstacle is of "graphical" syntax. I'm of the kind of people who hear the words they read as a voice in their head, so when every line is interspersed with multiple "random" <:> >>= <=< @>-,-'-- and whatnot other ascii-art I can't verbalise, I distictly feel my brain stumble, mumble, and grind to a halt and sad emptiness. And I don't even know how to google any one of them. Don't know how to solve this for myself. I've once found a list of suggested names for some common ones, but - I don't like having to learn all that by heart before I even start with the language; and also I feel pretty certain those are not all, and many libraries seem to like to invent their own new ones, so back to square one. That's I believe the main reason I find SML more attractive: it seems to use operators to a much, much lesser extent, apparently preferring alphanumeric function names in the core, and in 3rdparty libraries too.
- dllthomas 11y agoIf you find yourself needing to read Haskell, feel free to ask others how they pronounce things.
- jgallag8 11y agoHoogle could help with the searching problem: https://www.haskell.org/hoogle/ https://www.haskell.org/hoogle/
- akavel 11y agoNice to know. Still, no spelling there, as far I can see. And no docs or examples either, apparently: https://www.haskell.org/hoogle/?hoogle=%3E%3E%3D https://www.haskell.org/hoogle/?hoogle=%3E%3E%3D is still a problem for me
- bojo 11y agoOne additional click on any of the links (usually the function name) brings you to the actual documentation. https://hackage.haskell.org/package/base-4.8.2.0/docs/Prelude.html#v:-62--62--61- https://hackage.haskell.org/package/base-4.8.2.0/docs/Prelud... Edit: Granted ">>=" (bind is the word you are after) is kind of special and you need to understand more of the underlying language mechanics to get it. The provided explanation tells you little unless you can grok the function signature. I think it's almost universally accepted that a lot of the documentation is atrocious.
- bernalex 11y agoHallo. I see some of you are listing things here. It really would be very helpful to me if you could list them on Reddit as well, using the format of the thread, so that I only have one source to deal with. I don't mean to instigate any Reddit vs. Hacker News rivalry, or whatever, but I just don't have time to go over several sources for my talk and PDF. So this is just a tip for if you want me to include your Haskell "complaint". Glad to see the thread has sparked discussion here too!
- virmundi 11y agoMine is that it's built on a lie. A nobel lie, but a lie none the less. In order to be pure it has "stop the world and record it" with monads to do any IO. It pretends that the world can be snapped shotted and immutable. In reality the monad is only an extra box with a belief that the world stops. The world in fact does not.
- tome 11y agoNope, that's not what it is at all. IO is "just" an effect tag.
- eveningcoffee 11y agoWell, you can argue that you at the given moment are not the same you a moment ago. You can perceive yourself moment ago exactly because of that. Others who have not seen you recently hold the old reference to you. I would rather say that the world is naturally immutable.
- solidsnack9000 11y agoThe IO monad doesn't involve actually recording anything...it's not like MVCC. What are you actually trying to say here?
- virmundi 11y agoIt's that a monad looks pure, but actually isn't. Call addition with the same args and you should get the same answer. Calling next on a stream of io is destructive.
- Peaker 11y agoIf you call 'next' on an IO stream, you always get the same answer, an IO effect which, when executed, would destructively get the next item: next :: Stream a -> IO a The function part is pure. The `execution` of the resulting `IO a` action (which is completely separate from its pure evaluation) is not.
- solidsnack9000 11y ago
- johan_larson 11y agoHaskell sucks because you can't really get anywhere before understanding monads well, and monads are (take your pick) a) too hard for most programmers, or b) too distant from the abstractions used in most programming languages. Not that's you're done mastering Haskell when you've figured out monads, of course. There are plenty of harder abstractions running around. But monads are the orgo of Haskell, the place many earnest dreams go to die.
- devishard 11y agoThis would be a reasonable critique except that monads are really why Haskell ends up being so powerful and composable. Sure, they can be tough to wrap your head around, but without them Haskell wouldn't be particularly special or useful.
- pron 11y agoIt's more complicated than that. Monads don't make a language more powerful, but they are an absolute necessity given Haskell's design, which is built around extensional/value semantics, which basically approximates a program/subroutine as the function it computes; this is a useful approximation as it lets us treat computations as if they were referentially transparent. That approximation has a cost, though, as computations are not quite functions (they are processes that compute functions), and while the approximation works well enough much of the time, some things require recapturing the more accurate definition of computations as continuations (i.e. a computation can block and then resume). If your language does not have continuations, only functions, monads achieve the same thing. If, OTOH, your language has continuations (as most non-pure languages do, although most don't have reified continuations, which are just as "programmable" as monads only more composable), monads don't really help. See http://blog.paralleluniverse.co/2015/08/07/scoped-continuations/ http://blog.paralleluniverse.co/2015/08/07/scoped-continuati...
- Peaker 11y agoIt's not really Monads making the language more powerful. It's the taking away of non-pure primitives and libraries -- and replacing those with type-labeled effects. That these effects are composed monadically is a minor detail and unfortunately the thing that's emphasized. Haskell gains power in its framework for restricting code. In Haskell, you can know so much about what code doesn't do -- and that's what makes Haskell special and powerful compared to other languages. You have to explicitly opt out of these restrictions - making the majority of code easier to reason about, simply because there is so much it cannot do.
- devishard 11y agoI agree with the poster complaining about the wide variety of symbolic operators: readability becomes extremely important as programs grow large, and Haskell simply doesn't have it. Lazy evaluation really doesn't pay off in my experience. Any major Haskell program turns out off for performance reasons. And when you don't, performance isn't the only problem: lazy programs often produce really inscrutable errors.
- denim_chicken 11y agoHaskell sucks because mutability and strictness are extremely important for writing large complex programs, and Haskell deliberately makes both of these things inconvenient. Also, Haskell's ecosystem and tooling is still crappy, probably because writing complex programs in Haskell needlessly difficult (due to laziness and immutability). And the "type-safety" guarantees are a red herring. They are not that useful in practice.
- tome 11y ago> Haskell sucks because mutability and strictness are extremely important for writing large complex programs, and Haskell deliberately makes both of these things inconvenient. That's funny, because I'd say that immutability is essential for writing large on complex programs. Strictness, on the other hand, hmm, I can take it or leave it. > Haskell's ecosystem and tooling is still crappy No argument here. > because writing complex programs in Haskell needlessly difficult Argument here :) > And the "type-safety" guarantees are a red herring. They are not that useful in practice. I've found the opposite. Type safety has saved me so many headaches I'm never going back.
- deleted 11y ago[deleted]
- denim_chicken 11y agoWell, I can't say much other than that I encourage everyone to try Haskell for themselves and form their own opinion -- if they can find the time to get over the language's extremely steep learning curve.
- darksaints 11y agoHaskell has 3 major problems that are completely distinct in my opinion. Biggest technical problem: lazy evaluation. Other people have said more than enough here. Biggest cultural problem: technical oneupmanship and code golf. Haskellers can get so caught up in no-compromises stylistic competition that it makes it hard to get anything done. If you finally finish up something that accomplishes your goals, your teammate is gonna come in and rewrite everything you just wrote so he can feel happy with it too. And then lecture you about how lenses are wonderful and how you need to learn the principle of least power. Biggest community problem: a small minority of extremely obnoxious and toxic assholes. They raid other communities and make fun of their languages and members. They rant against and mock everything deemed inferior. They treat people like they're idiots for not understanding basic but unfamiliar principles of the language. And nobody ever seems to shut them down, despite the fact that the majority are pretty welcoming.
- tome 11y ago> They rant against and mock everything deemed inferior. They treat people like they're idiots for not understanding basic but unfamiliar principles of the language. And nobody ever seems to shut them down, despite the fact that the majority are pretty welcoming. I'm happy to try to shut them down but I've pretty much never seen it (perhaps because I'm not in those other communities). If you do, please point me to it. Contact details here: http://web.jaguarpaw.co.uk/~tom/contact/ http://web.jaguarpaw.co.uk/~tom/contact/
- nv-vn 11y agoThere were a few big controversies on Twitter and Reddit that I can recall. In one instance in particular, someone called out some Haskell users trying to make Haskell look better by publishing code examples of common algorithms that "cheated" (i.e. the Haskell quicksort that's so popularly paraded around isnt a true quicksort). After the person argued this, they were banned from the Haskell subreddit.
- tome 11y agoCan you link me to that? I find it very hard to believe that someone would be banned from the Haskell subreddit for (correctly) pointing out that what has (curiously) entered Haskell lore as Quicksort is not really Quicksort. We all know this.
- tome 11y agoCan I encourage everybody to classify their complaints according to the following scheme? http://h2.jaguarpaw.co.uk/posts/complaining-about-languages/ http://h2.jaguarpaw.co.uk/posts/complaining-about-languages/ I believe it would help everybody understand how we can improve people's experience around Haskell.
- pekk 11y agoThese are all interacting parts which make up a system. You can't separate the parts out so cleanly when they have so many interactions.
- tome 11y agoCare to give some examples? Some examples which from my point of view seem pretty clear cut: Laziness and purity fall squarely under "language specification". There's no way of seeing them as a problem with libraries or community. 'I think a lot of the Haskell community is obsessed with mathematical "cuteness", which basically they take to mean "infix-operator-heavy" notation.' is a problem of community (and arguably language specification), certainly not of tooling or infrastructure. "String should not be [Char]" is a problem with libraries (and arguably specification). Certainly not community or tooling.
- johan_larson 11y agoWhat's the difference between "infrastructure" and "tooling" in this context?
- tlogan 11y agoI had chance to debug one tool built using Haskell. I was amazed how Haskell solution for clean and easy to understand (it was a parsing library generating better optimized SQL queries). The main problems are: - it is hard to find examples/snippets of real-world solutions on net (majority of examples are like Hello world and these examples are not useful) - lack of documentation about building real-world solutions Maybe more work should be done in explaining how Haskell can be used to solve some real-world problems. Parsing seems like place where Haskell shines and more examples should be available. So maybe just focus on "parsing with Haskell" and win that space.
- taktoa 11y agoYou may be interested in the State of the Haskell Ecosystem [1] and School of Haskell [2]. [1]: https://github.com/Gabriel439/post-rfc/blob/master/sotu.md https://github.com/Gabriel439/post-rfc/blob/master/sotu.md [2]: https://www.schoolofhaskell.com https://www.schoolofhaskell.com
- olavk 11y agoHaskell, like Perl, is optimized towards writing code rather than reading code. I would like a language which is to Haskell what Python is to Perl.
- PeCaN 11y agoHow about OCaml? It's not as theoretically advanced as Haskell, but it gets work done, is easy to read, fast, easy to reason about the complexity of, has decent libraries, and is generally quite pleasant.
- oldmanmike 11y agoI would be interesting in learning more about the "easy to reason about the complexity" part of OCaml. The problem I'm having with Haskell isn't that it's too slow, but that it's so high-level and gets so aggressively optimized at compile-time, that the performance of the resulting binary has performance characteristics that are unpredictable and non-deterministic. Performance can regress between GHC releases, for instance. This just seems to be a problem of high-level programming languages in general, they're really slow until you start optimizing them at compile-time. And with each one of those optimizations, you get another layer of indirection with regards to how disconnected the speed of the code you wrote should be vs. how fast the final product actually is. Haskell has no business being as fast as it is already, but GHC gives it to us at the price of long compile times and very fuzzy performance properties that are very finicky and expert-friendly. The problem I see here is just the unsolved computer science problem of how to reduce the complicated, drawn-out, and error-prone job of a C programmer into the succinct job of a functional programmer without fundamentally pretending modern computers work in a way they don't.
- sid-kap 11y agoNot trying to detract from your point, but it's interesting to note that even C and x86 are "pretending modern computers work in a way they don't" (see http://blog.erratasec.com/2015/03/x86-is-high-level-language.html#.VxQh7d8zqHs http://blog.erratasec.com/2015/03/x86-is-high-level-language...).
- malisper 11y agoMy reason is that there are eight different folding functions: foldl, foldr, foldl1, foldr1, foldl', foldr', foldl1', and foldr1'. There are twelve if you count: scanl, scanr, scanl1, scanr1. Also, the implementation of monad transformers is disgusting. It requires O(n^2) code generation where n is the number of monads.
- tome 11y agoThe non-primed versions simply shouldn't exist (everyone agrees) and in my opinion the 1 versions shouldn't exist either. This takes 8 down to 2, and they are genuinely two different functions so both need to exist.
- Peaker 11y agoFolds can be left-associative or right-associative. (l or r suffix). Folds can be eager or lazy (prime suffix for eager). Folds can work with at least 1 element to avoid the empty case ('1' suffix) (e.g: a function like `maximum`). This gives 2^3 cartesian space of folds. Each and every one may be useful in some cases. For ordinary lists, though, foldr and foldl' cover virtually all uses (just use 'error' for the empty case when you need to). Monad transformers don't require O(n^2) anything. You're talking about the 'mtl' package on top of the 'transformers' package. The 'transformers' package is useful on its own and doesn't have this problem. The 'mtl' automatic lifter framework does require something in the order of O(n^2) instances (for n=6 or so). However, this is not really just 6 copies of the same code over and over. The threading of monadic state through different monads varies. For example: `Reader.local` is implemented very differently for `WriterT` and for `ContT`. So there really are in the order of O(n^2) different interactions to write code to account for.
- yongjik 11y agoI only dabbled in it a little for fun, but in my beginner's opinion: Pros: The compiler eliminates a lot of potential bugs, so once my code compiles, I've saved hours that would have been spent debugging if I were using, say, C++. However, Cons: It takes more hours to figure out why my code is not compiling! Basically, instead of debugging my code, now I have to "debug" GHC, trying to figure out what it is thinking and why it's rejecting my code. Put another way, C++ allows me to try "quick and dirty" solutions first, and then later iterate and improve. Haskell requires me to be perfect at first try.
- Peaker 11y agoWhen you gain experience in both C++ and Haskell, the time you spend debugging runtime errors in C++ diminishes somewhat. But the time you spend debugging type errors in Haskell diminishes to almost nil. Experience and practice makes perfect -- debugging a type error becomes easy. Maintaining a large C++ application and changing something is more scary (even for the expert) than changing something in a large Haskell program.
- ufo 11y agoOne thing that helps A LOT when it comes to those compiler error messages is writing lots of type signatures. They help keep the error messages more "localized" than they would if you rely on global type inference. I would recommend at least writing a type signature for every top-level function in your programs. That said, Haskell still has many features that make errors more complicated than other languages. One example is that the use of whitespace for function calls means that some things (like forgetting a comma in a list) become type errors instead of syntax errors. Another example is the overloaded numeric literals, which add "invisible" typeclasses to any code you write that uses numbers. Coming back to your comment, I think that the "quick and dirty" bit has more to do with you being more used to C++ than you are with Haskell. You can also write dirty code in Haskell if that is what you really want :)
- kccqzy 11y agoIf you prefer the "quick and dirty" way, you can use the flag -fdefer-type-errors to turn type checker errors into runtime errors that throw exceptions.
- davesque 11y agoMy main gripe is that the syntax is too sugary. I've often wondered to myself what a Haskell with syntax more in the spirit of Python would look like. I just wish I didn't always feel like I had to literally memorize what various custom operators meant with flashcards or something. Also, Haskell has relatively complex parsing and evaluation rules. The meaning of well-written code shouldn't be obscured by syntax. And, along the lines of the syntax, the culture of style in Haskell. Single letter variables abound. Not just throwaway vars where the meaning is pretty clear from context. Entire libraries written with only single letter or acronymic variable names. Good luck understanding what a library author was trying to do by reading their code. I think this culture problem is largely being driven by the fact (which I mentioned) that Haskell's base syntax is already very opaque. I understand that the language takes some cues from the mathematical community (not surprising given its history). However, the language needs to ditch this to gain broader acceptance. And, again, leading into my next point: the culture of the community in general is too academic. I'll make another comparison with Python. The Python community, among scripting languages, leans more toward the academic side but in a good way. They've found a nice balance. It's easy to get started and, if you want to learn more about the details, you can do so. With Haskell, you immediately get hung up on the details. Most of the details have to do with how Haskell fits into the framework of category theory. However, most programmers don't give a shit about provability. They just want to write software that is faster, safer, and more concise without being terse. I'm not convinced that it's impossible to have this in a functional language with the same goals as Haskell. Beginners should be able to get started quickly and without much confusion. If they're curious about the underlying principles, they should be able to gradually peel back the layers and learn more.
- alectheriault 11y agoTo everyone complaining about laziness, the new GHC 8.0 compiler (due to be released any day now) has a ['Strict' pragma option][1]. [1]: https://ghc.haskell.org/trac/ghc/wiki/StrictPragma https://ghc.haskell.org/trac/ghc/wiki/StrictPragma
- tome 11y agoUnfortunately (?) this doesn't really make Haskell a strict language.
- Tinned_Tuna 11y agoI actually really like the language, but there are several key points which stop me from using it in any production systems: First and foremost, the build system. Oh god, the build system. Cabal is wonderful in some respects, but I have often found myself in a situation where the answer is "delete the ~/.cabal and ~/.ghc-pkg". This should not happen. Laziness. You get concise programs, but then the memory performance is unknown until you read it and/or learn to read GHC's IR. You know, I'd really enjoy being able to know roughly how much memory I need to buy up for the systems I'm deploying. Experimental or non-standard extensions. Just no. I'm not going to rely on non-standard or experimental "stuff" that tie me to a single compiler. This is made all the worse in that they're all hard-bound to various GHC versions and you're expected to use them in production (I'm looking at you, web frameworks). We have standards, stick to them. It is for these reasons that I can't recommend Haskell to people as anything more than an interesting language to learn. Until the above is fixed (many of which are cultural) I will not use Haskell in production.