on master help sign in
Cosmetic changes
bef646aevancz
compiler/Gen/CompileToJS.hs+3−3
@@ -202,12 +202,12 @@ makeRecord kvs = record `liftM` collect kvs
202instance ToJS Expr where
202instance ToJS Expr where
203 toJS expr =
203 toJS expr =
204 case expr of
204 case expr of
205− IntNum n -> return $ show n
206− FloatNum n -> return $ show n
207 Var x -> return $ x
205 Var x -> return $ x
208 Chr c -> return $ quoted [c]
206 Chr c -> return $ quoted [c]
209 Str s -> return $ "_str" ++ parens (quoted s)
207 Str s -> return $ "_str" ++ parens (quoted s)
208+ IntNum n -> return $ show n
209+ FloatNum n -> return $ show n
210− Boolean b -> return $ if b then "true" else "false"
210+ Boolean b -> return $ if b then "true" else "false"
211 Range lo hi -> jsRange `liftM` toJS' lo `ap` toJS' hi
211 Range lo hi -> jsRange `liftM` toJS' lo `ap` toJS' hi
212 Access e x -> access x `liftM` toJS' e
212 Access e x -> access x `liftM` toJS' e
213 Remove e x -> remove x `liftM` toJS' e
213 Remove e x -> remove x `liftM` toJS' e
compiler/Parse/Patterns.hs+5−4
@@ -88,10 +88,11 @@ matchSingle :: Pattern -> CExpr -> Pattern -> GuidCounter [Def]
88matchSingle pat exp@(C t s _) p =
88matchSingle pat exp@(C t s _) p =
89 let ctx = C t s in
89 let ctx = C t s in
90 case p of
90 case p of
91− PData _ ps -> do x <- guid
91+ PData _ ps -> do
92+ x <- guid
92− let v = '_' : show x
93+ let v = '_' : show x
93− dss <- mapM (matchSingle pat . ctx $ Var v) ps
94+ dss <- mapM (matchSingle pat . ctx $ Var v) ps
94− return (FnDef v [] exp : concat dss)
95+ return (FnDef v [] exp : concat dss)
95
96
96 PVar x ->
97 PVar x ->
97 return [ FnDef x [] (ctx $ Case exp [(pat, ctx $ Var x)]) ]
98 return [ FnDef x [] (ctx $ Case exp [(pat, ctx $ Var x)]) ]