GHC.Utils.Lexeme

ghc-lib-parser-9.10.1.20250103: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Utils.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 #

startsVarId :: Char -> Bool #

startsConSym :: Char -> Bool #

startsConId :: Char -> Bool #

# 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?