diff --git a/src/Agda2Hs/HsUtils.hs b/src/Agda2Hs/HsUtils.hs index ab6d293b..e7665486 100644 --- a/src/Agda2Hs/HsUtils.hs +++ b/src/Agda2Hs/HsUtils.hs @@ -256,14 +256,18 @@ insertPars fixs = \case parL topOp e = if needParenExpr e - then Paren () e + then mkParen e else par topOp (needParen (AssocLeft () /=)) e parR topOp = par topOp (needParen (AssocRight () /=)) par topOp need e@(InfixApp _ _ op _) - | need (getFix topOp) (getFix op) = Paren () e + | need (getFix topOp) (getFix op) = mkParen e par _ _ e = e +mkParen :: Exp () -> Exp () +mkParen e@Paren{} = e +mkParen e = Paren () e + -- Patterns patToExp :: Pat l -> Maybe (Exp l)