ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

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

isLexVar :: FastString -> Bool Source #

isLexId :: FastString -> Bool Source #

isLexSym :: FastString -> Bool Source #

isLexConId :: FastString -> Bool Source #

isLexConSym :: FastString -> Bool Source #

isLexVarId :: FastString -> Bool Source #

isLexVarSym :: FastString -> Bool Source #

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

Is this an acceptable variable name?

okConOcc :: String -> Bool Source #

Is this an acceptable constructor name?

okTcOcc :: String -> Bool Source #

Is this an acceptable type name?

okVarIdOcc :: String -> Bool Source #

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

okVarSymOcc :: String -> Bool Source #

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

okConIdOcc :: String -> Bool Source #

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

okConSymOcc :: String -> Bool Source #

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