apply-refact-0.14.0.0: Perform refactorings specified by the refact library.

Safe Haskell | None
Language | Haskell2010

Refact.Internal

Contents

- Support for runPipe in the main process

Synopsis

- apply :: Maybe (Int, Int) -> Bool -> [(String, [Refactoring SrcSpan])] -> Maybe FilePath -> Verbosity -> Module -> IO String
- runRefactoring :: Data a => a -> Refactoring SrcSpan -> StateT Int IO a
- addExtensionsToFlags :: [Extension] -> [Extension] -> FilePath -> DynFlags -> IO (Either String DynFlags)
- parseModuleWithArgs :: LibDir -> ([Extension], [Extension]) -> FilePath -> IO (Either Errors ParsedSource)
- parseExtensions :: [String] -> ([Extension], [Extension], [String])
- data Verbosity
  - = Silent
  - | Normal
  - | Loud
- refactOptions :: EPOptions Identity String
- type Errors = ErrorMessages
- onError :: String -> Errors -> a
- mkErr :: DynFlags -> SrcSpan -> String -> Errors

# Documentation

apply :: Maybe (Int, Int) -> Bool -> [(String, [Refactoring SrcSpan])] -> Maybe FilePath -> Verbosity -> Module -> IO String #

Apply a set of refactorings as supplied by hlint

runRefactoring :: Data a => a -> Refactoring SrcSpan -> StateT Int IO a #

Peform a `Refactoring`.

addExtensionsToFlags :: [Extension] -> [Extension] -> FilePath -> DynFlags -> IO (Either String DynFlags) #

parseModuleWithArgs :: LibDir -> ([Extension], [Extension]) -> FilePath -> IO (Either Errors ParsedSource) #

parseExtensions :: [String] -> ([Extension], [Extension], [String]) #

Parse the input into (enabled extensions, disabled extensions, invalid input). Implied extensions are automatically added. For example, `FunctionalDependencies` implies `MultiParamTypeClasses`, and `RebindableSyntax` implies `NoImplicitPrelude`.

The input is processed from left to right. An extension (e.g., `StarIsType`) may be overridden later (e.g., by `NoStarIsType`).

Extensions that appear earlier in the input will appear later in the output. Implied extensions appear in the end. If an extension occurs multiple times in the input, the last one is used.

    >>> parseExtensions ["GADTs", "RebindableSyntax", "StarIsType", "GADTs", "InvalidExtension", "NoStarIsType"]
    ([GADTs, RebindableSyntax, GADTSyntax, MonoLocalBinds], [StarIsType, ImplicitPrelude], ["InvalidExtension"])

# Support for runPipe in the main process

data Verbosity #

Constructors

Silent |
Normal |
Loud |

#### Instances

Instances details

Show Verbosity # |
Instance details Defined in Refact.Internal Methods showsPrec :: Int -> Verbosity -> ShowS # show :: Verbosity -> String # showList :: [Verbosity] -> ShowS #
Eq Verbosity # |
Instance details Defined in Refact.Internal Methods (==) :: Verbosity -> Verbosity -> Bool # (/=) :: Verbosity -> Verbosity -> Bool #
Ord Verbosity # |
Instance details Defined in Refact.Internal Methods compare :: Verbosity -> Verbosity -> Ordering # (<) :: Verbosity -> Verbosity -> Bool # (<=) :: Verbosity -> Verbosity -> Bool # (>) :: Verbosity -> Verbosity -> Bool # (>=) :: Verbosity -> Verbosity -> Bool # max :: Verbosity -> Verbosity -> Verbosity # min :: Verbosity -> Verbosity -> Verbosity #

refactOptions :: EPOptions Identity String #

type Errors = ErrorMessages #

onError :: String -> Errors -> a #

mkErr :: DynFlags -> SrcSpan -> String -> Errors #