1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Elm.Compiler.Objects.Internal
16import Prelude hiding (lookup)
17import Control.Arrow (first)
18import Control.Monad (liftM2)
20import qualified Data.Map as Map
21import qualified Data.Text as Text
23import qualified AST.Expression.Optimized as Opt
24import qualified AST.Kernel as Kernel
25import qualified AST.Module.Name as ModuleName
26import qualified AST.Module as Module
27import qualified AST.Variable as Var
36 { _decls :: Map.Map Var.Global Opt.Decl
37 , _kernels :: Map.Map ModuleName.Raw Kernel.Info
42-- OBJECT GRAPH HELPERS
45fromModule :: Module.Optimized -> Graph
46fromModule (Module.Module home info) =
49 Map.fromList $ map (first (Var.Global home)) (Module.program info)
54union :: Graph -> Graph -> Graph
55union (Graph decls1 kernels1) (Graph decls2 kernels2) =
56 Graph (Map.union decls1 decls2) (Map.union kernels1 kernels2)
59unions :: [Graph] -> Graph
62 (Map.unions (map _decls graphs))
63 (Map.unions (map _kernels graphs))
71 = Mains [ModuleName.Canonical]
72 | Value ModuleName.Canonical Text.Text
75mains :: [ModuleName.Canonical] -> Roots
80value :: ModuleName.Canonical -> String -> Roots
82 Value home (Text.pack name)
85toGlobals :: Roots -> [Var.Global]
89 map (\home -> Var.Global home "main") modules
92 [ Var.Global home name ]
99instance Binary Graph where
100 put (Graph decls kernels) =
101 put decls >> put kernels
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