2013-03-17 05:24:18 +00:00
|
|
|
|
2013-03-21 09:29:23 +00:00
|
|
|
module LoadLibraries (docs) where
|
2013-03-17 05:24:18 +00:00
|
|
|
|
|
|
|
import Language.Haskell.TH.Syntax
|
|
|
|
import Paths_Elm
|
2013-03-21 09:29:23 +00:00
|
|
|
import System.Directory
|
2013-03-17 05:24:18 +00:00
|
|
|
|
|
|
|
docs :: Q Exp
|
2013-03-21 09:29:23 +00:00
|
|
|
docs = liftString =<< qRunIO readDocs
|
2013-03-17 05:24:18 +00:00
|
|
|
|
2013-03-21 09:29:23 +00:00
|
|
|
readDocs :: IO String
|
|
|
|
readDocs = do
|
|
|
|
name <- getDataFileName "docs.json"
|
|
|
|
exists <- doesFileExist name
|
|
|
|
if exists then readFile name
|
|
|
|
else putStrLn warning >> return "{\"modules\":[]}"
|
|
|
|
|
|
|
|
warning = "Warning! Types for standard library not loaded properly!\n\
|
|
|
|
\Run the following commands after compilation:\n\
|
|
|
|
\\n\
|
|
|
|
\ touch compiler/Model/LoadLibraries.hs\n\
|
|
|
|
\ cabal install\n\n"
|