mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-04 05:37:14 +03:00
Remove comments
This commit is contained in:
parent
c8414eb9ce
commit
eefacbf48b
@ -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 ->
|
||||
|
Loading…
Reference in New Issue
Block a user