Commit 886da5c9 authored by Bastian Kauschke's avatar Bastian Kauschke

omit braces in AbsorbingPolynomial

parent f757c731
......@@ -68,10 +68,15 @@ newtype AbsorbingPolynomial f a = AbsorbingPolynomial (Polynomial (Inner f a))
instance (Printable f) => Printable (AbsorbingPolynomial f) where
precedence _ = 10
printMe cfg (AbsorbingPolynomial poly) = withName cfg "AbsorbingPolynomial" <> printPolynomial cfg ((\case
printMe cfg (AbsorbingPolynomial poly) =
let name = withName cfg "AbsorbingPolynomial"
in name <> printPolynomial cfg ((\case
Direct a -> a
-- FIXME: We could skip the braces in some cases.
Absorbed inner -> "(" <> printMe cfg inner <> ")"
-- We want to always print the surrounding braces in case functor names
-- are printed.
Absorbed inner -> if precedence inner > 10 && name == mempty
then printMe cfg inner
else "(" <> printMe cfg inner <> ")"
) <$> poly)
$(deriveShow1 ''AbsorbingPolynomial)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment