summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2023-08-10 21:07:15 -0400
committerBen Sima <ben@bsima.me>2023-08-10 21:07:15 -0400
commita86cfcf95b19de667c88594f71324ee3370b9776 (patch)
treedbcfb27b6c326806dc26b503dcaeee3ea06ea88d /Biz
parent44b1f8d5bc2ffcb00f56b0096476501e7e0cd458 (diff)
Allow underscores in namespaces
Diffstat (limited to 'Biz')
-rw-r--r--Biz/Namespace.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Biz/Namespace.hs b/Biz/Namespace.hs
index f0e3b32..8cc6b5c 100644
--- a/Biz/Namespace.hs
+++ b/Biz/Namespace.hs
@@ -86,6 +86,7 @@ fromHaskellContent c = case Regex.findFirstInfix haskellModule c of
</ (Regex.string "\nmodule " *> Regex.many (name <|> dot))
<*> pure Hs
+toModule :: Namespace -> String
toModule (Namespace parts Hs) = joinWith "." parts
toModule (Namespace parts Py) = joinWith "." parts
toModule (Namespace parts Scm) = "(" ++ joinWith " " parts ++ ")"
@@ -106,7 +107,7 @@ dot = Regex.some <| Regex.sym '.'
name :: Regex.RE Char String
name =
Regex.many (Regex.psym Char.isUpper)
- <> Regex.many (Regex.psym Char.isAlphaNum)
+ <> Regex.many (Regex.psym (\c -> Char.isAlphaNum c || (c == '_')))
rePath :: Regex.RE Char [String]
rePath = Regex.many (name <* Regex.string "/" <|> name)
@@ -130,4 +131,4 @@ reExt =
-- inputs.
isCab :: FilePath -> Bool
isCab ('_' : _) = True
-isCab fp = "_" `List.isInfixOf` fp
+isCab fp = "/_/" `List.isInfixOf` fp