1{-# OPTIONS_GHC -Wall #-}
17import Control.Monad (liftM, liftM2, liftM3, liftM4)
19import qualified Data.ByteString as BS
20import qualified Data.Map as Map
21import qualified Data.Set as Set
22import Data.Text (Text)
24import qualified AST.Canonical as Can
25import qualified AST.Module.Name as ModuleName
26import qualified Data.Index as Index
27import qualified Elm.Name as N
28import qualified Optimize.DecisionTree as DT
29import qualified Reporting.Region as R
43 | VarCycle ModuleName.Canonical N.Name
44 | VarDebug N.Name ModuleName.Canonical R.Region (Maybe N.Name)
45 | VarKernel N.Name N.Name
47 | Function [N.Name] Expr
49 | TailCall N.Name [(N.Name, Expr)]
50 | If [(Expr, Expr)] Expr
52 | Case N.Name N.Name (Decider Choice) [(Int, Expr)]
56 | Update Expr (Map.Map N.Name Expr)
57 | Record (Map.Map N.Name Expr)
59 | Tuple Expr Expr (Maybe Expr)
63data Global = Global ModuleName.Canonical N.Name
73 | TailDef N.Name [N.Name] Expr
83 { _testChain :: [(DT.Path, DT.Test)]
84 , _success :: Decider a
85 , _failure :: Decider a
89 , _tests :: [(DT.Test, Decider a)]
90 , _fallback :: Decider a
106 { _mains :: Map.Map ModuleName.Canonical Main
107 , _nodes :: Map.Map Global Node
108 , _fields :: Map.Map N.Name Int
118 = Define Expr (Set.Set Global)
119 | DefineTailFunc [N.Name] Expr (Set.Set Global)
120 | Ctor N.Name Index.ZeroBased Int
122 | Cycle [(N.Name, Expr)] (Set.Set Global)
123 | Manager EffectsType
124 | Kernel [KChunk] (Set.Set Global) (Maybe ([KChunk], Set.Set Global))
125 | PortIncoming Expr (Set.Set Global)
126 | PortOutgoing Expr (Set.Set Global)
129data EffectsType = Cmd | Sub | Fx
146instance Binary Global where
147 get = liftM2 Global get get
148 put (Global a b) = put a >> put b
151instance Binary Expr where
154 Chr a -> putWord8 0 >> put a
155 Str a -> putWord8 1 >> put a
156 Int a -> putWord8 2 >> put a
157 Float a -> putWord8 3 >> put a
158 VarLocal a -> putWord8 4 >> put a
159 VarGlobal a -> putWord8 5 >> put a
160 VarCycle a b -> putWord8 6 >> put a >> put b
161 VarDebug a b c d -> putWord8 7 >> put a >> put b >> put c >> put d
162 VarKernel a b -> putWord8 8 >> put a >> put b
163 List a -> putWord8 9 >> put a
164 Function a b -> putWord8 10 >> put a >> put b
165 Call a b -> putWord8 11 >> put a >> put b
166 TailCall a b -> putWord8 12 >> put a >> put b
167 If a b -> putWord8 13 >> put a >> put b
168 Let a b -> putWord8 14 >> put a >> put b
169 Case a b c d -> putWord8 15 >> put a >> put b >> put c >> put d
170 Index a b -> putWord8 16 >> put a >> put b
171 Accessor a -> putWord8 17 >> put a
172 Access a b -> putWord8 18 >> put a >> put b
173 Update a b -> putWord8 19 >> put a >> put b
174 Record a -> putWord8 20 >> put a
176 Tuple a b c -> putWord8 22 >> put a >> put b >> put c
177 Shader a -> putWord8 23 >> put a
186 4 -> liftM VarLocal get
187 5 -> liftM VarGlobal get
188 6 -> liftM2 VarCycle get get
189 7 -> liftM4 VarDebug get get get get
190 8 -> liftM2 VarKernel get get
192 10 -> liftM2 Function get get
193 11 -> liftM2 Call get get
194 12 -> liftM2 TailCall get get
195 13 -> liftM2 If get get
196 14 -> liftM2 Let get get
197 15 -> liftM4 Case get get get get
198 16 -> liftM2 Index get get
199 17 -> liftM Accessor get
200 18 -> liftM2 Access get get
201 19 -> liftM2 Update get get
202 20 -> liftM Record get
204 22 -> liftM3 Tuple get get get
205 23 -> liftM Shader get
206 _ -> error "problem getting Opt.Expr binary"
209instance Binary Def where
212 Def a b -> putWord8 0 >> put a >> put b
213 TailDef a b c -> putWord8 1 >> put a >> put b >> put c
218 0 -> liftM2 Def get get
219 1 -> liftM3 TailDef get get get
220 _ -> error "problem getting Opt.Def binary"
223instance (Binary a) => Binary (Decider a) where
226 Leaf a -> putWord8 0 >> put a
227 Chain a b c -> putWord8 1 >> put a >> put b >> put c
228 FanOut a b c -> putWord8 2 >> put a >> put b >> put c
234 1 -> liftM3 Chain get get get
235 2 -> liftM3 FanOut get get get
236 _ -> error "problem getting Opt.Decider binary"
239instance Binary Choice where
242 Inline expr -> putWord8 0 >> put expr
243 Jump index -> putWord8 1 >> put index
248 0 -> liftM Inline get
250 _ -> error "problem getting Opt.Choice binary"
253instance Binary KChunk where
256 JS a -> putWord8 0 >> put a
257 Var a b -> putWord8 1 >> put a >> put b
258 ElmField a -> putWord8 2 >> put a
259 JsField a -> putWord8 3 >> put a
260 Enum a -> putWord8 4 >> put a
268 1 -> liftM2 Var get get
269 2 -> liftM ElmField get
270 3 -> liftM JsField get
274 _ -> error "problem deserializing AST.Optimized.KChunk"
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