Skip to content

Commit

Permalink
Remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
runarorama committed Aug 23, 2024
1 parent c8414eb commit eefacbf
Showing 1 changed file with 0 additions and 62 deletions.
62 changes: 0 additions & 62 deletions parser-typechecker/src/Unison/Syntax/TermPrinter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -439,68 +439,6 @@ pretty0
. NameSegment.toEscapedText
. Name.lastSegment
_ -> Nothing
-- unBinaryAppsPred' ::
-- ( Term3 v PrintAnnotation,
-- Term3 v PrintAnnotation -> Bool
-- ) ->
-- Maybe
-- ( [ ( Term3 v PrintAnnotation,
-- Term3 v PrintAnnotation
-- )
-- ],
-- Term3 v PrintAnnotation
-- )
-- unBinaryAppsPred' (t, isInfix) =
-- go t isInfix
-- where
-- go t pred =
-- case unBinaryAppPred (t, pred) of
-- Just (f, x, y) ->
-- let precf = termPrecedence f
-- -- We only chain together infix operators if they have
-- -- higher precedence (lower raw precedence) than the
-- -- current operator. If there is no precedence, we only
-- -- chain if it's literally the same operator.
-- inChain compare g = isInfix g && (fromMaybe (g == f) $ compare <$> termPrecedence g <*> precf)
-- l = unBinaryAppsPred' (x, inChain (>=))
-- r = unBinaryAppsPred' (y, inChain (>))
-- in case (l, r) of
-- (Just (as, xLast), Just (bs, yLast)) -> Just (bs ++ ((xLast, f) : as), yLast)
-- (Just (as, xLast), Nothing) -> Just ((xLast, f) : as, y)
-- (Nothing, Just (bs, yLast)) -> Just (bs ++ [(x, f)], yLast)
-- (Nothing, Nothing) -> Just ([(x, f)], y)
-- Nothing -> Nothing

-- Render a binary infix operator sequence, like [(a2, f2), (a1, f1)],
-- meaning (a1 `f1` a2) `f2` (a3 rendered by the caller), producing
-- "a1 `f1` a2 `f2`". Except the operators are all symbolic, so we won't
-- produce any backticks. We build the result out from the right,
-- starting at `f2`.
-- binaryApps ::
-- [(Term3 v PrintAnnotation, Term3 v PrintAnnotation)] ->
-- Pretty SyntaxText ->
-- m (Pretty SyntaxText)
-- binaryApps xs last =
-- do
-- let xs' = reverse xs
-- psh <- join <$> traverse (uncurry (r (InfixOp Lowest))) (take 1 xs')
-- pst <- join <$> traverse (uncurry (r (InfixOp Highest))) (drop 1 xs')
-- let ps = psh <> pst
-- 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 p a f =
-- sequenceA
-- [ pretty0 (ac (if isBlock a then Top else fromMaybe p (termPrecedence f)) Normal im doc) a,
-- pretty0 (AmbientContext Application Normal Infix im doc False) f
-- ]

case (term, binaryOpsPred) of
(DD.Doc, _)
| doc == MaybeDoc ->
Expand Down

0 comments on commit eefacbf

Please sign in to comment.