errata-0.4.0.2: Source code error pretty printing
Copyright(c) 2020- comp
LicenseMIT
Maintaineronecomputer00@gmail.com
Stabilitystable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Errata.Styles

Description

Premade styles for blocks and pointers.

Synopsis

Documentation

basicStyle :: Style Source #

A basic style using only ASCII characters.

Errors should look like so (with basicPointer):

error header message
--> file.ext:1:16
block header message
  |
1 |   line 1 foo bar do
  |  ________________^^ start label
2 | | line 2
  | |      ^ unconnected label
3 | | line 3
  | |______^ middle label
4 | | line 4
5 | | line 5
. | |
7 | | line 7
8 | | line 8 baz end
  | |______^_____^^^ end label
  |        |
  |        | inner label
block body message
error body message

basicPointer :: PointerStyle Source #

Pointers using only ASCII characters.

fancyStyle :: Style Source #

A fancy style using Unicode characters.

Errors should look like so (with fancyPointer):

error header message
→ file.ext:1:16
block header message
  │
1 │   line 1 foo bar do
  │ ┌────────────────^^ start label
2 │ │ line 2
  │ │      ^ unconnected label
3 │ │ line 3
  │ ├──────^ middle label
4 │ │ line 4
5 │ │ line 5
. │ │
7 │ │ line 7
8 │ │ line 8 baz end
  │ └──────^─────^^^ end label
  │        │
  │        └ inner label

fancyPointer :: PointerStyle Source #

Pointers using Unicode characters and ANSI colors.

fancyRedStyle :: Style Source #

A fancy style using Unicode characters and ANSI colors, similar to fancyStyle. Most things are colored red.

fancyRedPointer :: PointerStyle Source #

Red pointers using Unicode characters and ANSI colors.

fancyYellowStyle :: Style Source #

A fancy style using Unicode characters and ANSI colors, similar to fancyStyle. Most things are colored yellow.

fancyYellowPointer :: PointerStyle Source #

Yellow pointers using Unicode characters and ANSI colors.

highlight Source #

Arguments

:: [(PointerStyle, (Column, Column))]

Styles and columns to work on. These are sorted, starting at 1. They must not overlap.

-> Text

Text to highlight.

-> Text 

Adds highlighting to spans of text by modifying it with the given styles' highlights.