ghc
ghc is the command-line interface for the Glasgow Haskell Compiler (GHC). It is the most widely used compiler for the Haskell programming language. GHC supports various Haskell language extensions and provides a number of advanced features, making it a powerful tool for building and optimizing Haskell programs.
When invoked, ghc reads Haskell source code files and compiles them into executable binaries or object files. It performs various stages of compilation, including parsing, type checking, optimization, and code generation. ghc provides a range of options to control the compilation process, such as enabling specific language extensions, specifying optimization levels, and linking with external libraries.
In addition to compiling Haskell programs, ghc also offers other functionalities. It can generate standalone documentation for Haskell libraries using Haddock, a documentation generation tool. ghc can also run Haskell programs directly from the command line, which is useful for quick testing and prototyping.
Furthermore, ghc provides a REPL (Read-Eval-Print Loop) called GHCi. GHCi allows interactive development and evaluation of Haskell expressions, providing a way to experiment and explore the language interactively.
Overall, ghc is a versatile command-line tool that enables developers to compile, optimize, and interactively work with Haskell source code, making it an essential component for Haskell programming.
List of commands for ghc:
-
ghc:tldr:0ac5e ghc: Compile using extra optimization.$ ghc -O ${file-hs}try on your machineexplain this command
-
ghc:tldr:2e6b6 ghc: Find and compile all modules in the current directory.$ ghc Maintry on your machineexplain this command
-
ghc:tldr:44d95 ghc: Compile a single file.$ ghc ${file-hs}try on your machineexplain this command
-
ghc:tldr:b645d ghc: Stop compilation after generating object files (.o).$ ghc -c ${file-hs}try on your machineexplain this command
-
ghc:tldr:d223c ghc: Evaluate a single expression.$ ghc -e ${expression}try on your machineexplain this command