HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Modulehaskell-src-exts-1.24.0Haskell98

Language.Haskell.Exts.Build

This module contains combinators to use when building Haskell source trees programmatically, as opposed to parsing them from a string. The contents here are quite experimental and will likely receive a lot of attention when the rest has stabilised.

Contents
  1. Syntax building functions
  2. More advanced building
Synopsis

Syntax building functions

valuename :: String -> Name ()

An identifier with the given string as its name. The string should be a valid Haskell identifier.

valuesym :: String -> Name ()

A symbol identifier. The string should be a valid Haskell symbol identifier.

valueop :: Name () -> QOp ()

Use the given identifier as an operator.

valuedoE :: [Stmt ()] -> Exp ()

A do block formed by the given statements. The last statement in the list should be a Qualifier expression.

valuelamE :: [Pat ()] -> Exp () -> Exp ()

Lambda abstraction, given a list of argument patterns and an expression body.

valuealt :: Pat () -> Exp () -> Alt ()

An unguarded alternative in a case expression.

More advanced building

valuesimpleFun :: Name () -> Name () -> Exp () -> Decl ()

A function with a single clause, a single argument, no guards and no where declarations

valuepatBind :: Pat () -> Exp () -> Decl ()

A pattern bind where the pattern is a variable, and where there are no guards and no where clause.

valuepatBindWhere :: Pat () -> Exp () -> [Decl ()] -> Decl ()

A pattern bind where the pattern is a variable, and where there are no guards, but with a where clause.

valuemetaConPat :: String -> [Pat ()] -> Pat ()

Apply a constructor of a given name to a list of pattern arguments, forming a constructor pattern.