on master help sign in
Simplify code to read interfaces.data
7e30e1dEvan Czaplicki
compiler/Metadata/Prelude.hs+4−11
@@ -101,17 +101,10 @@ addImport (name, method) importDict =
101
101
102-- EXTRACT INTERFACES FROM STATIC FILE
102-- EXTRACT INTERFACES FROM STATIC FILE
103
103
104−interfaces :: (MonadIO m, MonadError String m) => Bool -> m Module.Interfaces
104+interfaces :: (MonadIO m, MonadError String m) => m Module.Interfaces
105−interfaces noPrelude
105+interfaces =
106− | noPrelude = return Map.empty
107− | otherwise =
108− do filePath <- liftIO (Utils.getDataFile "interfaces.data")
106+ do filePath <- liftIO (Utils.getDataFile "interfaces.data")
109− readInterfaces filePath
110−
111−
112−readInterfaces :: (MonadIO m, MonadError String m) => FilePath -> m Module.Interfaces
113−readInterfaces filePath =
114− do interfaces <- mapM (isValid filePath) =<< Artifact.read filePath
107+ interfaces <- mapM (isValid filePath) =<< Artifact.read filePath
115 case interfaces of
108 case interfaces of
116 [] -> throwError "No interfaces found in serialized Prelude!"
109 [] -> throwError "No interfaces found in serialized Prelude!"
117 _ -> return (Map.fromList interfaces)
110 _ -> return (Map.fromList interfaces)