Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data FileIdentifier
- fileIdentifierFromFilePath :: FilePath -> FileIdentifier
- fileIdentifierFromURI :: URI -> Maybe FileIdentifier
- hashNormalToCode :: Normal -> Text
- data WellTyped
- fromWellTyped :: WellTyped -> Expr Src Void
- data Normal
- fromNormal :: Normal -> Expr Src Void
- data Cache
- emptyCache :: Cache
- invalidate :: FileIdentifier -> Cache -> Cache
- data DhallError
- parse :: Text -> Either DhallError (Expr Src Import)
- parseWithHeader :: Text -> Either DhallError (Header, Expr Src Import)
- load :: FileIdentifier -> Expr Src Import -> Cache -> IO (Either DhallError (Cache, Expr Src Void))
- typecheck :: Expr Src Void -> Either DhallError (WellTyped, WellTyped)
- normalize :: WellTyped -> Normal
Documentation
data FileIdentifier Source #
A FileIdentifier
represents either a local file or a remote url.
fileIdentifierFromFilePath :: FilePath -> FileIdentifier Source #
Construct a FileIdentifier from a local file path.
fileIdentifierFromURI :: URI -> Maybe FileIdentifier Source #
Construct a FileIdentifier from a given URI. Supports only "file:" URIs.
hashNormalToCode :: Normal -> Text Source #
Given a normal expression compute the hash (using the default standard version) of its alpha-normal form. Returns the hash in the format used in Dhall's hash annotations (prefixed by "sha256:" and base-64 encoded).
A cache maps Dhall imports to fully normalised expressions. By reusing caches we can speeds up diagnostics etc. significantly!
emptyCache :: Cache Source #
The initial cache.
invalidate :: FileIdentifier -> Cache -> Cache Source #
Invalidate any _unhashed_ imports of the given file. Hashed imports are kept around as per https://github.com/dhall-lang/dhall-lang/blob/master/standard/imports.md. Transitively invalidates any imports depending on the changed file.
data DhallError Source #
A Dhall error. Covers parsing, resolving of imports, typechecking and normalisation.
parseWithHeader :: Text -> Either DhallError (Header, Expr Src Import) Source #
Parse a Dhall expression along with its "header", i.e. whitespace and comments prefixing the actual code.
load :: FileIdentifier -> Expr Src Import -> Cache -> IO (Either DhallError (Cache, Expr Src Void)) Source #
Resolve all imports in an expression.