@@ -191,15 +191,15 @@ diff localizer context leftType rightType =
191191 (Type.App (Type.Type leftName) leftArgs, Type.App (Type.Type rightName) rightArgs) ->
192192 if leftName /= rightName || length leftArgs /= length rightArgs then
193193 difference
194− (docApp localizer context leftName (map (docType localizer App) leftArgs))
195− (docApp localizer context rightName (map (docType localizer App) rightArgs))
194+ (docApp localizer context leftName leftArgs)
195+ (docApp localizer context rightName rightArgs)
196196
197197 else
198198 let
199199 subContext =
200200 if Var.isTuple leftName then None else App
201201 in
202− docApp localizer context leftName
202+ docAppHelp localizer context leftName
203203 <$> sequenceA (zipWith (go subContext) leftArgs rightArgs)
204204
205205 (Type.App _ _, Type.App _ _) ->
@@ -216,7 +216,7 @@ diff localizer context leftType rightType =
216216 diffRecord localizer leftFields leftExt rightFields rightExt
217217
218218 (Type.Aliased leftName leftArgs _, Type.Aliased rightName rightArgs _) | leftName == rightName ->
219− docApp localizer context leftName
219+ docAppHelp localizer context leftName
220220 <$> sequenceA (zipWith (go App) (map snd leftArgs) (map snd rightArgs))
221221
222222 (Type.Aliased _ args real, _) ->
@@ -387,7 +387,7 @@ docType localizer context tipe =
387387 varToDoc localizer name
388388
389389 Type.App (Type.Type name) args ->
390− docApp localizer context name (map (docType localizer App) args)
390+ docApp localizer context name args
391391
392392 Type.App _ _ ->
393393 error "type applications should start with a type atom"
@@ -402,7 +402,7 @@ docType localizer context tipe =
402402 (fmap text ext)
403403
404404 Type.Aliased name args _ ->
405− docApp localizer context name (map (docType localizer App . snd) args)
405+ docApp localizer context name (map snd args)
406406
407407
408408
@@ -426,8 +426,17 @@ docLambda context docs =
426426
427427
428428
429−docApp :: Localizer -> Context -> Var.Canonical -> [Doc] -> Doc
429+docApp :: Localizer -> Context -> Var.Canonical -> [Type.Canonical] -> Doc
430430docApp localizer context name args =
431+ let
432+ argContext =
433+ if Var.isTuple name then None else App
434+ in
435+ docAppHelp localizer context name (map (docType localizer argContext) args)
436+
437+
438+docAppHelp :: Localizer -> Context -> Var.Canonical -> [Doc] -> Doc
439+docAppHelp localizer context name args =
431440 if Var.isTuple name then
432441 sep
433442 [ cat (zipWith (<+>) (lparen : repeat comma) args)