Sdf2HaskellContentsIndex
HaskellLib
Portability portable
Stability experimental
Maintainer Joost Visser
Contents
Templates for code generation
Merging declarations
Description
This module is part of Sdf2Haskell, a tool for generating Haskell code from an SDF grammar. This module contains functions for manipulating Haskell terms.
Synopsis
dummyModule :: HsModule
mkModule :: String -> [HsImportDecl] -> [HsDecl] -> HsModule
mkTyApp :: String -> [HsType] -> HsType
mkTyCon :: String -> HsType
mkApp :: String -> [HsExp] -> HsExp
mkInfixApp :: HsExp -> HsQOp -> [HsExp] -> HsExp
noLoc :: SrcLoc
mkImports :: [String] -> [HsImportDecl]
mkVar :: String -> HsExp
mergeDataDecls :: [HsDecl] -> [HsDecl]
mergeDecls :: (HsDecl -> [HsDecl] -> [HsDecl]) -> [HsDecl] -> [HsDecl]
Templates for code generation
dummyModule :: HsModule
Not used.
mkModule :: String -> [HsImportDecl] -> [HsDecl] -> HsModule
Construct a module from its name and list of top-level declarations.
mkTyApp :: String -> [HsType] -> HsType
Construct a type constructor application from the type constructor name and a list of type arguments.
mkTyCon :: String -> HsType
Construct a type constructor from its name.
mkApp :: String -> [HsExp] -> HsExp
Construct application of a function to several expressions.
mkInfixApp :: HsExp -> HsQOp -> [HsExp] -> HsExp
Construct repeated infix application
noLoc :: SrcLoc
Construct a dummy source location.
mkImports :: [String] -> [HsImportDecl]
Construct a list of import declarations, given the names of the modules to be imported.
mkVar :: String -> HsExp
Construct a variable.
Merging declarations
mergeDataDecls :: [HsDecl] -> [HsDecl]
Merge Haskell data declarations with a single data constructor each into data declarations with multiple data constructors, by grouping on data type names.
mergeDecls :: (HsDecl -> [HsDecl] -> [HsDecl]) -> [HsDecl] -> [HsDecl]
General function for merging Haskell declarations.
Produced by Haddock version 0.6