on master help sign in
Fix pretty-printing of infix operators
commitf3d1ada2cf3f888b3b669871445866b419b135bc authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateTue 28 Jan 2014, 10:46 (13 years ago) parentde72eb9
1 file changed+6−2
src/Idris/AbsSyntaxTree.hs+6−2
src/Idris/AbsSyntaxTree.hs+6−2
@@ -1126,8 +1126,9 @@ pprintPTerm impl bnd = prettySe 10 bnd
11261126 | not impl = prettyName impl bnd f
11271127 prettySe p bnd (PAppBind _ (PRef _ f) [])
11281128 | not impl = text "!" <> prettyName impl bnd f
1129− prettySe p bnd (PApp _ (PRef _ op@(UN nm)) args)
1130− | not (tnull nm) &&
1129+ prettySe p bnd (PApp _ (PRef _ op) args)
1130+ | UN nm <- basename op
1131+ , not (tnull nm) &&
11311132 length (getExps args) == 2 && (not impl) && (not $ isAlpha (thead nm)) =
11321133 let [l, r] = getExps args in
11331134 bracket p 1 $
@@ -1220,6 +1221,9 @@ pprintPTerm impl bnd = prettySe 10 bnd
12201221 prettyArgSc bnd val = lbrace <> lbrace <> prettySe 10 bnd val <> rbrace <> rbrace
12211222 prettyArgSti bnd (n, val) = lbrace <> text "auto" <+> pretty n <+> text "=" <+> prettySe 10 bnd val <> rbrace
12221223
1224+ basename :: Name -> Name
1225+ basename (NS n _) = basename n
1226+ basename n = n
12231227
12241228 slist' p bnd (PApp _ (PRef _ nil) _)
12251229 | not impl && nsroot nil == sUN "Nil" = Just []