HaRe-0.7.1.4: the Haskell Refactorer.

Safe HaskellNone

Language.Haskell.Refact.Utils.Monad

Synopsis

Documentation

type ParseResult = TypecheckedModuleSource

Result of parsing a Haskell source file. It is simply the TypeCheckedModule produced by GHC.

data RefactState Source

State for refactoring a single file. Holds/hides the token stream, which gets updated transparently at key points.

Constructors

RefSt 

Fields

rsSettings :: !RefactSettings

Session level settings

rsUniqState :: !Int

Current Unique creator value, incremented every time it is used

rsFlags :: !RefactFlags

Flags for controlling generic traversals

rsStorage :: !StateStorage

Temporary storage of values while refactoring takes place

rsGraph :: [TargetGraph]
 
rsModuleGraph :: [([FilePath], ModuleGraph)]
 
rsCurrentTarget :: Maybe [FilePath]
 
rsModule :: !(Maybe RefactModule)

The current module being refactored

data RefactModule Source

Constructors

RefMod 

Fields

rsTypecheckedMod :: !TypecheckedModule
 
rsOrigTokenStream :: ![PosToken]

Original Token stream for the current module

rsTokenCache :: !TokenCache

Token stream for the current module, maybe modified, in SrcSpan tree form

rsStreamModified :: !Bool

current module has updated the token stream

data RefactFlags Source

Constructors

RefFlags 

Fields

rsDone :: !Bool

Current traversal has already made a change

data StateStorage Source

Provide some temporary storage while the refactoring is taking place

Instances

initGhcSession :: Cradle -> [FilePath] -> RefactGhc ()Source

Initialise the GHC session, when starting a refactoring. This should never be called directly.

loadModuleGraphGhc :: Maybe [FilePath] -> RefactGhc ()Source

Load a module graph into the GHC session, starting from main

ensureTargetLoaded :: TargetModule -> RefactGhc ModSummarySource

Make sure the given file is the currently loaded target, and load it if not. Assumes that all the module graphs had been generated before, so these are not updated.