on master help sign in
Fix pretty-printing of infix operators
f3d1adaDavid Raymond Christiansen
src/Idris/AbsSyntaxTree.hs+6−2
@@ -1126,8 +1126,9 @@ pprintPTerm impl bnd = prettySe 10 bnd
1126 | not impl = prettyName impl bnd f
1126 | not impl = prettyName impl bnd f
1127 prettySe p bnd (PAppBind _ (PRef _ f) [])
1127 prettySe p bnd (PAppBind _ (PRef _ f) [])
1128 | not impl = text "!" <> prettyName impl bnd f
1128 | not impl = text "!" <> prettyName impl bnd f
1129− prettySe p bnd (PApp _ (PRef _ op@(UN nm)) args)
1129+ prettySe p bnd (PApp _ (PRef _ op) args)
1130+ | UN nm <- basename op
1130− | not (tnull nm) &&
1131+ , not (tnull nm) &&
1131 length (getExps args) == 2 && (not impl) && (not $ isAlpha (thead nm)) =
1132 length (getExps args) == 2 && (not impl) && (not $ isAlpha (thead nm)) =
1132 let [l, r] = getExps args in
1133 let [l, r] = getExps args in
1133 bracket p 1 $
1134 bracket p 1 $
@@ -1220,6 +1221,9 @@ pprintPTerm impl bnd = prettySe 10 bnd
1220 prettyArgSc bnd val = lbrace <> lbrace <> prettySe 10 bnd val <> rbrace <> rbrace
1221 prettyArgSc bnd val = lbrace <> lbrace <> prettySe 10 bnd val <> rbrace <> rbrace
1221 prettyArgSti bnd (n, val) = lbrace <> text "auto" <+> pretty n <+> text "=" <+> prettySe 10 bnd val <> rbrace
1222 prettyArgSti bnd (n, val) = lbrace <> text "auto" <+> pretty n <+> text "=" <+> prettySe 10 bnd val <> rbrace
1222
1223
1224+ basename :: Name -> Name
1225+ basename (NS n _) = basename n
1226+ basename n = n
1223
1227
1224 slist' p bnd (PApp _ (PRef _ nil) _)
1228 slist' p bnd (PApp _ (PRef _ nil) _)
1225 | not impl && nsroot nil == sUN "Nil" = Just []
1229 | not impl && nsroot nil == sUN "Nil" = Just []