Marc Weber <marco-owe...@gmx.de> wrote: > A lot of work has been gone into GHC and its libraries. > However for some use cases C is still preferred, for obvious speed > reasons - because optimizing an Haskell application can take much > time. > > Is there any document describing why there is no ghc --strict flag > making all code strict by default? > Wouldn't this make it easier to apply Haskell to some additional > fields such as video processing etc? > > Wouldn't such a '--strict' flag turn Haskell/GHC into a better C/gcc > compiler? > > Projects like this: https://github.com/thoughtpolice/strict-ghc-plugin > show that the idea is not new. > > Eg some time ago I had to do some logfile analysis. I ended doing it > in PHP because optimizing the Haskell code took too much time.
First of all, /learning/ to optimize Haskell can be difficult. The optimizing itself is actually fairly easy in my experience, once you understand how the language works. Usually the nonstrictness is no bottleneck. However, you have to know that you are in a nonstrict language. In fact, I find myself having difficulties writing efficient code in a strict language. Now to answer your question: A strict-by-default Haskell comes with the implication that you can throw away most of the libraries, including the base library. So yes, a strict-by-default Haskell is very well possible, but the question is whether you actually want that. I wouldn't, because a lot of my code relies on the standard semantics. I would also expect problems with the way Haskell performs I/O, because it would mean that forever (putStrLn "Hello world") would cause a heap overflow, if Haskell were strict. Note that we don't have control structures. We have combinators, and their nonstrictness is essential. The flag you are proposing would turn Haskell into a language that is different enough that you couldn't do many useful things with it. If you want to save the time to learn how to write efficient Haskell programs, you may want to have a look into the Disciple language. You will find that it has a different type system, which captures side effects explicitly to make a pure strict language even possible. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/
signature.asc
Description: PGP signature
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe