on master help sign in
Get rid of warnings
commitdefb47db7505a518fd125d964e2f3f544345bd2d authorEvan Czaplicki <info@elm-lang.org> dateSat 4 Jan 2014, 11:34 (13 years ago) parentc966776
1 file changed+6−17
compiler/Metadata/Prelude.hs+6−17
compiler/Metadata/Prelude.hs+6−17
@@ -43,27 +43,16 @@ safeReadDocs name =
4343 , " and specify your versions of Elm and your OS" ]
4444 exitFailure
4545
46−firstModuleInterface :: [(String, ModuleInterface)] ->
47− Either String (String, ModuleInterface)
48−firstModuleInterface interfaces =
49− case interfaces of
50− [] -> Left "No interfaces found in serialized Prelude!"
51− iface:_ -> Right iface
46+hasInterfaces :: [(String, ModuleInterface)] -> Either String [(String, ModuleInterface)]
47+hasInterfaces [] = Left "No interfaces found in serialized Prelude!"
48+hasInterfaces ifaces = Right ifaces
5249
5350readDocs :: FilePath -> IO Interfaces
5451readDocs filePath = do
5552 bytes <- IS.loadInterface filePath
5653 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
63−
64− case (interfaces, isValid) of
65− (_, Left err) -> do
54+ case mapM (IS.validVersion filePath) =<< hasInterfaces =<< interfaces of
55+ Right ifaces -> return $ Map.fromList ifaces
56+ Left err -> do
6657 hPutStrLn stderr err
6758 exitFailure
68−
69− (Right ifaces, _) -> return $ Map.fromList ifaces