@@ -113,53 +113,53 @@ dummyLet defs =
113-- PRETTY PRINTING
113-- PRETTY PRINTING
115instance (P.Pretty def, P.Pretty var, Var.ToString var) => P.Pretty (Expr' ann def var typ) where
115instance (P.Pretty def, P.Pretty var, Var.ToString var) => P.Pretty (Expr' ann def var typ) where
116− pretty needsParens expression =
116+ pretty dealiaser needsParens expression =
117 case expression of
117 case expression of
118 Literal literal ->
118 Literal literal ->
119− P.pretty needsParens literal
119+ P.pretty dealiaser needsParens literal
122− P.pretty needsParens x
122+ P.pretty dealiaser needsParens x
124 Range lowExpr highExpr ->
124 Range lowExpr highExpr ->
125 P.brackets $
125 P.brackets $
126− P.pretty False lowExpr
126+ P.pretty dealiaser False lowExpr
127 <> P.text ".."
127 <> P.text ".."
128− <> P.pretty False highExpr
128+ <> P.pretty dealiaser False highExpr
130 ExplicitList elements ->
130 ExplicitList elements ->
131− P.brackets (P.commaCat (map (P.pretty False) elements))
131+ P.brackets (P.commaCat (map (P.pretty dealiaser False) elements))
133 Binop op (A.A _ (Literal (Literal.IntNum 0))) expr
133 Binop op (A.A _ (Literal (Literal.IntNum 0))) expr
134 | Var.toString op == "-" ->
134 | Var.toString op == "-" ->
135− P.text "-" <> P.pretty True expr
135+ P.text "-" <> P.pretty dealiaser True expr
137 Binop op leftExpr rightExpr ->
137 Binop op leftExpr rightExpr ->
138 P.parensIf needsParens $
138 P.parensIf needsParens $
140− (P.pretty True leftExpr)
140+ (P.pretty dealiaser True leftExpr)
142− (P.text op'' <+> P.pretty True rightExpr)
142+ (P.text op'' <+> P.pretty dealiaser True rightExpr)
144 op' = Var.toString op
144 op' = Var.toString op
145 op'' = if Help.isOp op' then op' else "`" ++ op' ++ "`"
145 op'' = if Help.isOp op' then op' else "`" ++ op' ++ "`"
147 Lambda pattern expr ->
147 Lambda pattern expr ->
148 P.parensIf needsParens $
148 P.parensIf needsParens $
149− P.text "\\" <> args <+> P.text "->" <+> P.pretty False body
149+ P.text "\\" <> args <+> P.text "->" <+> P.pretty dealiaser False body
151 (patterns, body) =
151 (patterns, body) =
152 collectLambdas expr
152 collectLambdas expr
155− P.sep (map (P.pretty True) (pattern : patterns))
155+ P.sep (map (P.pretty dealiaser True) (pattern : patterns))
157 App expr arg ->
157 App expr arg ->
158 P.parensIf needsParens $
158 P.parensIf needsParens $
159 P.hang func 2 (P.sep args)
159 P.hang func 2 (P.sep args)
161 func:args =
161 func:args =
162− map (P.pretty True) (collectApps expr ++ [arg])
162+ map (P.pretty dealiaser True) (collectApps expr ++ [arg])
164 MultiIf branches ->
164 MultiIf branches ->
165 P.parensIf needsParens $
165 P.parensIf needsParens $
@@ -168,9 +168,9 @@ instance (P.Pretty def, P.Pretty var, Var.ToString var) => P.Pretty (Expr' ann d
168 iff (condition, branch) =
168 iff (condition, branch) =
169 P.text "|" <+>
169 P.text "|" <+>
171− (P.pretty False condition <+> P.text "->")
171+ (P.pretty dealiaser False condition <+> P.text "->")
173− (P.pretty False branch)
173+ (P.pretty dealiaser False branch)
175 Let defs body ->
175 Let defs body ->
176 P.parensIf needsParens $
176 P.parensIf needsParens $
@@ -178,8 +178,8 @@ instance (P.Pretty def, P.Pretty var, Var.ToString var) => P.Pretty (Expr' ann d
179 (P.text "let")
179 (P.text "let")
181− (P.vcat (map (P.pretty False) defs))
181+ (P.vcat (map (P.pretty dealiaser False) defs))
182− , P.text "in" <+> P.pretty False body
182+ , P.text "in" <+> P.pretty dealiaser False body
185 Case expr branches ->
185 Case expr branches ->
@@ -187,16 +187,16 @@ instance (P.Pretty def, P.Pretty var, Var.ToString var) => P.Pretty (Expr' ann d
187 P.hang pexpr 2 (P.vcat (map pretty' branches))
187 P.hang pexpr 2 (P.vcat (map pretty' branches))
190− P.text "case" <+> P.pretty False expr <+> P.text "of"
190+ P.text "case" <+> P.pretty dealiaser False expr <+> P.text "of"
192 pretty' (pattern, branch) =
192 pretty' (pattern, branch) =
193− P.pretty False pattern
193+ P.pretty dealiaser False pattern
194 <+> P.text "->"
194 <+> P.text "->"
195− <+> P.pretty False branch
195+ <+> P.pretty dealiaser False branch
197 Data "::" [hd,tl] ->
197 Data "::" [hd,tl] ->
198 P.parensIf needsParens $
198 P.parensIf needsParens $
199− P.pretty True hd <+> P.text "::" <+> P.pretty True tl
199+ P.pretty dealiaser True hd <+> P.text "::" <+> P.pretty dealiaser True tl
201 Data "[]" [] ->
201 Data "[]" [] ->
202 P.text "[]"
202 P.text "[]"
@@ -204,49 +204,49 @@ instance (P.Pretty def, P.Pretty var, Var.ToString var) => P.Pretty (Expr' ann d
204 Data name exprs ->
204 Data name exprs ->
205 if Help.isTuple name
205 if Help.isTuple name
207− P.parens (P.commaCat (map (P.pretty False) exprs))
207+ P.parens (P.commaCat (map (P.pretty dealiaser False) exprs))
209 P.parensIf (needsParens && not (null exprs)) $
209 P.parensIf (needsParens && not (null exprs)) $
211 (P.text name)
211 (P.text name)
213− (P.sep (map (P.pretty True) exprs))
213+ (P.sep (map (P.pretty dealiaser True) exprs))
215 Access record field ->
215 Access record field ->
216− P.pretty True record <> P.text "." <> P.text field
216+ P.pretty dealiaser True record <> P.text "." <> P.text field
218 Remove record field ->
218 Remove record field ->
219− P.braces (P.pretty False record <+> P.text "-" <+> P.text field)
219+ P.braces (P.pretty dealiaser False record <+> P.text "-" <+> P.text field)
221 Insert (A.A _ (Remove record oldField)) newField expr ->
221 Insert (A.A _ (Remove record oldField)) newField expr ->
222 P.braces $
222 P.braces $
224− [ P.pretty False record
224+ [ P.pretty dealiaser False record
225 , P.text "-"
225 , P.text "-"
226 , P.text oldField
226 , P.text oldField
227 , P.text "|"
227 , P.text "|"
228 , P.text newField
228 , P.text newField
229 , P.equals
229 , P.equals
230− , P.pretty False expr
230+ , P.pretty dealiaser False expr
233 Insert record field expr ->
233 Insert record field expr ->
234 P.braces $
234 P.braces $
235− P.pretty False record
235+ P.pretty dealiaser False record
236 <+> P.text "|"
236 <+> P.text "|"
237 <+> P.text field
237 <+> P.text field
238 <+> P.equals
238 <+> P.equals
239− <+> P.pretty False expr
239+ <+> P.pretty dealiaser False expr
241 Modify record fields ->
241 Modify record fields ->
242 P.braces $
242 P.braces $
244− (P.pretty False record <+> P.text "|")
244+ (P.pretty dealiaser False record <+> P.text "|")
246 (P.commaSep $ map prettyField fields)
246 (P.commaSep $ map prettyField fields)
248 prettyField (field, expr) =
248 prettyField (field, expr) =
249− P.text field <+> P.text "<-" <+> P.pretty False expr
249+ P.text field <+> P.text "<-" <+> P.pretty dealiaser False expr
251 Record fields ->
251 Record fields ->
@@ -255,17 +255,17 @@ instance (P.Pretty def, P.Pretty var, Var.ToString var) => P.Pretty (Expr' ann d
257 field (name, expr) =
257 field (name, expr) =
258− P.text name <+> P.equals <+> P.pretty False expr
258+ P.text name <+> P.equals <+> P.pretty dealiaser False expr
260 GLShader _ _ _ ->
260 GLShader _ _ _ ->
261 P.text "[glsl| ... |]"
261 P.text "[glsl| ... |]"
263 Port portImpl ->
263 Port portImpl ->
264− P.pretty needsParens portImpl
264+ P.pretty dealiaser needsParens portImpl
267instance P.Pretty (PortImpl expr tipe) where
267instance P.Pretty (PortImpl expr tipe) where
268− pretty _ impl =
268+ pretty _ _ impl =
269 P.text ("<port:" ++ portName impl ++ ">")
269 P.text ("<port:" ++ portName impl ++ ">")