git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add a hack to be able to browse prelude's signatures.
commit909deffd5170a66a3a4c3fff5c83240a3df7795d authorAntoine R. Dumont <antoine.romain.dumont@gmail.com> dateFri 31 Oct 2014, 14:44 (12 years ago) parentfb7241c
1 file changed+10−4
psci/Main.hs+10−4
psci/Main.hs+10−4
@@ -353,13 +353,19 @@ handleBrowse moduleName = do
353353 moduleToPath :: String -> FilePath
354354 moduleToPath = (pathSeparator:) . (++ ".purs") . map (\x -> if x == '.' then pathSeparator else x) . N.runModuleName . N.moduleNameFromString
355355
356+ -- HACK - permit to `:b` prelude modules - I do not know better
357+ preludeModules = ["Prelude", "Data.Function", "Data.Eq", "Prelude.Unsafe",
358+ "Control.Monad.Eff", "Control.Monad.Eff.Unsafe",
359+ "Debug.Trace", "Control.Monad.ST"]
360+
356361 -- find the fully qualified module path (key to full module) - "" if not found
357362 findModulePath :: [FilePath] -> String -> Either String FilePath
358363 findModulePath _ [] = Left "Module must be specified."
359− findModulePath filePaths modName = let partialModulePath = moduleToPath modName in
360− case filter (isInfixOf partialModulePath) filePaths of
361− [] -> Left $ "Module ('" ++ modName ++ "','" ++ partialModulePath ++ "') was not found."
362− (x:_) -> Right x
364+ findModulePath filePaths modName =
365+ let partialModulePath = if modName `elem` preludeModules then "/prelude/prelude.purs" else moduleToPath modName in
366+ case filter (isInfixOf partialModulePath) filePaths of
367+ [] -> Left $ "Module ('" ++ modName ++ "','" ++ partialModulePath ++ "') was not found."
368+ (x:_) -> Right x
363369
364370 -- retrieve explicit types
365371 getSignature (P.PositionedDeclaration _ d) = getSignature d