One can run Haskell Code with runhaskell ...
or compile it with ghc ...
. It's clear that there are performance differences between interpreted code and an executable.
But is it common to use interpreted Haskell code in real world applications? Or does this feature only exists for development purposes?
EDIT:
Is it common practice to run real world apps in interpreted mode like i would do with, for example, Node.js?
$ node './app.js'
$ runhaskell './Main.hs'
Define "common".
I have a program that I consider "production code" that takes a specification for a web page and generates the appropriate static HTML. The specification isn't external; it's just a chunk of Haskell source code in the program. About once a month, I update the specification and run the program. I run it with runghc
and the run time is a tiny fraction of a second, so compiling would be a waste of keystrokes.
Out in the broader world, the popular stack
tool comes with script support. If you write a program like this:
#!/usr/bin/env stack
{- stack script --resolver lts-14.17 -}
main = putStrLn "Interpreted code is awesome!"
and run it, it basically uses a version of runghc
to run the script. So, this is at least one sanctioned method for writing and running interpreted, production scripts for Haskell.