on master help sign in
Get rid of warnings
defb47dEvan Czaplicki
compiler/Metadata/Prelude.hs+6−17
@@ -43,27 +43,16 @@ safeReadDocs name =
43 , " and specify your versions of Elm and your OS" ]
43 , " and specify your versions of Elm and your OS" ]
44 exitFailure
44 exitFailure
45
45
46−firstModuleInterface :: [(String, ModuleInterface)] ->
47− Either String (String, ModuleInterface)
46+hasInterfaces :: [(String, ModuleInterface)] -> Either String [(String, ModuleInterface)]
48−firstModuleInterface interfaces =
49− case interfaces of
50− [] -> Left "No interfaces found in serialized Prelude!"
47+hasInterfaces [] = Left "No interfaces found in serialized Prelude!"
51− iface:_ -> Right iface
48+hasInterfaces ifaces = Right ifaces
52
49
53readDocs :: FilePath -> IO Interfaces
50readDocs :: FilePath -> IO Interfaces
54readDocs filePath = do
51readDocs filePath = do
55 bytes <- IS.loadInterface filePath
52 bytes <- IS.loadInterface filePath
56 let interfaces = IS.interfaceDecode filePath =<< bytes
53 let interfaces = IS.interfaceDecode filePath =<< bytes
57−
58− -- Although every ModuleInterface that is deserialized in this collection
59− -- contains the compiler version, we only check the first ModuleInterface
60− -- since it doesn't make sense that different modules in Prelude would
61− -- have been compiled by different compiler versions.
62− isValid = IS.validVersion filePath =<< firstModuleInterface =<< interfaces
54+ case mapM (IS.validVersion filePath) =<< hasInterfaces =<< interfaces of
63−
55+ Right ifaces -> return $ Map.fromList ifaces
64− case (interfaces, isValid) of
65− (_, Left err) -> do
56+ Left err -> do
66 hPutStrLn stderr err
57 hPutStrLn stderr err
67 exitFailure
58 exitFailure
68−
69− (Right ifaces, _) -> return $ Map.fromList ifaces