@@ -23,26 +23,27 @@ loadInterface filePath = do
2323 return $ Right byteString
2424
2525 else
26− return $ Left $ "Unable to find file " ++ filePath ++
27− " for deserialization!"
26+ return $ Left $ "Unable to find file " ++ filePath ++
27+ " for deserialization!"
2828
29−interfaceDecode :: Binary.Binary a => FilePath -> L.ByteString ->
30− Either String a
29+interfaceDecode :: Binary.Binary a =>
30+ FilePath -> L.ByteString -> Either String a
3131interfaceDecode filePath bytes = do
3232 case Binary.decodeOrFail bytes of
33− Left (_, offset, err) -> do
34− Left $ "Got an error, '" ++ err ++ "' at offset " ++
35− show offset ++ " of " ++ filePath ++ ".\n\n" ++
36− "This error may be due to an outdated or corrupt " ++
37− "artifact from a previous build. Please rebuild " ++
38− filePath ++ " and try again."
39−
4033 Right (_, _, binaryInfo) -> Right binaryInfo
4134
35+ Left (_, offset, err) ->
36+ Left $ concat [ "Got an error, '" ++ err ++ "' at offset "
37+ , show offset ++ " of " ++ filePath ++ ".\n\n"
38+ , "This error may be due to an outdated or corrupt "
39+ , "artifact from a previous build. Please rebuild "
40+ , filePath ++ " and try again."
41+ ]
42+
4243validVersion :: FilePath -> (String, ModuleInterface) ->
4344 Either String (String, ModuleInterface)
4445validVersion filePath (name, interface) =
45− if (iVersion interface) == showVersion version then
46+ if iVersion interface == showVersion version then
4647 Right (name, interface)
4748 else
4849 Left $ "Found build artifacts created by a different " ++