Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- parseString :: String -> Ghc [Located CodeBlock]
- data CodeBlock
- data StringLoc = Loc LineNumber ColumnNumber
- data DirectiveType
- type LineNumber = Int
- type ColumnNumber = Int
- type ErrMsg = String
- layoutChunks :: String -> [Located String]
- parseDirective :: String -> Int -> CodeBlock
- getModuleName :: GhcMonad m => String -> m [String]
- data Located a = Located {
- line :: LineNumber
- unloc :: a
- data PragmaType
Documentation
A block of code to be evaluated. Each block contains a single element - one declaration, statement, expression, etc. If parsing of the block failed, the block is instead a ParseError, which has the error location and error message.
Expression String | A Haskell expression. |
Declaration String | A data type or function declaration. |
Statement String | A Haskell statement (as if in a `do` block). |
Import String | An import statement. |
TypeSignature String | A lonely type signature (not above a function declaration). |
Directive DirectiveType String | An IHaskell directive. |
Module String | A full Haskell module, to be compiled and loaded. |
ParseError StringLoc ErrMsg | An error indicating that parsing the code block failed. |
Pragma PragmaType [String] | A list of GHC pragmas (from a {-# LANGUAGE ... #-} block) |
Instances
A location in an input string.
Instances
data DirectiveType Source #
Directive types. Each directive is associated with a string in the directive code block.
GetType | Get the type of an expression via ':type' (or unique prefixes) |
GetInfo | Get info about the identifier via ':info' (or unique prefixes) |
SetDynFlag | Enable or disable an extensions, packages etc. via `:set`. Emulates GHCi's `:set` |
LoadFile | Load a Haskell module. |
SetOption | Set IHaskell kernel option `:option`. |
SetExtension | `:extension Foo` is a shortcut for `:set -XFoo` |
ShellCmd | Execute a shell command. |
GetHelp | General help via |
SearchHoogle | Search for something via Hoogle. |
GetDoc | Get documentation for an identifier via Hoogle. |
GetKind | Get the kind of a type via ':kind'. |
GetKindBang | Get the kind and normalised type via ':kind!'. |
LoadModule | Load and unload modules via ':module'. |
SPrint | Print without evaluating via ':sprint'. |
Reload | Reload. |
Instances
Show DirectiveType Source # | |
Defined in IHaskell.Eval.Parser showsPrec :: Int -> DirectiveType -> ShowS # show :: DirectiveType -> String # showList :: [DirectiveType] -> ShowS # | |
Eq DirectiveType Source # | |
Defined in IHaskell.Eval.Parser (==) :: DirectiveType -> DirectiveType -> Bool # (/=) :: DirectiveType -> DirectiveType -> Bool # |
type LineNumber = Int #
A line number in an input string.
type ColumnNumber = Int #
A column number in an input string.
layoutChunks :: String -> [Located String] #
Split an input string into chunks based on indentation. A chunk is a line and all lines immediately following that are indented beyond the indentation of the first line. This parses Haskell layout rules properly, and allows using multiline expressions via indentation.
Quasiquotes are allowed via a post-processing step.
:: String | Directive string. |
-> Int | Line number at which the directive appears. |
-> CodeBlock | Directive code block or a parse error. |
Parse a directive of the form :directiveName.
getModuleName :: GhcMonad m => String -> m [String] Source #
Parse a module and return the name declared in the 'module X where' line. That line is required, and if it does not exist, this will error. Names with periods in them are returned piece by piece.
Store locations along with a value.
Located | |
|
data PragmaType Source #
Pragma types. Only LANGUAGE pragmas are currently supported. Other pragma types are kept around as a string for error reporting.
Instances
Show PragmaType Source # | |
Defined in IHaskell.Eval.Parser showsPrec :: Int -> PragmaType -> ShowS # show :: PragmaType -> String # showList :: [PragmaType] -> ShowS # | |
Eq PragmaType Source # | |
Defined in IHaskell.Eval.Parser (==) :: PragmaType -> PragmaType -> Bool # (/=) :: PragmaType -> PragmaType -> Bool # |