@@ -1,13 +1,22 @@
11
2−module LoadLibraries where
2+module LoadLibraries (docs) where
33
44import Language.Haskell.TH.Syntax
55import Paths_Elm
6+import System.Directory
67
78docs :: Q Exp
8−docs = liftString =<< qRunIO (do
9− s <- readFile =<< getDataFileName "docs.json"
10− putStrLn s
11− return s
12− )
9+docs = liftString =<< qRunIO readDocs
1310
11+readDocs :: IO String
12+readDocs = do
13+ name <- getDataFileName "docs.json"
14+ exists <- doesFileExist name
15+ if exists then readFile name
16+ else putStrLn warning >> return "{\"modules\":[]}"
17+
18+warning = "Warning! Types for standard library not loaded properly!\n\
19+ \Run the following commands after compilation:\n\
20+ \\n\
21+ \ touch compiler/Model/LoadLibraries.hs\n\
22+ \ cabal install\n\n"