Safe Haskell | None |
---|---|
Language | Haskell2010 |
Operations to connect dual constructions.
Synopsis
- importDuals :: Q DualMappings -> Q [Dec]
- exportDuals :: String -> Q [Dec]
- emptyDuals :: Q DualMappings
- dualType :: Type -> Q Type
- dualExp :: Exp -> Q Exp
- makeDualClass :: Name -> String -> [(Name, String)] -> Q [Dec]
- makeDualDec :: Q [Dec] -> String -> Q [Dec]
- labelDual :: Name -> Name -> Q [Dec]
- labelSelfDual :: Name -> Q [Dec]
- labelSemiDual :: Name -> Name -> Q [Dec]
Documentation
importDuals :: Q DualMappings -> Q [Dec] Source #
Imports duals from other modules via the var created by exportDuals
in
that other module.
exportDuals :: String -> Q [Dec] Source #
Creates a value that can be referenced in other modules to load the duals defined in this module. Should be used at the bottom of any module that uses this module.
emptyDuals :: Q DualMappings Source #
The empty set of duals, should only be used to initalize the duals for
Prelude
.
dualExp :: Exp -> Q Exp Source #
Convert an expression to its dual (i.e., an implementation for the dual of the input expression’s type)
makeDualClass :: Name -> String -> [(Name, String)] -> Q [Dec] Source #
Given a class, creates a new class that represents its dual, with the list containing name mappings of methods to their duals.
makeDualDec :: Q [Dec] -> String -> Q [Dec] Source #
Creates both the original declaration and its dual. Should only work for declarations that introduce exactly one top-level name.