buildwrapper-0.6.4: A library and an executable that provide an easy API for a Haskell IDE

Safe HaskellNone

Language.Haskell.BuildWrapper.GHC

Synopsis

Documentation

getASTSource

Arguments

:: FilePath

the source file

-> FilePath

the base directory

-> String

the module name

-> [String]

the GHC options

-> IO (OpResult (Maybe TypecheckedSource)) 

get the GHC typechecked AST

withASTSource

Arguments

:: (TypecheckedModule -> Ghc a)

the action

-> FilePath

the source file

-> FilePath

the base directory

-> String

the module name

-> [String]

the GHC options

-> IO (Maybe a) 

perform an action on the GHC Typechecked module

withJSONASTSource

Arguments

:: (Value -> IO a)

the action

-> FilePath

the source file

-> FilePath

the base directory

-> String

the module name

-> [String]

the GHC options

-> IO (Maybe a) 

perform an action on the GHC JSON AST

withASTNotesSource

Arguments

:: GHCApplyFunction a

the final action to perform on the result

-> (FilePath -> FilePath)

transform given file path to find bwinfo path

-> FilePath

the base directory

-> LoadContents

what to load

-> [String]

the GHC options

-> IO (OpResult [a]) 

the main method loading the source contents into GHC

ghcMessagesToNotesSource

Arguments

:: DynFlags 
-> FilePath

base directory

-> Messages

GHC messages

-> [BWNote] 

Convert Messages to '[BWNote]'.

This will mix warnings and errors, but you can split them back up by filtering the '[BWNote]' based on the bw_status.

getGhcNamesInScopeSource

Arguments

:: FilePath

source path

-> FilePath

base directory

-> String

module name

-> [String]

build options

-> IO [String] 

get all names in scope

getGhcNameDefsInScopeSource

Arguments

:: FilePath

source path

-> FilePath

base directory

-> String

module name

-> [String]

build options

-> IO (OpResult (Maybe [NameDef])) 

get all names in scope, packaged in NameDefs

getThingAtPointJSONSource

Arguments

:: Int

line

-> Int

column -> Bool ^ do we want the result qualified by the module -> Bool ^ do we want the full type or just the haddock type

-> FilePath

source file path

-> FilePath

base directory

-> String

module name

-> [String]

build flags

-> IO (Maybe ThingAtPoint) 

get the thing at a particular point (line/column) in the source this is using the saved JSON info if available

getLocalsJSONSource

Arguments

:: Int

start line

-> Int

start column

-> Int

end line

-> Int

end column

-> FilePath

source file path

-> FilePath

base directory

-> String

module name

-> [String]

build flags

-> IO [ThingAtPoint] 

get the thing at a particular point (line/column) in the source this is using the saved JSON info if available

ghcSpanToLocation :: SrcSpan -> InFileSpanSource

convert a GHC SrcSpan to a Span, ignoring the actual file info

ghcSpanToBWLocationSource

Arguments

:: FilePath

Base directory

-> SrcSpan 
-> BWLocation 

convert a GHC SrcSpan to a BWLocation

ghcColToScionCol :: Int -> IntSource

convert a column info from GHC to our system (1 based)

scionColToGhcCol :: Int -> IntSource

convert a column info from our system (1 based) to GHC

ghctokensArbitrarySource

Arguments

:: FilePath

The file path to the document

-> String

The document's contents

-> [String]

The options

-> IO (Either BWNote [Located Token]) 

Get a stream of tokens generated by the GHC lexer from the current document

ofInterest :: Located Token -> BoolSource

Filter tokens whose span appears legitimate (start line is less than end line, start column is less than end column.)

tokenToType :: Located Token -> TokenDefSource

Convert a GHC token to an interactive token (abbreviated token type)

tokenTypesArbitrary :: FilePath -> String -> Bool -> [String] -> IO (Either BWNote [TokenDef])Source

Generate the interactive token list used by EclipseFP for syntax highlighting

occurrencesSource

Arguments

:: FilePath

Project root or base directory for absolute path conversion

-> String

Contents to be parsed

-> Text

Token value to find

-> Bool

Literate source flag (True = literate, False = ordinary)

-> [String]

Options

-> IO (Either BWNote [TokenDef]) 

Extract occurrences based on lexing

generateTokensSource

Arguments

:: FilePath

The project's root directory

-> String

The current document contents, to be parsed

-> Bool

Literate Haskell flag

-> [String]

The options

-> ([Located Token] -> [TokenDef])

Transform function from GHC tokens to TokenDefs

-> ([TokenDef] -> a)

The TokenDef filter function

-> IO (Either BWNote a) 

Parse the current document, generating a TokenDef list, filtered by a function

preprocessSourceSource

Arguments

:: String

the source contents

-> Bool

is the source literate Haskell

-> ([TokenDef], String)

the preprocessor tokens and the final valid Haskell source

Preprocess some source, returning the literate and Haskell source as tuple.

data PPBehavior Source

Constructors

Continue Int 
Indent Int 
Start 

Instances

ghcErrMsgToNote :: DynFlags -> FilePath -> ErrMsg -> BWNoteSource

convert a GHC error message to our note type

ghcWarnMsgToNote :: DynFlags -> FilePath -> WarnMsg -> BWNoteSource

convert a GHC warning message to our note type

removeStatus :: BWNoteStatus -> String -> StringSource

remove the initial status text from a message

mkUnqualTokenValueSource

Arguments

:: FastString

the name

-> Text 

make unqualified token

mkQualifiedTokenValueSource

Arguments

:: FastString

the qualifier

-> FastString

the name

-> Text 

make qualified token: join the qualifier and the name by a dot

mkTokenName :: Token -> TextSource

Make a token definition from its source location and Lexer.hs token type. mkTokenDef :: Located Token -> TokenDef mkTokenDef (L sp t) = TokenDef (mkTokenName t) (ghcSpanToLocation sp)