1module Metadata.Prelude (interfaces, add) where
3import qualified Data.Map as Map
4import qualified Control.Exception as E
5import qualified Paths_Elm as Path
9import System.IO.Unsafe (unsafePerformIO)
10import SourceSyntax.Module
14add :: Module t v -> Module t v
15add (Module name exs ims stmts) = Module name exs (customIms ++ ims) stmts
17 customIms = concatMap addModule prelude
19 addModule (n, method) = case lookup n ims of
20 Nothing -> [(n, method)]
21 Just (As m) -> [(n, method)]
24prelude :: [(String, ImportMethod)]
25prelude = text : map (\n -> (n, Hiding [])) modules
27 text = ("Text", Hiding ["link", "color", "height"])
28 modules = [ "Prelude", "Signal", "List", "Maybe", "Time"
29 , "Graphics.Element", "Color", "Graphics.Collage" ]
31{-# NOINLINE interfaces #-}
32interfaces :: Interfaces
34 unsafePerformIO (safeReadDocs =<< Path.getDataFileName "interfaces.data")
36safeReadDocs :: FilePath -> IO Interfaces
38 E.catch (readDocs name) $ \err -> do
39 putStrLn $ unlines [ "Error reading types for standard library!"
40 , " " ++ show (err :: IOError)
41 , "The file should be located here: " ++ name
42 , " If you are using a stable version of Elm,"
43 , " please report an issue at github.com/evancz/Elm"
44 , " and specify your versions of Elm and your OS" ]
47readDocs :: FilePath -> IO Interfaces
49 exists <- doesFileExist name
50 if exists then decodeFile name
51 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