From 45dcfaad4188546141b0eca94f6265ddc606a498 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 21 Mar 2018 20:27:42 -0400 Subject: [PATCH] Refactor/align the language switch. --- src/Data/Abstract/Module.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/Abstract/Module.hs b/src/Data/Abstract/Module.hs index 75427729c..47aefbdff 100644 --- a/src/Data/Abstract/Module.hs +++ b/src/Data/Abstract/Module.hs @@ -24,8 +24,8 @@ moduleForBlob :: Maybe FilePath -- ^ The root directory relative to which the mo -> Module term -- ^ A 'Module' named appropriate for the 'Blob', holding the @term@, and constructed relative to the root 'FilePath', if any. moduleForBlob rootDir blob term = Module (moduleName blob) (blobPath blob) term where moduleName Blob{..} = let path = dropExtensions (maybe takeFileName makeRelative rootDir blobPath) - in case blobLanguage of + in toName $ case blobLanguage of -- TODO: Need a better way to handle module registration and resolution - Just Go -> toName (takeDirectory path) -- Go allows defining modules across multiple files in the same directory. - _ -> toName path + Just Go -> takeDirectory path -- Go allows defining modules across multiple files in the same directory. + _ -> path toName str = qualifiedName (BC.pack <$> splitWhen (== pathSeparator) str)