fix-whitespace-0.1: Fixes whitespace issues.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Text.FixWhitespace

Synopsis

Documentation

data CheckResult Source #

Result of checking a file against the whitespace policy.

Constructors

CheckOK

The file satifies the policy.

CheckViolation Text [LineError]

The file violates the policy, a fix and a list of violating lines are returned.

CheckIOError IOException

An I/O error occurred while accessing the file. (E.g., the file is not UTF8 encoded.)

checkFile :: TabSize -> Verbose -> FilePath -> IO CheckResult Source #

Check a file against the whitespace policy, returning a fix if violations occurred.

data LineError Source #

Represents a line of input violating whitespace rules. Stores the index of the line and the line itself.

Constructors

LineError Int Text 

displayLineError :: FilePath -> LineError -> Text Source #

Print a erroneous line with visibleSpaces.

transform Source #

Arguments

:: TabSize

Expand tab characters to so many spaces. Keep tabs if <= 0.

-> Text

Text before transformation.

-> Text

Text after transformation.

transformWithLog Source #

Arguments

:: TabSize

Expand tab characters to so many spaces. Keep tabs if <= 0.

-> Text

Text before transformation.

-> (Text, [LineError])

Text after transformation and violating lines if any.

Transforms the contents of a file.

defaultTabSize :: TabSize Source #

Default tab size.