Language.PureScript.Interactive.Types

purescript-0.15.15: PureScript Programming Language Compiler

Safe Haskell | None
Language | Haskell2010

Language.PureScript.Interactive.Types

Description

Type declarations and associated basic functions for PSCI.

Synopsis

- newtype PSCiConfig = PSCiConfig {
  - psciFileGlobs :: [String]
  }
- psciEnvironment :: PSCiState -> Environment
- data PSCiState
- type ImportedModule = (ModuleName, ImportDeclarationType, Maybe ModuleName)
- psciExports :: PSCiState -> Exports
- psciImports :: PSCiState -> Imports
- psciLoadedExterns :: PSCiState -> [(Module, ExternsFile)]
- psciInteractivePrint :: PSCiState -> (ModuleName, Ident)
- psciImportedModules :: PSCiState -> [ImportedModule]
- psciLetBindings :: PSCiState -> [Declaration]
- initialPSCiState :: PSCiState
- initialInteractivePrint :: (ModuleName, Ident)
- updateImportedModules :: ([ImportedModule] -> [ImportedModule]) -> PSCiState -> PSCiState
- updateLoadedExterns :: ([(Module, ExternsFile)] -> [(Module, ExternsFile)]) -> PSCiState -> PSCiState
- updateLets :: ([Declaration] -> [Declaration]) -> PSCiState -> PSCiState
- setInteractivePrint :: (ModuleName, Ident) -> PSCiState -> PSCiState
- data Command
  - = Expression Expr
  - | ShowHelp
  - | Import ImportedModule
  - | BrowseModule ModuleName
  - | QuitPSCi
  - | ReloadState
  - | ClearState
  - | Decls [Declaration]
  - | TypeOf Expr
  - | KindOf SourceType
  - | ShowInfo ReplQuery
  - | PasteLines
  - | CompleteStr String
  - | SetInteractivePrint (ModuleName, Ident)
- data ReplQuery
  - = QueryLoaded
  - | QueryImport
  - | QueryPrint
- replQueries :: [ReplQuery]
- replQueryStrings :: [String]
- showReplQuery :: ReplQuery -> String
- parseReplQuery :: String -> Maybe ReplQuery
- data Directive
  - = Help
  - | Quit
  - | Reload
  - | Clear
  - | Browse
  - | Type
  - | Kind
  - | Show
  - | Paste
  - | Complete
  - | Print

# Documentation

newtype PSCiConfig #

The PSCI configuration.

These configuration values do not change during execution.

Constructors

PSCiConfig |
Fields psciFileGlobs :: [String]

#### Instances

Instances details

Show PSCiConfig # |
Instance details Defined in Language.PureScript.Interactive.Types Methods showsPrec :: Int -> PSCiConfig -> ShowS # show :: PSCiConfig -> String # showList :: [PSCiConfig] -> ShowS #

psciEnvironment :: PSCiState -> Environment #

data PSCiState #

The PSCI state.

Holds a list of imported modules, loaded files, and partial let bindings, plus the currently configured interactive printing function.

The let bindings are partial, because it makes more sense to apply the binding to the final evaluated expression.

The last two fields are derived from the first three via updateImportExports each time a module is imported, a let binding is added, or the session is cleared or reloaded

#### Instances

Instances details

Show PSCiState # |
Instance details Defined in Language.PureScript.Interactive.Types Methods showsPrec :: Int -> PSCiState -> ShowS # show :: PSCiState -> String # showList :: [PSCiState] -> ShowS #

type ImportedModule = (ModuleName, ImportDeclarationType, Maybe ModuleName) #

All of the data that is contained by an ImportDeclaration in the AST. That is:

- A module name, the name of the module which is being imported
- An ImportDeclarationType which specifies whether there is an explicit import list, a hiding list, or neither.
- If the module is imported qualified, its qualified name in the importing module. Otherwise, Nothing.

psciExports :: PSCiState -> Exports #

psciImports :: PSCiState -> Imports #

psciLoadedExterns :: PSCiState -> [(Module, ExternsFile)] #

psciInteractivePrint :: PSCiState -> (ModuleName, Ident) #

psciImportedModules :: PSCiState -> [ImportedModule] #

psciLetBindings :: PSCiState -> [Declaration] #

initialPSCiState :: PSCiState #

initialInteractivePrint :: (ModuleName, Ident) #

The default interactive print function.

updateImportedModules :: ([ImportedModule] -> [ImportedModule]) -> PSCiState -> PSCiState #

Updates the imported modules in the state record.

updateLoadedExterns :: ([(Module, ExternsFile)] -> [(Module, ExternsFile)]) -> PSCiState -> PSCiState #

Updates the loaded externs files in the state record.

updateLets :: ([Declaration] -> [Declaration]) -> PSCiState -> PSCiState #

Updates the let bindings in the state record.

setInteractivePrint :: (ModuleName, Ident) -> PSCiState -> PSCiState #

Replaces the interactive printing function in the state record with a new one.

data Command #

Valid Meta-commands for PSCI

Constructors

Expression Expr | A purescript expression
ShowHelp | Show the help (ie, list of directives)
Import ImportedModule | Import a module from a loaded file
BrowseModule ModuleName | Browse a module
QuitPSCi | Exit PSCI
ReloadState | Reload all the imported modules of the REPL
ClearState | Clear the state of the REPL
Decls [Declaration] | Add some declarations to the current evaluation context
TypeOf Expr | Find the type of an expression
KindOf SourceType | Find the kind of an expression
ShowInfo ReplQuery | Shows information about the current state of the REPL
PasteLines | Paste multiple lines
CompleteStr String | Return auto-completion output as if pressing tab
SetInteractivePrint (ModuleName, Ident) | Set the interactive printing function

#### Instances

Instances details

Show Command # |
Instance details Defined in Language.PureScript.Interactive.Types Methods showsPrec :: Int -> Command -> ShowS # show :: Command -> String # showList :: [Command] -> ShowS #

data ReplQuery #

Constructors

QueryLoaded |
QueryImport |
QueryPrint |

#### Instances

Instances details

Show ReplQuery # |
Instance details Defined in Language.PureScript.Interactive.Types Methods showsPrec :: Int -> ReplQuery -> ShowS # show :: ReplQuery -> String # showList :: [ReplQuery] -> ShowS #
Eq ReplQuery # |
Instance details Defined in Language.PureScript.Interactive.Types Methods (==) :: ReplQuery -> ReplQuery -> Bool # (/=) :: ReplQuery -> ReplQuery -> Bool #

replQueries :: [ReplQuery] #

A list of all ReplQuery values.

replQueryStrings :: [String] #

showReplQuery :: ReplQuery -> String #

parseReplQuery :: String -> Maybe ReplQuery #

data Directive #

Constructors

Help |
Quit |
Reload |
Clear |
Browse |
Type |
Kind |
Show |
Paste |
Complete |
Print |

#### Instances

Instances details

Show Directive # |
Instance details Defined in Language.PureScript.Interactive.Types Methods showsPrec :: Int -> Directive -> ShowS # show :: Directive -> String # showList :: [Directive] -> ShowS #
Eq Directive # |
Instance details Defined in Language.PureScript.Interactive.Types Methods (==) :: Directive -> Directive -> Bool # (/=) :: Directive -> Directive -> Bool #