on master help sign in
Get compling
commita400ab140a7b1423f18d0f6b76f3a9a2d863f446 authorEvan Czaplicki <info@elm-lang.org> dateWed 31 Jul 2013, 07:42 (13 years ago) parent3ef5284
1 file changed+10−10
compiler/Transform/Optimize.hs+10−10
compiler/Transform/Optimize.hs+10−10
@@ -23,7 +23,7 @@ instance Simplify (Def t v) where
2323 simp x = x
2424
2525instance Simplify e => Simplify (Located e) where
26− simp (L t s e) = L t s (simp e)
26+ simp (L s e) = L s (simp e)
2727
2828instance Simplify (Expr t v) where
2929 simp expr =
@@ -44,7 +44,7 @@ instance Simplify (Expr t v) where
4444clipBranches [] = []
4545clipBranches (e:es) =
4646 case e of
47− (L _ _ (Literal (Boolean True)), _) -> [e]
47+ (L _ (Literal (Boolean True)), _) -> [e]
4848 _ -> e : clipBranches es
4949
5050
@@ -86,18 +86,18 @@ binop op ce1@(L s1 e1) ce2@(L s2 e2) =
8686 ("*", _, IntNum n) -> binop "*" ce2 ce1
8787
8888 ("+", IntNum 0, _) -> e2
89− ("+", IntNum n, Binop "+" (L _ _ (IntNum m)) ce) ->
89+ ("+", IntNum n, Binop "+" (L _ (IntNum m)) ce) ->
9090 binop "+" (c1 $ IntNum (n+m)) ce
91− ("+", Binop "+" (L _ _ (IntNum n)) ce1'
92− , Binop "+" (L _ _ (IntNum m)) ce2') ->
91+ ("+", Binop "+" (L _ (IntNum n)) ce1'
92+ , Binop "+" (L _ (IntNum m)) ce2') ->
9393 binop "+" (none $ IntNum (n+m)) (none $ Binop "+" ce1' ce2')
9494
9595 ("*", IntNum 0, _) -> e1
9696 ("*", IntNum 1, _) -> e2
97− ("*", IntNum n, Binop "*" (L _ _ (IntNum m)) ce) ->
97+ ("*", IntNum n, Binop "*" (L _ (IntNum m)) ce) ->
9898 binop "*" (none $ IntNum (n*m)) ce
99− ("*", Binop "*" (L _ _ (IntNum n)) ce1'
100− , Binop "*" (L _ _ (IntNum m)) ce2') ->
99+ ("*", Binop "*" (L _ (IntNum n)) ce1'
100+ , Binop "*" (L _ (IntNum m)) ce2') ->
101101 binop "*" (none $ IntNum (n*m)) (none $ Binop "*" ce1' ce2')
102102
103103 ("-", _, IntNum 0) -> e1
@@ -118,9 +118,9 @@ binop op ce1@(L s1 e1) ce2@(L s2 e2) =
118118 ("::", _, _) -> Data "::" [ce1, ce2]
119119
120120 ("++", Literal (Str s1), Literal (Str s2)) -> str $ s1 ++ s2
121− ("++", Literal (Str s1), Binop "++" (L _ _ (Literal (Str s2))) ce) ->
121+ ("++", Literal (Str s1), Binop "++" (L _ (Literal (Str s2))) ce) ->
122122 Binop "++" (c1 . str $ s1 ++ s2) ce
123− ("++", Binop "++" e (L _ _ (Literal (Str s1))), Literal (Str s2)) ->
123+ ("++", Binop "++" e (L _ (Literal (Str s1))), Literal (Str s2)) ->
124124 Binop "++" e (c1 . str $ s1 ++ s2)
125125
126126 ("++", Data "[]" [], _) -> e2