localctx ctx = local $ \r->r { context=ctx }
iindent :: Printer a -> Printer a
-iindent p = local (\r->r { indent=indent r + 1 }) $ printIndent >> p
+iindent p = printIndent >> local (\r->r { indent=indent r + 1 }) p
leftctx,rightctx,nonectx :: Int -> Ctx
leftctx p = CtxInfix {assoc=CtxLeft, prio=p, branch=CtxNone}
| otherwise = False
needsParen _ CtxNullary = error "shouldn't occur"
+instance DSL Printer
instance Expression Printer where
lit = printLit . show
(+.) = printBinOp (leftctx 6) "+"
>-> localctx (setBranch thisctx CtxRight) l
printCons :: String -> Printer a -> Printer a
-printCons = printUnOp CtxNonfix-- . (++" ")
+printCons cons l = paren' CtxNonfix $ printLit cons >-> l
printRec :: String -> Printer a -> Printer a
printRec op l = printUnOp CtxNo op (accol l)-- (op++" ") (accol l)