diff options
Diffstat (limited to 'Omni/Namespace.hs')
-rw-r--r-- | Omni/Namespace.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Omni/Namespace.hs b/Omni/Namespace.hs index ef8cefd..5884507 100644 --- a/Omni/Namespace.hs +++ b/Omni/Namespace.hs @@ -17,6 +17,7 @@ module Omni.Namespace fromPythonModule, isCab, groupByExt, + dotSeparated, ) where @@ -93,13 +94,17 @@ fromHaskellContent c = case Regex.findFirstInfix haskellModule c of </ (Regex.string "\nmodule " *> Regex.many (name <|> dot)) <*> pure Hs +dotSeparated :: [String] -> String +dotSeparated = joinWith "." + toModule :: Namespace -> String -toModule (Namespace parts Hs) = joinWith "." parts -toModule (Namespace parts Py) = joinWith "." parts +toModule (Namespace parts Hs) = dotSeparated parts +toModule (Namespace parts Py) = dotSeparated parts toModule (Namespace parts Scm) = "(" ++ joinWith " " parts ++ ")" toModule (Namespace parts Rs) = joinWith "::" parts toModule (Namespace parts C) = joinWith "/" parts <> ".c" toModule (Namespace parts Nix) = joinWith "/" parts <> ".nix" +toModule (Namespace parts Lisp) = "(" ++ joinWith " " parts ++ ")" toModule (Namespace {..}) = panic <| "toModule not implemented for " <> show ext toHaskellModule :: Namespace -> String |