on master help sign in
Update Optimize.hs to use some of the newer infix operators.
4eb973aevancz
compiler/Transform/Optimize.hs+3−1
@@ -112,7 +112,7 @@ binop op ce1@(C t1 s1 e1) ce2@(C t2 s2 e2) =
112 ("||", Boolean True, _) -> Boolean True
112 ("||", Boolean True, _) -> Boolean True
113 ("||", Boolean False, _) -> e2
113 ("||", Boolean False, _) -> e2
114
114
115− (":", _, _) -> let (C _ _ e) = cons ce1 ce2 in e
115+ ("::", _, _) -> let (C _ _ e) = cons ce1 ce2 in e
116
116
117 ("++", Str s1, Str s2) -> Str $ s1 ++ s2
117 ("++", Str s1, Str s2) -> Str $ s1 ++ s2
118 ("++", Str s1, Binop "++" (C _ _ (Str s2)) ce) ->
118 ("++", Str s1, Binop "++" (C _ _ (Str s2)) ce) ->
@@ -124,6 +124,8 @@ binop op ce1@(C t1 s1 e1) ce2@(C t2 s2 e2) =
124 ("++", _, Data "Nil" []) -> e1
124 ("++", _, Data "Nil" []) -> e1
125 ("++", Data "Cons" [h,t], _) -> Data "Cons" [h, noContext $ binop "++" t ce2]
125 ("++", Data "Cons" [h,t], _) -> Data "Cons" [h, noContext $ binop "++" t ce2]
126
126
127+ ("|>", _, _) -> App ce2 ce1
128+ ("<|", _, _) -> App ce1 ce2
127 ("$", _, _) -> App ce1 ce2
129 ("$", _, _) -> App ce1 ce2
128 (".", _, _) ->
130 (".", _, _) ->
129 Lambda "x" (noContext $
131 Lambda "x" (noContext $