on master help sign in
Simplify code to read interfaces.data
commit7e30e1d090d08fd14f8f5045a31cd9c170e07e6a authorEvan Czaplicki <info@elm-lang.org> dateTue 14 Oct 2014, 17:22 (12 years ago) parent9311704
1 file changed+4−11
compiler/Metadata/Prelude.hs+4−11
compiler/Metadata/Prelude.hs+4−11
@@ -101,17 +101,10 @@ addImport (name, method) importDict =
101101
102102-- EXTRACT INTERFACES FROM STATIC FILE
103103
104−interfaces :: (MonadIO m, MonadError String m) => Bool -> m Module.Interfaces
105−interfaces noPrelude
106− | noPrelude = return Map.empty
107− | otherwise =
108− 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
104+interfaces :: (MonadIO m, MonadError String m) => m Module.Interfaces
105+interfaces =
106+ do filePath <- liftIO (Utils.getDataFile "interfaces.data")
107+ interfaces <- mapM (isValid filePath) =<< Artifact.read filePath
115108 case interfaces of
116109 [] -> throwError "No interfaces found in serialized Prelude!"
117110 _ -> return (Map.fromList interfaces)