Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ast.Parser.PreProcessor.Import
Synopsis
- parseImport :: String -> Parser String -> Parser String
- localImport :: String -> String -> IO String
- externalImport :: String -> IO String
Documentation
parseImport :: String -> Parser String -> Parser String Source #
Parses an import directive. Handles both local and external imports while ensuring that circular imports and excessive depth are avoided.
Local imports are resolved relative to the current file's directory. External imports fetch content over HTTP.
Returns the preprocessed source of the imported file.
localImport :: String -> String -> IO String Source #
Resolves a local import by reading a file relative to the current source file's directory.
Example:
If the sourceFile
is "pathtofile" and the import is "importedFile",
this function reads "pathtoimportedFile".
externalImport :: String -> IO String Source #
Resolves an external import by fetching content over HTTP.
If the environment variable FROST_PRIVATE_REGISTRY_AUTH
is set, it adds a Bearer token for authorization.
Example: Resolves "https://example.com/file" by making an HTTP GET request.