HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleghc-source-gen-0.4.6.0Haskell2010

GHC.SourceGen.Name

This module defines custom types for defining names of various syntax terms.

These types are all instances of IsString. For ease of use, we recommend enabling the OverloadedStrings extension.

  • 4 types
  • 8 values

RdrNameStr

5 declarations
datadata RdrNameStr
#

A string identifier which may be qualified to a particular module.

RdrNameStr wraps an OccNameStr and thus keeps track of whether it is a "constructor" or "variable" (e.g.: "Foo.Bar" vs "Foo.bar", respectively).

RdrNameStr is simililar in purpose to GHC's RdrName. However, unlike RdrName, RdrNameStr does not differentiate between the namespace of types and of values. Functions in this package that take a RdrNameStr as input will internally convert it to the proper namespace. (This approach makes it easier to implement an IsString instance without the context where a name would be used.)

For example:

fromString "A.B.c" == QualStr (fromString "A.B") (fromString "c")
fromString "c" == UnqualStr (fromString "c")
Instances4Eq, Ord, Show, IsString
  • Eq RdrNameStrDefined in ghc-source-gen-0.4.6.0 · GHC.SourceGen.Name.Internal
  • Ord RdrNameStrDefined in ghc-source-gen-0.4.6.0 · GHC.SourceGen.Name.Internal
  • Show RdrNameStrDefined in ghc-source-gen-0.4.6.0 · GHC.SourceGen.Name.Internal
  • IsString RdrNameStrDefined in ghc-source-gen-0.4.6.0 · GHC.SourceGen.Name.Internal

OccNameStr

7 declarations
datadata OccNameStr
#

A string identifier referring to a name.

OccNameStr keeps track of whether it is a "constructor" or "variable" (e.g.: "Foo" vs "foo", respectively).

OccNameStr is simililar in purpose to GHC's OccName. However, unlike OccName, OccNameStr does not differentiate between the namespace of types and of values. Functions in this package that take an OccNameStr as input will internally convert it to the proper namespace. (This approach makes it easier to implement an IsString instance without the context where a name would be used.)

Instances4Eq, Ord, Show, IsString
  • Eq OccNameStrDefined in ghc-source-gen-0.4.6.0 · GHC.SourceGen.Name.Internal
  • Ord OccNameStrDefined in ghc-source-gen-0.4.6.0 · GHC.SourceGen.Name.Internal
  • Show OccNameStrDefined in ghc-source-gen-0.4.6.0 · GHC.SourceGen.Name.Internal
  • IsString OccNameStrDefined in ghc-source-gen-0.4.6.0 · GHC.SourceGen.Name.Internal
valuenameToStr :: Name -> OccNameStr
#

Converts from a GHC Name to an OccNameStr. Ignores whether the input came from the namespace of types or of values, as well as any other information about where the name came from.

newtypenewtype ModuleNameStr
#

A newtype wrapper around ModuleName which is an instance of IsString.

Instances4Eq, Ord, Show, IsString