Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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.
Synopsis
- data RdrNameStr
- data RawNameSpace
- = Constructor
- | Value
- rdrNameStrToString :: RdrNameStr -> String
- qual :: ModuleNameStr -> OccNameStr -> RdrNameStr
- unqual :: OccNameStr -> RdrNameStr
- data OccNameStr
- occNameStrToString :: OccNameStr -> String
- occNameStrNamespace :: OccNameStr -> RawNameSpace
- occNameToStr :: OccName -> OccNameStr
- nameToStr :: Name -> OccNameStr
- newtype ModuleNameStr = ModuleNameStr {}
- moduleNameStrToString :: ModuleNameStr -> String
RdrNameStr
data RdrNameStr Source #
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")
Instances
IsString RdrNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal fromString :: String -> RdrNameStr # | |
Show RdrNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal showsPrec :: Int -> RdrNameStr -> ShowS # show :: RdrNameStr -> String # showList :: [RdrNameStr] -> ShowS # | |
Eq RdrNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal (==) :: RdrNameStr -> RdrNameStr -> Bool # (/=) :: RdrNameStr -> RdrNameStr -> Bool # | |
Ord RdrNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal compare :: RdrNameStr -> RdrNameStr -> Ordering # (<) :: RdrNameStr -> RdrNameStr -> Bool # (<=) :: RdrNameStr -> RdrNameStr -> Bool # (>) :: RdrNameStr -> RdrNameStr -> Bool # (>=) :: RdrNameStr -> RdrNameStr -> Bool # max :: RdrNameStr -> RdrNameStr -> RdrNameStr # min :: RdrNameStr -> RdrNameStr -> RdrNameStr # |
data RawNameSpace Source #
Instances
Show RawNameSpace Source # | |
Defined in GHC.SourceGen.Name.Internal showsPrec :: Int -> RawNameSpace -> ShowS # show :: RawNameSpace -> String # showList :: [RawNameSpace] -> ShowS # | |
Eq RawNameSpace Source # | |
Defined in GHC.SourceGen.Name.Internal (==) :: RawNameSpace -> RawNameSpace -> Bool # (/=) :: RawNameSpace -> RawNameSpace -> Bool # | |
Ord RawNameSpace Source # | |
Defined in GHC.SourceGen.Name.Internal compare :: RawNameSpace -> RawNameSpace -> Ordering # (<) :: RawNameSpace -> RawNameSpace -> Bool # (<=) :: RawNameSpace -> RawNameSpace -> Bool # (>) :: RawNameSpace -> RawNameSpace -> Bool # (>=) :: RawNameSpace -> RawNameSpace -> Bool # max :: RawNameSpace -> RawNameSpace -> RawNameSpace # min :: RawNameSpace -> RawNameSpace -> RawNameSpace # |
qual :: ModuleNameStr -> OccNameStr -> RdrNameStr Source #
unqual :: OccNameStr -> RdrNameStr Source #
OccNameStr
data OccNameStr Source #
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.)
Instances
IsString OccNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal fromString :: String -> OccNameStr # | |
Show OccNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal showsPrec :: Int -> OccNameStr -> ShowS # show :: OccNameStr -> String # showList :: [OccNameStr] -> ShowS # | |
Eq OccNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal (==) :: OccNameStr -> OccNameStr -> Bool # (/=) :: OccNameStr -> OccNameStr -> Bool # | |
Ord OccNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal compare :: OccNameStr -> OccNameStr -> Ordering # (<) :: OccNameStr -> OccNameStr -> Bool # (<=) :: OccNameStr -> OccNameStr -> Bool # (>) :: OccNameStr -> OccNameStr -> Bool # (>=) :: OccNameStr -> OccNameStr -> Bool # max :: OccNameStr -> OccNameStr -> OccNameStr # min :: OccNameStr -> OccNameStr -> OccNameStr # |
occNameToStr :: OccName -> OccNameStr Source #
Converts a GHC OccName
to an OccNameStr
. Ignores whether the input
came from the namespace of types or of values.
nameToStr :: Name -> OccNameStr Source #
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.
newtype ModuleNameStr Source #
A newtype wrapper around ModuleName
which is an instance of IsString
.
Instances
IsString ModuleNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal fromString :: String -> ModuleNameStr # | |
Show ModuleNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal showsPrec :: Int -> ModuleNameStr -> ShowS # show :: ModuleNameStr -> String # showList :: [ModuleNameStr] -> ShowS # | |
Eq ModuleNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal (==) :: ModuleNameStr -> ModuleNameStr -> Bool # (/=) :: ModuleNameStr -> ModuleNameStr -> Bool # | |
Ord ModuleNameStr Source # | |
Defined in GHC.SourceGen.Name.Internal compare :: ModuleNameStr -> ModuleNameStr -> Ordering # (<) :: ModuleNameStr -> ModuleNameStr -> Bool # (<=) :: ModuleNameStr -> ModuleNameStr -> Bool # (>) :: ModuleNameStr -> ModuleNameStr -> Bool # (>=) :: ModuleNameStr -> ModuleNameStr -> Bool # max :: ModuleNameStr -> ModuleNameStr -> ModuleNameStr # min :: ModuleNameStr -> ModuleNameStr -> ModuleNameStr # |