@@ -23,7 +23,7 @@ instance Simplify (Def t v) where
23 simp x = x
23 simp x = x
25instance Simplify e => Simplify (Located e) where
25instance 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)
28instance Simplify (Expr t v) where
28instance Simplify (Expr t v) where
29 simp expr =
29 simp expr =
@@ -44,7 +44,7 @@ instance Simplify (Expr t v) where
44clipBranches [] = []
44clipBranches [] = []
45clipBranches (e:es) =
45clipBranches (e:es) =
47− (L _ _ (Literal (Boolean True)), _) -> [e]
47+ (L _ (Literal (Boolean True)), _) -> [e]
48 _ -> e : clipBranches es
48 _ -> e : clipBranches es
@@ -86,18 +86,18 @@ binop op ce1@(L s1 e1) ce2@(L s2 e2) =
86 ("*", _, IntNum n) -> binop "*" ce2 ce1
86 ("*", _, IntNum n) -> binop "*" ce2 ce1
88 ("+", IntNum 0, _) -> e2
88 ("+", IntNum 0, _) -> e2
89− ("+", IntNum n, Binop "+" (L _ _ (IntNum m)) ce) ->
89+ ("+", IntNum n, Binop "+" (L _ (IntNum m)) ce) ->
90 binop "+" (c1 $ IntNum (n+m)) ce
90 binop "+" (c1 $ IntNum (n+m)) ce
91− ("+", Binop "+" (L _ _ (IntNum n)) ce1'
91+ ("+", Binop "+" (L _ (IntNum n)) ce1'
92− , Binop "+" (L _ _ (IntNum m)) ce2') ->
92+ , Binop "+" (L _ (IntNum m)) ce2') ->
93 binop "+" (none $ IntNum (n+m)) (none $ Binop "+" ce1' ce2')
93 binop "+" (none $ IntNum (n+m)) (none $ Binop "+" ce1' ce2')
95 ("*", IntNum 0, _) -> e1
95 ("*", IntNum 0, _) -> e1
96 ("*", IntNum 1, _) -> e2
96 ("*", IntNum 1, _) -> e2
97− ("*", IntNum n, Binop "*" (L _ _ (IntNum m)) ce) ->
97+ ("*", IntNum n, Binop "*" (L _ (IntNum m)) ce) ->
98 binop "*" (none $ IntNum (n*m)) ce
98 binop "*" (none $ IntNum (n*m)) ce
99− ("*", Binop "*" (L _ _ (IntNum n)) ce1'
99+ ("*", Binop "*" (L _ (IntNum n)) ce1'
100− , Binop "*" (L _ _ (IntNum m)) ce2') ->
100+ , Binop "*" (L _ (IntNum m)) ce2') ->
101 binop "*" (none $ IntNum (n*m)) (none $ Binop "*" ce1' ce2')
101 binop "*" (none $ IntNum (n*m)) (none $ Binop "*" ce1' ce2')
103 ("-", _, IntNum 0) -> e1
103 ("-", _, IntNum 0) -> e1
@@ -118,9 +118,9 @@ binop op ce1@(L s1 e1) ce2@(L s2 e2) =
118 ("::", _, _) -> Data "::" [ce1, ce2]
118 ("::", _, _) -> Data "::" [ce1, ce2]
120 ("++", Literal (Str s1), Literal (Str s2)) -> str $ s1 ++ s2
120 ("++", 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) ->
122 Binop "++" (c1 . str $ s1 ++ s2) ce
122 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)) ->
124 Binop "++" e (c1 . str $ s1 ++ s2)
124 Binop "++" e (c1 . str $ s1 ++ s2)
126 ("++", Data "[]" [], _) -> e2
126 ("++", Data "[]" [], _) -> e2