4 ms·
For me, one of the biggest non-starters is a slow compiler, or rather a compiler that doesn't scale well. When people talk about how smart their type system or
by gridlockd 7y ago
For me, one of the biggest non-starters is a slow compiler, or rather a compiler that doesn't scale well. When people talk about how smart their type system or their compiler is, it immediately rings alarm bells for me.
This is one of the things that you may only learn the hard way, as your project grows in complexity. Nobody advertises how slow their compiler is.
So, my question is, how does GHC fare these days? How does it treat people that switched from a dynamic language, who are used to quick iteration?
- galaxyLogic 7y agoQuick iteration means quick feedback and that is a major success-factor for software projects I believe. The purpose of compiler is to give you feedback about what you're doing wrong, but if that feedback is slow then it loses much of its value. Goal is to guide the programmer, not stop them.
- the_af 7y agoI think quick iteration and feedback is one of Haskell's strong points :) It has been argued before, in a fascinating but admittedly flawed experiment for the Naval Surface Warfare Center (US Navy) [1], that Haskell is a great prototyping language. This experiment is flawed for multiple reasons which the authors readily admit (e.g. the results from all contestants were self-reported, the requirements were vague [2], no code was actually run by the panel of judges, etc), but it's still tremendously interesting. It's also amusing that the judges couldn't believe the Haskell program was a working and complete implementation of the system, and thought it was either pseudocode or "too clever" for its own good (because of the use of higher-order functions)! [1] http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.368.1058&rep=rep1&type=pdf http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.368... [2] though one could argue vague requirements are actually another point in favor of Haskell as a rapid prototyping language. It's often argued -- mistakenly -- that languages with static typing are not good for exploratory coding, which this experiment tends to show not to be true.
- mic47 7y agoFor quick iterations, you have ghci. You just edit your files, type :r and it will recompile only necessary files, which is really quick (and I miss it in most other REPLs). Similar with incremental compilation. But if you need to compile huge project always from scratch, of course, you will suffer. There have been work on making haskell to have deterministic build to speed up compile time, and compare to scala, I find it way faster (in my current company, we use scala). But note that if you start using stuff like template haskell, your compilation will slow down.
- gridlockd 7y agoCan you define "really quick" a bit better? Less than a second?
- taylorfausak 7y agoTo give you a single data point, our Haskell code base at ITProTV is about 50,000 lines of code. Reloading the project after a change in GHCi takes slightly less than one second. We haven't spent any significant effort on speeding up compile speeds, for what it's worth. It's fast enough.
- flowless 7y agoIt doesn't feel slow to me (compared to for example C++ compilation) and you can iterate quickly using cabal repl (:r) or ghcid[1] which both support partial recompilation of changed files. [1] https://github.com/ndmitchell/ghcid https://github.com/ndmitchell/ghcid
- gridlockd 7y agoComparing to C++ is a very low bar, that is why I was looking for comparisons with dynamic languages. What is the turnaround time with these interpreters, then?