- 1 year ago
Is there a way to get GHC error messages properly formatted on powershell terminal when built with stack?
Yes, you can get properly formatted GHC (Glasgow Haskell Compiler) error messages on the PowerShell terminal when building with Stack. By default, the GHC error messages may not be displayed in a human-readable format on PowerShell, but you can use the stack build
command with the --color always
option to enable proper formatting of GHC error messages.
Here's how you can do it:
Open the PowerShell terminal.
Navigate to the root directory of your Haskell project, where the
stack.yaml
file is located.Use the
stack build
command with the--color always
option to enable colored output and proper formatting of GHC error messages:
bashstack build --color always
The --color always
option ensures that the output, including error messages, is displayed with proper formatting, including colors. This makes the error messages much more readable and easier to understand.
Additionally, you can also use the --ghc-options
flag to pass additional options directly to GHC. For example, you can enable additional error message verbosity by using -v
:
bashstack build --color always --ghc-options="-v"
Remember that the output and error messages might vary depending on your specific Haskell project and the GHC version you are using. Always ensure that your project and dependencies are set up correctly to get the most accurate error messages.