Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Hydra.Adapters
Description
Entry point for Hydra's adapter (type/term rewriting) framework. An adapter takes a type expression which is supported in a source language, and rewrites it to a type which is supported by a target language. In parallel, terms conforming to the original type are rewritten. Both levels of the transformation are bidirectional.
Synopsis
- adaptAndEncodeType :: Language -> (Type -> Flow Graph t) -> Type -> Flow Graph t
- adaptType :: Language -> Type -> Flow Graph Type
- constructCoder :: Language -> (Term -> Flow Graph c) -> Type -> Flow Graph (Coder Graph Graph Term c)
- languageAdapter :: Language -> Type -> Flow Graph (SymmetricAdapter Graph Type Term)
- transformModule :: Language -> (Term -> Flow Graph e) -> (Module -> Map Type (Coder Graph Graph Term e) -> [(Element, TypedTerm)] -> Flow Graph d) -> Module -> Flow Graph d
Documentation
adaptType :: Language -> Type -> Flow Graph Type Source #
Given a target language and a source type, find the target type to which the latter will be adapted.
constructCoder :: Language -> (Term -> Flow Graph c) -> Type -> Flow Graph (Coder Graph Graph Term c) Source #
Given a target language, a unidirectional last-mile encoding, and a source type, construct a unidirectional adapting coder for terms of that type. Terms will be rewritten according to the type and according to the constraints of the target language, then carried by the last mile into the final representation
languageAdapter :: Language -> Type -> Flow Graph (SymmetricAdapter Graph Type Term) Source #
Given a target language and a source type, produce an adapter, which rewrites the type and its terms according to the language's constraints
transformModule :: Language -> (Term -> Flow Graph e) -> (Module -> Map Type (Coder Graph Graph Term e) -> [(Element, TypedTerm)] -> Flow Graph d) -> Module -> Flow Graph d Source #
Given a target language, a unidirectional last mile encoding, and an intermediate helper function, transform a given module into a target representation