Safe Haskell | None |
---|---|
Language | Haskell98 |
Abstract representation for paths into modules.
Synopsis
- newtype ModulePath = ModulePath {
- modulePathToList :: [Text]
- toModulePath :: Text -> ModulePath
- (/.) :: ModulePath -> Text -> ModulePath
- dotModulePath :: ModulePath -> Text
Documentation
newtype ModulePath Source #
A path to a module.
Instances
Eq ModulePath Source # | |
(==) :: ModulePath -> ModulePath -> Bool # (/=) :: ModulePath -> ModulePath -> Bool # | |
Ord ModulePath Source # | |
compare :: ModulePath -> ModulePath -> Ordering # (<) :: ModulePath -> ModulePath -> Bool # (<=) :: ModulePath -> ModulePath -> Bool # (>) :: ModulePath -> ModulePath -> Bool # (>=) :: ModulePath -> ModulePath -> Bool # max :: ModulePath -> ModulePath -> ModulePath # min :: ModulePath -> ModulePath -> ModulePath # | |
Show ModulePath Source # | |
showsPrec :: Int -> ModulePath -> ShowS # show :: ModulePath -> String # showList :: [ModulePath] -> ShowS # | |
IsString ModulePath Source # | Construct a |
fromString :: String -> ModulePath # | |
Semigroup ModulePath Source # | |
(<>) :: ModulePath -> ModulePath -> ModulePath # sconcat :: NonEmpty ModulePath -> ModulePath # stimes :: Integral b => b -> ModulePath -> ModulePath # | |
Monoid ModulePath Source # | |
mempty :: ModulePath # mappend :: ModulePath -> ModulePath -> ModulePath # mconcat :: [ModulePath] -> ModulePath # |
toModulePath :: Text -> ModulePath Source #
Construct a path into the given GIR namespace. The given Text
will be split along ".".
Examples
>>>
dotModulePath (toModulePath "Foo")
"Foo"
>>>
dotModulePath ("Foo" <> toModulePath "Bar.Baz")
"Foo.Bar.Baz"
>>>
dotModulePath ("Foo" <> toModulePath "bar.baz")
"Foo.Bar.Baz"
(/.) :: ModulePath -> Text -> ModulePath Source #
Append the given component to the given module path.
Examples
>>>
dotModulePath ("Foo" /. "Bar")
"Foo.Bar"
dotModulePath :: ModulePath -> Text Source #
Turn a module path into the corresponding dotted string. Note that the implementation ensures that the module names start with a capital letter.
Examples
>>>
dotModulePath ("Foo" /. "Bar" /. "Baz")
"Foo.Bar.Baz"
>>>
dotModulePath ("foo" /. "bar" /. "baz")
"Foo.Bar.Baz"