Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type TopLevelModuleNameParts = List1 Text
- data RawTopLevelModuleName = RawTopLevelModuleName {}
- rawTopLevelModuleNameToString :: RawTopLevelModuleName -> String
- hashRawTopLevelModuleName :: RawTopLevelModuleName -> ModuleNameHash
- rawTopLevelModuleNameForQName :: QName -> RawTopLevelModuleName
- rawTopLevelModuleNameForModuleName :: ModuleName -> RawTopLevelModuleName
- rawTopLevelModuleNameForModule :: Module -> RawTopLevelModuleName
- data TopLevelModuleName = TopLevelModuleName {}
- lensTopLevelModuleNameParts :: Lens' TopLevelModuleName TopLevelModuleNameParts
- rawTopLevelModuleName :: TopLevelModuleName -> RawTopLevelModuleName
- unsafeTopLevelModuleName :: RawTopLevelModuleName -> ModuleNameHash -> TopLevelModuleName
- topLevelModuleNameToQName :: TopLevelModuleName -> QName
- moduleNameToFileName :: TopLevelModuleName -> String -> FilePath
- projectRoot :: AbsolutePath -> TopLevelModuleName -> AbsolutePath
Documentation
type TopLevelModuleNameParts = List1 Text Source #
A top-level module name has one or more name parts.
data RawTopLevelModuleName Source #
Raw top-level module names (with linear-time comparisons).
Instances
rawTopLevelModuleNameToString :: RawTopLevelModuleName -> String Source #
Turns a raw top-level module name into a string.
hashRawTopLevelModuleName :: RawTopLevelModuleName -> ModuleNameHash Source #
Hashes a raw top-level module name.
rawTopLevelModuleNameForQName :: QName -> RawTopLevelModuleName Source #
Turns a qualified name into a RawTopLevelModuleName
. The
qualified name is assumed to represent a top-level module name.
rawTopLevelModuleNameForModuleName :: ModuleName -> RawTopLevelModuleName Source #
Computes the RawTopLevelModuleName
corresponding to the given
module name, which is assumed to represent a top-level module name.
Precondition: The module name must be well-formed.
rawTopLevelModuleNameForModule :: Module -> RawTopLevelModuleName Source #
Computes the top-level module name.
Precondition: The Declaration
has to be well-formed.
This means that there are only allowed declarations before the
first module declaration, typically import declarations.
See spanAllowedBeforeModule
.
data TopLevelModuleName Source #
Top-level module names (with constant-time comparisons).
Instances
lensTopLevelModuleNameParts :: Lens' TopLevelModuleName TopLevelModuleNameParts Source #
A lens focusing on the moduleNameParts
.
rawTopLevelModuleName :: TopLevelModuleName -> RawTopLevelModuleName Source #
Converts a top-level module name to a raw top-level module name.
unsafeTopLevelModuleName :: RawTopLevelModuleName -> ModuleNameHash -> TopLevelModuleName Source #
Converts a raw top-level module name and a hash to a top-level module name.
This function does not ensure that there are no hash collisions,
that is taken care of by
topLevelModuleName
.
topLevelModuleNameToQName :: TopLevelModuleName -> QName Source #
A corresponding QName
. The range of each Name
part is the
whole range of the TopLevelModuleName
.
moduleNameToFileName :: TopLevelModuleName -> String -> FilePath Source #
Turns a top-level module name into a file name with the given suffix.
projectRoot :: AbsolutePath -> TopLevelModuleName -> AbsolutePath Source #
Finds the current project's "root" directory, given a project file and the corresponding top-level module name.
Example: If the module "A.B.C" is located in the file "fooABC.agda", then the root is "foo".
Precondition: The module name must be well-formed.