Lexeme

ghc-8.4.4: The GHC API

Safe Haskell | None
Language | Haskell2010

Lexeme

Contents

- Lexical characteristics of Haskell names
- Validating identifiers

Synopsis

- isLexCon :: FastString -> Bool
- isLexVar :: FastString -> Bool
- isLexId :: FastString -> Bool
- isLexSym :: FastString -> Bool
- isLexConId :: FastString -> Bool
- isLexConSym :: FastString -> Bool
- isLexVarId :: FastString -> Bool
- isLexVarSym :: FastString -> Bool
- startsVarSym :: Char -> Bool
- startsVarId :: Char -> Bool
- startsConSym :: Char -> Bool
- startsConId :: Char -> Bool
- okVarOcc :: String -> Bool
- okConOcc :: String -> Bool
- okTcOcc :: String -> Bool
- okVarIdOcc :: String -> Bool
- okVarSymOcc :: String -> Bool
- okConIdOcc :: String -> Bool
- okConSymOcc :: String -> Bool

# Lexical characteristics of Haskell names

Use these functions to figure what kind of name a `FastString` represents; these functions do not check that the identifier is valid.

isLexCon :: FastString -> Bool #

isLexVar :: FastString -> Bool #

isLexId :: FastString -> Bool #

isLexSym :: FastString -> Bool #

isLexConId :: FastString -> Bool #

isLexConSym :: FastString -> Bool #

isLexVarId :: FastString -> Bool #

isLexVarSym :: FastString -> Bool #

startsVarSym :: Char -> Bool Source #

startsVarId :: Char -> Bool Source #

startsConSym :: Char -> Bool Source #

startsConId :: Char -> Bool Source #

# Validating identifiers

These functions (working over plain old `String`s) check to make sure that the identifier is valid.

okVarOcc :: String -> Bool #

Is this an acceptable variable name?

okConOcc :: String -> Bool #

Is this an acceptable constructor name?

okTcOcc :: String -> Bool #

Is this an acceptable type name?

okVarIdOcc :: String -> Bool #

Is this an acceptable alphanumeric variable name, assuming it starts with an acceptable letter?

okVarSymOcc :: String -> Bool #

Is this an acceptable symbolic variable name, assuming it starts with an acceptable character?

okConIdOcc :: String -> Bool #

Is this an acceptable alphanumeric constructor name, assuming it starts with an acceptable letter?

okConSymOcc :: String -> Bool #

Is this an acceptable symbolic constructor name, assuming it starts with an acceptable character?