1{-# OPTIONS_GHC -Wall #-}
7 , Decider(..), Choice(..)
12import Control.Monad (liftM, liftM2, liftM3, liftM4)
14import qualified Data.Set as Set
15import Data.Text (Text)
17import qualified AST.Literal as Literal
18import qualified AST.Module.Name as ModuleName
19import qualified AST.Variable as Var
20import qualified Optimize.DecisionTree as DT
21import qualified Reporting.Region as R
29 = Literal Literal.Literal
31 | VarGlobal Var.Global
33 | Binop Var.Global Expr Expr
34 | Function [Text] Expr
36 | TailCall Text [Text] [Expr]
37 | If [(Expr, Expr)] Expr
38 | Let [(Text, Def)] Expr
39 | Case Text (Decider Choice) [(Int, Expr)]
44 | Update Expr [(Text, Expr)]
45 | Record [(Text, Expr)]
47 | Tuple Expr Expr [Expr]
49 | Crash ModuleName.Canonical R.Region (Maybe Expr)
68 { _testChain :: [(DT.Path, DT.Test)]
69 , _success :: Decider a
70 , _failure :: Decider a
74 , _tests :: [(DT.Test, Decider a)]
75 , _fallback :: Decider a
91 { _nodes :: Map.Map Var.Global Node
98 { _deps :: [Var.Global]
102 { _deps :: [Var.Global]
108 { _deps :: [Var.Global]
109 , _values :: [(Var.Global, Expr)]
117instance Binary Expr where
120 Literal a -> putWord8 0 >> put a
121 VarLocal a -> putWord8 1 >> put a
122 VarGlobal a -> putWord8 2 >> put a
123 List a -> putWord8 3 >> put a
124 Binop a b c -> putWord8 4 >> put a >> put b >> put c
125 Function a b -> putWord8 5 >> put a >> put b
126 Call a b -> putWord8 6 >> put a >> put b
127 TailCall a b c -> putWord8 7 >> put a >> put b >> put c
128 If a b -> putWord8 8 >> put a >> put b
129 Let a b -> putWord8 9 >> put a >> put b
130 Case a b c -> putWord8 10 >> put a >> put b >> put c
131 Ctor a b -> putWord8 11 >> put a >> put b
132 CtorAccess a b -> putWord8 12 >> put a >> put b
133 Accessor a -> putWord8 13 >> put a
134 Access a b -> putWord8 14 >> put a >> put b
135 Update a b -> putWord8 15 >> put a >> put b
136 Record a -> putWord8 16 >> put a
138 Tuple a b c -> putWord8 18 >> put a >> put b >> put c
139 GLShader a -> putWord8 19 >> put a
140 Crash a b c -> putWord8 20 >> put a >> put b >> put c
145 0 -> liftM Literal get
146 1 -> liftM VarLocal get
147 2 -> liftM VarGlobal get
149 4 -> liftM3 Binop get get get
150 5 -> liftM2 Function get get
151 6 -> liftM2 Call get get
152 7 -> liftM3 TailCall get get get
153 8 -> liftM2 If get get
154 9 -> liftM2 Let get get
155 10 -> liftM3 Case get get get
156 11 -> liftM2 Ctor get get
157 12 -> liftM2 CtorAccess get get
158 13 -> liftM Accessor get
159 14 -> liftM2 Access get get
160 15 -> liftM2 Update get get
161 16 -> liftM Record get
163 18 -> liftM3 Tuple get get get
164 19 -> liftM GLShader get
165 20 -> liftM3 Crash get get get
166 _ -> error "problem getting Opt.Expr binary"
169instance Binary Decl where
171 put a >> put b >> put c >> put d
174 liftM4 Decl get get get get
177instance Binary Def where
180 Def body -> putWord8 0 >> put body
181 TailDef args body -> putWord8 1 >> put args >> put body
187 1 -> TailDef <$> get <*> get
188 _ -> error "problem getting Opt.Def binary"
191instance Binary Main where
195 Dynamic expr -> putWord8 1 >> put expr
201 1 -> liftM Dynamic get
202 _ -> error "problem getting Opt.Main binary"
205instance (Binary a) => Binary (Decider a) where
208 Leaf a -> putWord8 0 >> put a
209 Chain a b c -> putWord8 1 >> put a >> put b >> put c
210 FanOut a b c -> putWord8 2 >> put a >> put b >> put c
216 1 -> liftM3 Chain get get get
217 2 -> liftM3 FanOut get get get
218 _ -> error "problem getting Opt.Decider binary"
221instance Binary Choice where
224 Inline expr -> putWord8 0 >> put expr
225 Jump index -> putWord8 1 >> put index
230 0 -> liftM Inline get
232 _ -> error "problem getting Opt.Choice binary"
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