on master help sign in
Merge pull request #331 from jsl/327_fix_invalid_interface_map
4b480a9Evan Czaplicki
compiler/Metadata/Prelude.hs+4−9
@@ -47,9 +47,10 @@ safeReadDocs name =
47 , " and specify your versions of Elm and your OS" ]
47 , " and specify your versions of Elm and your OS" ]
48 exitFailure
48 exitFailure
49
49
50+firstModuleInterface :: [(String, ModuleInterface)] ->
50−firstModuleInterface :: Interfaces -> Either String (String, ModuleInterface)
51+ Either String (String, ModuleInterface)
51firstModuleInterface interfaces =
52firstModuleInterface interfaces =
52− case Map.toList interfaces of
53+ case interfaces of
53 [] -> Left "No interfaces found in serialized Prelude!"
54 [] -> Left "No interfaces found in serialized Prelude!"
54 iface:_ -> Right iface
55 iface:_ -> Right iface
55
56
@@ -69,10 +70,4 @@ readDocs filePath = do
69 hPutStrLn stderr err
70 hPutStrLn stderr err
70 exitFailure
71 exitFailure
71
72
72− -- Unwrapping the Right value here is safe since the whole above chain
73− -- returns a Right value. The toList/fromList is necessary because of a
74− -- problem with looking up keys in the Map after deserialization. Example
75− -- at https://gist.github.com/jsl/7294493.
76− -- TODO: try switching to Data.ByteString.Lazy.Char8
77− (Right ifaces, _) ->
78− return $ Map.fromList $ Map.toList ifaces
73+ (Right ifaces, _) -> return $ Map.fromList ifaces