ghc-source-gen-0.4.3.0: Constructs Haskell syntax trees for the GHC API.
Safe HaskellNone
LanguageHaskell2010

GHC.SourceGen.Pat

Description

This module provides combinators for constructing Haskell patterns.

Synopsis

Documentation

type Pat' = Pat GhcPs Source #

A Haskell pattern, as it is represented after the parsing step.

Instances:

wildP :: Pat' Source #

A wild pattern (_).

asP :: RdrNameStr -> Pat' -> Pat' Source #

An as-pattern.

a@B
=====
asP "a" (var "B")

conP :: RdrNameStr -> [Pat'] -> Pat' Source #

A pattern constructor.

A b c
=====
conP "A" [bvar "b", bvar "c"]

conP_ :: RdrNameStr -> Pat' Source #

A pattern constructor with no arguments.

A
=====
conP_ "A"

strictP :: Pat' -> Pat' Source #

A bang-pattern.

!x
=====
strictP (bvar x)

lazyP :: Pat' -> Pat' Source #

A lazy pattern match.

~(A x)
=====
lazyP (conP "A" [bvar x])

sigP :: Pat' -> HsType' -> Pat' Source #

A pattern type signature

x :: y
=====
sigPat (bvar "x") (var "y")