git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Refactor - Remove comments + improve intermediary function name
commit429807f686d96fcc07556cafad3e0463627a10e8 authorAntoine R. Dumont <antoine.romain.dumont@gmail.com> dateFri 31 Oct 2014, 14:47 (12 years ago) parent909deff
1 file changed+5−7
psci/Main.hs+5−7
psci/Main.hs+5−7
@@ -347,7 +347,7 @@ handleBrowse :: P.ModuleName -> PSCI ()
347347handleBrowse moduleName = do
348348 PSCiState { psciLoadedModules = loadedModules
349349 , psciImportedFilenames = loadedPaths} <- PSCI $ lift get
350− psciIO $ (readModuleTypes loadedModules . findModulePath loadedPaths . N.runModuleName) moduleName >>= putStrLn
350+ psciIO $ (readModuleTypes loadedModules . findKeyModulePath loadedPaths . N.runModuleName) moduleName >>= putStrLn
351351 return ()
352352 where
353353 moduleToPath :: String -> FilePath
@@ -358,21 +358,19 @@ handleBrowse moduleName = do
358358 "Control.Monad.Eff", "Control.Monad.Eff.Unsafe",
359359 "Debug.Trace", "Control.Monad.ST"]
360360
361− -- find the fully qualified module path (key to full module) - "" if not found
362− findModulePath :: [FilePath] -> String -> Either String FilePath
363− findModulePath _ [] = Left "Module must be specified."
364− findModulePath filePaths modName =
361+ -- find the fully qualified module path (key to full module)
362+ findKeyModulePath :: [FilePath] -> String -> Either String FilePath
363+ findKeyModulePath _ [] = Left "Module must be specified."
364+ findKeyModulePath filePaths modName =
365365 let partialModulePath = if modName `elem` preludeModules then "/prelude/prelude.purs" else moduleToPath modName in
366366 case filter (isInfixOf partialModulePath) filePaths of
367367 [] -> Left $ "Module ('" ++ modName ++ "','" ++ partialModulePath ++ "') was not found."
368368 (x:_) -> Right x
369369
370− -- retrieve explicit types
371370 getSignature (P.PositionedDeclaration _ d) = getSignature d
372371 getSignature (P.TypeDeclaration ident mtype) = Just $ show ident ++ " :: " ++ prettyPrintType mtype
373372 getSignature _ = Nothing
374373
375− -- pretty print module's signature
376374 signatures :: P.Module -> [String]
377375 signatures (P.Module _ ds _) = mapMaybe getSignature ds
378376