1module Metadata.Load (interfaces) where
3import qualified Control.Exception as E
8import System.IO.Unsafe (unsafePerformIO)
9import SourceSyntax.Module
12-- See stackoverflow discussion for trade-off between using unsafeIO or TemplateHaskell:
13-- http://stackoverflow.com/questions/12716215/load-pure-global-variable-from-file
15-- Given the awkwardness of including a compile-time generated file
16-- vs loading static data, then the unsafeIO seems better.
18{-# NOINLINE interfaces #-}
19interfaces :: [ModuleInterface]
20interfaces = unsafePerformIO (safeReadDocs =<< getDataFileName "interfaces.data")
22safeReadDocs :: FilePath -> IO [ModuleInterface]
24 E.catch (readDocs name) $ \err -> do
25 putStrLn $ unlines [ "Error reading types for standard library!"
26 , " The file should be located here: " ++ name
27 , " If you are using a stable version of Elm,"
28 , " please report an issue at github.com/evancz/Elm"
29 , " and specify your versions of Elm and your OS" ]
30 print (err :: IOError)
33readDocs :: FilePath -> IO [ModuleInterface]
35 exists <- doesFileExist name
36 if exists then decodeFile name
37 else ioError . userError $ "File Not Found"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list