pinchot-0.24.0.0: Write grammars, not parsers

Safe HaskellNone
LanguageHaskell2010

Pinchot.Names

Description

Template Haskell names and values.

Synopsis

Documentation

typeT :: TypeQ Source #

t as a type

typeA :: TypeQ Source #

a as a type

typeR :: TypeQ Source #

r as a type

tyVarBndrT :: TyVarBndr Source #

t as a TyVarBndr

tyVarBndrA :: TyVarBndr Source #

a as a TyVarBndr

tyVarBndrR :: TyVarBndr Source #

r as a TyVarBndr

productions :: Name Source #

Productions

recordName :: String -> Name Source #

a' followed by the given string.

qualRecordName :: Qualifier -> String -> String Source #

Qualified record name.

newtype Namer a Source #

Environment for the creation of new names. Each name is associated with an arbitrary String. Useful for assigning a new unique name to match a particular Pinchot identifier. Use getName to get the name associated with a particular identifier, creating it if necessary.

Constructors

Namer (StateT (Map String Name) Q a) 

Instances

Monad Namer Source # 

Methods

(>>=) :: Namer a -> (a -> Namer b) -> Namer b #

(>>) :: Namer a -> Namer b -> Namer b #

return :: a -> Namer a #

fail :: String -> Namer a #

Functor Namer Source # 

Methods

fmap :: (a -> b) -> Namer a -> Namer b #

(<$) :: a -> Namer b -> Namer a #

Applicative Namer Source # 

Methods

pure :: a -> Namer a #

(<*>) :: Namer (a -> b) -> Namer a -> Namer b #

(*>) :: Namer a -> Namer b -> Namer b #

(<*) :: Namer a -> Namer b -> Namer a #

liftQ :: Q a -> Namer a Source #

runNamer :: Namer a -> Q a Source #

getName :: String -> Namer Name Source #

Get th Name that corresponds to a particular string. If necessary, creates the name.

type Qualifier = String Source #

Many functions take an argument that holds the name qualifier for the module that contains the data types created by applying a function such as syntaxTrees or earleyProduct.

You will have to make sure that these data types are in scope. The spliced Template Haskell code has to know where to look for these data types. If you did an unqualified import or if the types are in the same module as the function that takes a Qualifier argument, just pass the empty string here. If you did a qualified import, use the appropriate qualifier here.

For example, if you used import qualified MyAst, pass "MyAst" here. If you used import qualified Data.MyLibrary.MyAst as MyLibrary.MyAst, pass "MyLibrary.MyAst" here.

quald Source #

Arguments

:: Qualifier 
-> String

Item to be named - constructor, value, etc.

-> String 

Prepends a qualifier to a string, and returns the resulting Name.