Skip to content

Commit

Permalink
Get rid of commented-out code
Browse files Browse the repository at this point in the history
  • Loading branch information
runarorama committed Aug 20, 2024
1 parent f48880f commit b64ac8b
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions parser-typechecker/src/Unison/Syntax/TermPrinter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -553,13 +553,6 @@ pretty0
prettyApps <- binaryApps apps prettyLast
pure $ paren (p > fromMaybe (InfixOp Lowest) prec) prettyApps
Nothing -> error "crash"
-- let prec = fmap ((-) 9) $ termPrecedence f
-- prettyF <- pretty0 (AmbientContext 10 Normal Infix im doc False) f
-- prettyA <- pretty0 (ac (fromMaybe 3 prec) Normal im doc) a
-- prettyB <- pretty0 (ac (fromMaybe (length Precedence.levels + 3) prec) Normal im doc) b
-- pure . parenNoGroup (p > fromMaybe 3 prec) $
-- (prettyA <> " " <> prettyF <> " " <> prettyB)
-- `PP.orElse` (prettyA `PP.hangUngrouped` prettyF <> " " <> prettyB)
(And' a b, _) -> do
let prec = operatorPrecedence "&&"
prettyF = fmt S.ControlKeyword "&&"
Expand All @@ -576,13 +569,6 @@ pretty0
pure . parenNoGroup (p > fromMaybe (InfixOp Lowest) prec) $
(prettyA <> " " <> prettyF <> " " <> prettyB)
`PP.orElse` (prettyA `PP.hangUngrouped` prettyF <> " " <> prettyB)
-- BinaryAppsPred' apps lastArg -> do
-- prettyLast <- pretty0 (ac 3 Normal im doc) lastArg
-- prettyApps <- binaryApps apps prettyLast
-- pure $ paren (p >= 3) prettyApps
-- Note that && and || are at the same precedence, which can cause
-- confusion, so for clarity we do not want to elide the parentheses in a
-- case like `(x || y) && z`.
{-
When a delayed computation block is passed to a function as the last argument
in a context where the ambient precedence is low enough, we can elide parentheses
Expand Down Expand Up @@ -615,14 +601,6 @@ pretty0
let softTab = PP.softbreak <> ("" `PP.orElse` " ")
pure . paren (p >= (InfixOp Lowest)) $
PP.group (PP.group (PP.group (PP.sep softTab (fun : args') <> softTab)) <> lastArg')
-- (Ands' xs lastArg, _) ->
-- paren (p >= 10) <$> do
-- lastArg' <- pretty0 (ac 10 Normal im doc) lastArg
-- booleanOps (fmt S.ControlKeyword "&&") xs lastArg'
-- (Ors' xs lastArg, _) ->
-- paren (p >= 10) <$> do
-- lastArg' <- pretty0 (ac 10 Normal im doc) lastArg
-- booleanOps (fmt S.ControlKeyword "||") xs lastArg'
_other -> case (term, nonForcePred) of
OverappliedBinaryAppPred' f a b r
| binaryOpsPred f ->
Expand Down Expand Up @@ -689,31 +667,6 @@ pretty0
nonUnitArgPred :: (Var v) => v -> Bool
nonUnitArgPred v = Var.name v /= "()"

-- -- Render sequence of infix &&s or ||s, like [x2, x1],
-- -- meaning (x1 && x2) && (x3 rendered by the caller), producing
-- -- "x1 && x2 &&". The result is built from the right.
-- booleanOps ::
-- Pretty SyntaxText ->
-- [Term3 v PrintAnnotation] ->
-- Pretty SyntaxText ->
-- m (Pretty SyntaxText)
-- booleanOps op xs last = do
-- ps <- join <$> traverse r (reverse xs)
-- let unbroken = PP.spaced (ps <> [last])
-- broken = PP.hang (head ps) . PP.column2 . psCols $ tail ps <> [last]
-- pure (unbroken `PP.orElse` broken)
-- where
-- psCols ps = case take 2 ps of
-- [x, y] -> (x, y) : psCols (drop 2 ps)
-- [x] -> [(x, "")]
-- [] -> []
-- _ -> undefined
-- r a =
-- sequence
-- [ pretty0 (ac (if isBlock a then 12 else 10) Normal im doc) a,
-- pure op
-- ]

prettyPattern ::
forall v loc.
(Var v) =>
Expand Down

0 comments on commit b64ac8b

Please sign in to comment.