1{-# OPTIONS_GHC -Wall #-}
11import Control.Monad (liftM4)
14import qualified Data.Map as Map
16import qualified AST.Canonical as Can
17import qualified AST.Module.Name as ModuleName
18import qualified AST.Utils.Binop as Binop
19import qualified Elm.Name as N
20import qualified Reporting.Annotation as A
28 Map.Map ModuleName.Canonical Interface
37 { _types :: Map.Map N.Name Can.Annotation
38 , _unions :: Map.Map N.Name Can.Union
39 , _aliases :: Map.Map N.Name Can.Alias
40 , _binops :: Map.Map N.Name Binop
47 , _op_annotation :: Can.Annotation
48 , _op_associativity :: Binop.Associativity
49 , _op_precedence :: Binop.Precedence
57fromModule :: Map.Map N.Name Can.Annotation -> Can.Module -> Interface
58fromModule types (Can.Module _ _ exports _ unions aliases binops _) =
60 { _types = privatize exports const types
61 , _unions = privatize exports toUnion unions
62 , _aliases = privatize exports const aliases
63 , _binops = privatize exports const (Map.map (toOp types) binops)
67privatize :: Can.Exports -> (a -> A.Located Can.Export -> a) -> Map.Map N.Name a -> Map.Map N.Name a
68privatize exports func dict =
70 Can.ExportEverything _ ->
73 Can.Export explicitExports ->
74 Map.intersectionWith func dict explicitExports
77toUnion :: Can.Union -> A.Located Can.Export -> Can.Union
78toUnion union@(Can.Union vars _ _ opts) (A.At _ export) =
80 Can.ExportUnionOpen ->
83 Can.ExportUnionClosed ->
84 Can.Union vars [] 0 opts
87 error "Compiler bug. Should not run into non-union exports here."
90toOp :: Map.Map N.Name Can.Annotation -> Can.Binop -> Binop
91toOp types (Can.Binop_ associativity precedence name) =
92 Binop name (types ! name) associativity precedence
99instance Binary Interface where
101 liftM4 Interface get get get get
103 put (Interface a b c d) =
104 put a >> put b >> put c >> put d
107instance Binary Binop where
109 liftM4 Binop get get get get
111 put (Binop a b c d) =
112 put a >> put b >> put c >> put d
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