cryptol-2.2.6: Cryptol: The Language of Cryptography

Copyright | (c) 2013-2015 Galois, Inc.
License | BSD3
Maintainer | cryptol@galois.com
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Cryptol.ModuleSystem.Env

Description

Synopsis

- data ModuleEnv = ModuleEnv {
  - meLoadedModules :: LoadedModules
  - meNameSeeds :: NameSeeds
  - meEvalEnv :: EvalEnv
  - meFocusedModule :: Maybe ModName
  - meSearchPath :: [FilePath]
  - meDynEnv :: DynamicEnv
  - meMonoBinds :: !Bool
  }
- resetModuleEnv :: ModuleEnv -> ModuleEnv
- initialModuleEnv :: IO ModuleEnv
- focusModule :: ModName -> ModuleEnv -> Maybe ModuleEnv
- loadedModules :: ModuleEnv -> [Module]
- focusedEnv :: ModuleEnv -> IfaceDecls
- qualifiedEnv :: ModuleEnv -> IfaceDecls
- loadModuleEnv :: (Import -> Iface -> Iface) -> ModuleEnv -> Maybe (Iface, IfaceDecls)
- newtype LoadedModules = LoadedModules {
  - getLoadedModules :: [LoadedModule]
  }
- data LoadedModule = LoadedModule {
  - lmName :: ModName
  - lmFilePath :: FilePath
  - lmInterface :: Iface
  - lmModule :: Module
  }
- isLoaded :: ModName -> LoadedModules -> Bool
- lookupModule :: ModName -> ModuleEnv -> Maybe LoadedModule
- addLoadedModule :: FilePath -> Module -> LoadedModules -> LoadedModules
- removeLoadedModule :: FilePath -> LoadedModules -> LoadedModules
- data DynamicEnv = DEnv {
  - deNames :: NamingEnv
  - deDecls :: [DeclGroup]
  - deEnv :: EvalEnv
  }
- deIfaceDecls :: DynamicEnv -> IfaceDecls

# Documentation

data ModuleEnv Source

Constructors

ModuleEnv |

Fields

meLoadedModules :: LoadedModules
meNameSeeds :: NameSeeds
meEvalEnv :: EvalEnv
meFocusedModule :: Maybe ModName
meSearchPath :: [FilePath]
meDynEnv :: DynamicEnv
meMonoBinds :: !Bool

resetModuleEnv :: ModuleEnv -> ModuleEnv Source

initialModuleEnv :: IO ModuleEnv Source

focusModule :: ModName -> ModuleEnv -> Maybe ModuleEnv Source

Try to focus a loaded module in the module environment.

loadedModules :: ModuleEnv -> [Module] Source

Get a list of all the loaded modules. Each module in the resulting list depends only on other modules that precede it.

focusedEnv :: ModuleEnv -> IfaceDecls Source

Produce an ifaceDecls that represents the focused environment of the module system.

This could really do with some better error handling, just returning mempty when one of the imports fails isn't really desirable.

qualifiedEnv :: ModuleEnv -> IfaceDecls Source

Produce an ifaceDecls that represents the internal environment of the module, used for typechecking.

loadModuleEnv :: (Import -> Iface -> Iface) -> ModuleEnv -> Maybe (Iface, IfaceDecls) Source

newtype LoadedModules Source

Invariant: All the dependencies of any module `m` must precede `m` in the list.

Constructors

LoadedModules |

Fields

getLoadedModules :: [LoadedModule]

Instances

Show LoadedModules Source |
Monoid LoadedModules Source |

data LoadedModule Source

Constructors

LoadedModule |

Fields

lmName :: ModName
lmFilePath :: FilePath
lmInterface :: Iface
lmModule :: Module

Instances

Show LoadedModule Source |

isLoaded :: ModName -> LoadedModules -> Bool Source

lookupModule :: ModName -> ModuleEnv -> Maybe LoadedModule Source

addLoadedModule :: FilePath -> Module -> LoadedModules -> LoadedModules Source

removeLoadedModule :: FilePath -> LoadedModules -> LoadedModules Source

data DynamicEnv Source

Extra information we need to carry around to dynamically extend an environment outside the context of a single module. Particularly useful when dealing with interactive declarations as in `:let` or `it`.

Constructors

DEnv |

Fields

deNames :: NamingEnv
deDecls :: [DeclGroup]
deEnv :: EvalEnv

Instances

Monoid DynamicEnv Source |

deIfaceDecls :: DynamicEnv -> IfaceDecls Source

Build `IfaceDecls` that correspond to all of the bindings in the dynamic environment.

XXX: if we ever add type synonyms or newtypes at the REPL, revisit this.