HaRe-0.7.2.8: 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 VerboseLevel Source

Constructors

Debug 
Normal 
Off 

Instances

data RefactSettings Source

Constructors

RefSet 

Fields

rsetGhcOpts :: ![String]
 
rsetImportPaths :: ![FilePath]
 
rsetExpandSplice :: Bool
 
rsetLineSeparator :: LineSeparator
 
rsetMainFile :: Maybe [FilePath]
 
rsetCheckTokenUtilsInvariant :: !Bool
 
rsetVerboseLevel :: !VerboseLevel
 
rsetEnabledTargets :: (Bool, Bool, Bool, Bool)
 

Instances

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

Instances

data RefactModule Source

Constructors

RefMod 

Fields

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

Original Token stream for the current module

rsTokenCache :: !(TokenCache PosToken)

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

rsStreamModified :: !Bool

current module has updated the token stream

type TargetModule = ([FilePath], ModSummary)Source

data RefactStashId Source

Constructors

Stash !String 

Instances

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

Constructors

StorageNone 
StorageBind (LHsBind Name) 
StorageSig (LSig Name) 

Instances

type RefactGhc a = GhcT (StateT RefactState IO) aSource

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.

canonicalizeGraph :: [ModSummary] -> IO [(Maybe FilePath, ModSummary)]Source

logm :: String -> RefactGhc ()Source