Portability | portable (Haskell2010) |
---|---|
Stability | provisional |
Maintainer | julian.fleischer@fu-berlin.de |
Safe Haskell | Safe-Inferred |
Utilities for dealing with Class, Package, and Module names in the Java and Haskell languages.
- javaKeywords :: [String]
- haskellKeywords :: [String]
- makeName :: Maybe String -> String -> String
- makePackageModuleName :: String -> String
- makeClassModuleName :: String -> String
- splitClassName :: String -> (String, String)
- joinClassName :: (String, String) -> String
- takePackageName :: String -> Maybe String
- takeClassName :: String -> String
- takeBaseClassName :: String -> String
- takeEnclosingClasses :: String -> [String]
Documentation
javaKeywords :: [String]Source
makeName :: Maybe String -> String -> StringSource
Build the name of a class based on maybe a package and a class name.
makePackageModuleName :: String -> StringSource
Translates a package name into a module name.
makeClassModuleName :: String -> StringSource
Translates a class name into a module name.
splitClassName :: String -> (String, String)Source
Splits a class name into package name and class name.
If the name does not contain a package component, the first string is empty.
See also joinClassName
.
joinClassName :: (String, String) -> StringSource
Pendant to splitClassName
.
takePackageName :: String -> Maybe StringSource
Retrieve the package name form a simple name of a class.
>>>
takePackageName "java.lang.A$B"
Just "java.lang"
>>>
takePackageName "Test"
Nothing
takeClassName :: String -> StringSource
Retrieve the class name form a simple name of a class. This also contains the name of the enclosing class(es).
>>>
takeClassName "java.lang.A$B"
"A$B"
>>>
takeClassName "Thread$State"
"Thread$State"
takeBaseClassName :: String -> StringSource
Retrieve the class name form a simple name of a class. This contains only the name of the class itself.
>>>
takeBaseClassName "java.lang.A$B"
"B"
takeEnclosingClasses :: String -> [String]Source
Retrieve the names of the enclosing classes from a simple class name.
>>>
takeEnclosingClasses "java.lang.Map$EntrySet"
["java.lang.Map"]
>>>
takeEnclosingClasses "package.A$B$C"
["package.A", "package.A$B"]