1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 10:27:45 +03:00

Take a Maybe Language in graphPackage

This commit is contained in:
joshvera 2018-04-20 19:14:50 -04:00
parent 85995afb99
commit ce0b95bb79

View File

@ -19,6 +19,7 @@ import System.FilePath.Posix
import qualified Data.ByteString.Char8 as B
import Path
import Data.Record
import Data.Language
graph :: (Members '[Distribute WrappedTask, Files, Task, Exc SomeException, Telemetry] effs)
=> Maybe FilePath
@ -45,12 +46,14 @@ graph maybeRootDir renderer Blob{..}
where packageName = name . BC.pack . dropExtensions . takeFileName
graphPackage :: (Show (Record location), Ord (Record location), Members '[Distribute WrappedTask, Files, Task, Exc SomeException, Telemetry] effs)
graphPackage :: (Members '[Distribute WrappedTask, Files, Task, Exc SomeException, Telemetry] effs)
=> GraphRenderer output
-> Path Abs Dir
-> SomeAnalysisParser '[ Analysis.Evaluatable, Analysis.Declarations1, FreeVariables1, Functor, Eq1, Ord1, Show1 ] (Record location)
-> Maybe Language
-> Eff effs ByteString
graphPackage renderer rootDir (SomeAnalysisParser parser exts preludePath) = do
graphPackage renderer rootDir blobLanguage
| Just (SomeAnalysisParser parser exts preludePath) <- someAnalysisParser
(Proxy :: Proxy '[ Analysis.Evaluatable, Analysis.Declarations1, FreeVariables1, Functor, Eq1, Ord1, Show1 ]) <$> blobLanguage = do
paths <- listFiles (toFilePath rootDir) exts
prelude <- traverse (parseModule parser Nothing) preludePath
let packageName = name . B.pack . toFilePath $ dirname rootDir