| Stability | stable |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Common.Error
Description
This module provides tools to transform technical Megaparsec errors into human-readable, colored error messages. It helps standardize error reporting across the entire application (Parsing, Semantics, Imports).
Synopsis
- formatParseError :: ParseErrorBundle Text Void -> String
- formatError :: String -> String -> String
- formatFancyError :: Set (ErrorFancy Void) -> String
- getExpected :: ParseError Text Void -> String
- getUnexpected :: ParseError Text Void -> String
Documentation
formatParseError :: ParseErrorBundle Text Void -> String Source #
Main entry point to format a Megaparsec error bundle.
@args
- bundle: The full error bundle returned by parse.
@details Extracts the first error, calculates position, and formats the message. Refactored to meet coding style (short function, short lines).
formatError :: String -> String -> String Source #
Formats a generic error message with a colored tag.
@args - tag: The error category (e.g., "Semantic Error", "Import Error"). - msg: The error description.
@return A formatted string with the tag in red ANSI color.
formatFancyError :: Set (ErrorFancy Void) -> String Source #
Format FancyError messages (generated by fail).
@details Iterates over the set of fancy errors and extracts the text message if it exists (ErrorFail).