1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Elm.Compiler.Objects.Internal
19import Prelude hiding (lookup)
20import Control.Arrow (first)
21import Control.Monad (liftM, liftM2)
23import qualified Data.Map as Map
25import qualified AST.Expression.Optimized as Opt
26import qualified AST.Module.Name as ModuleName
27import qualified AST.Module as Module
28import qualified AST.Variable as Var
29import qualified Elm.Package as Pkg
37 Graph (Map.Map Var.Global Opt.Decl)
41-- OBJECT GRAPH HELPERS
44fromModule :: Module.Optimized -> Graph
45fromModule (Module.Module home info) =
46 Graph $ Map.fromList $
47 map (first (Var.Global home)) (Module.program info)
50union :: Graph -> Graph -> Graph
51union (Graph objs1) (Graph objs2) =
52 Graph (Map.union objs1 objs2)
55unions :: [Graph] -> Graph
57 Graph (Map.unions (map destruct graphs))
60destruct :: Graph -> Map.Map Var.Global Opt.Decl
61destruct (Graph graph) =
70 SymbolTable (Map.Map Var.Global Symbol)
73symbolTable :: Map.Map Var.Global Symbol -> SymbolTable
85lookup :: Var.Global -> SymbolTable -> Maybe Symbol
86lookup var (SymbolTable symbols) =
87 Map.lookup var symbols
95 = Main ModuleName.Canonical
98root :: Pkg.Name -> ModuleName.Raw -> Roots
100 Main (ModuleName.Canonical pkg name)
103toGlobals :: Roots -> [Var.Global]
107 [ Var.Global home "main" ]
114instance Binary Graph where
122instance Binary Symbol where
123 put (Symbol home name) =
127 liftM2 Symbol get get
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