Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Abstract syntax tree and pretty-printing for Haskell 98. This is only a small subset of the Haskell 98 syntax, so we do not need to pull in haskell-src and all its complexity. Moreover, haskell-src gives too little control over the format of pretty-printed text output.
- class HsPretty a where
- data Module = Module {}
- newtype ExportSpec = ExportSpec [String]
- newtype ImportDecl = ImportDecl [String]
- data Decl = Decl {}
- operatorTable :: Map String Operator
Documentation
A Haskell module; moduleDecls are functions and variables.
Module | |
|
newtype ExportSpec Source
A Haskell module's export spec: a list of function and variable identifiers
newtype ImportDecl Source
A Haskell modules import decls: a list of module identifiers. No support for "qualified" or "as" or for selecting only some identifiers from the imported modules.
A Haskell function or variable declaration. An explicit type declaration is optional. Thus we have just enough for name :: type name [args] = expr. Of course [args] would be empty if it's just a variable.
operatorTable :: Map String Operator Source
The Haskell operators. Now what about the associativity of (:)? It really doesn't even make sense to ask if (:) is associative in the usual sense, since (x1 : x2) : xs == x1 : (x2 : xs) is not only untrue, but the left-hand side is a type error, except maybe in some very special cases (and then the right-hand side would probably be a type error). Is (:) what is called a "right-associative" operator? And do I need to expand my Operator type to include this? And then what about (-) and (/)??? Does this affect their relationship with (+) and (-)?