mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-19 06:17:33 +03:00
fix issue with tuple printing
This commit is contained in:
parent
48822e5e8e
commit
0a4448df36
@ -437,9 +437,13 @@ pretty0
|
||||
pair
|
||||
`PP.hang` PP.spaced [x', fmt (S.TermReference DD.unitCtorRef) "()"]
|
||||
(TupleTerm' xs, _) -> do
|
||||
clist <- commaList xs
|
||||
let comma = fmt S.DelimiterChar (l ", ") `PP.orElse` "\n, "
|
||||
pelems <- traverse (fmap (PP.indentNAfterNewline 2) . goNormal 0) xs
|
||||
let clist = PP.sep comma pelems
|
||||
let tupleLink p = fmt (S.TypeReference DD.unitRef) p
|
||||
pure $ PP.group (tupleLink "(" <> clist <> tupleLink ")")
|
||||
let open = tupleLink "(" `PP.orElse` tupleLink "( "
|
||||
let close = tupleLink ")" `PP.orElse` tupleLink " )"
|
||||
pure $ PP.group (open <> clist <> close)
|
||||
(App' f@(Builtin' "Any.Any") arg, _) ->
|
||||
paren (p >= 10) <$> (PP.hang <$> goNormal 9 f <*> goNormal 10 arg)
|
||||
(DD.Rewrites' rs, _) -> do
|
||||
@ -548,10 +552,8 @@ pretty0
|
||||
|
||||
isDelay (Delay' _) = True
|
||||
isDelay _ = False
|
||||
sepList = sepList' (pretty0 (ac 0 Normal im doc))
|
||||
sepList' f sep xs = fold . intersperse sep <$> traverse f xs
|
||||
varList = runIdentity . sepList' (Identity . PP.text . Var.name) PP.softbreak
|
||||
commaList = sepList (fmt S.DelimiterChar (l ",") <> PP.softbreak)
|
||||
|
||||
printLet ::
|
||||
Bool -> -- elideUnit
|
||||
|
@ -814,6 +814,11 @@ blah x =
|
||||
thunk x = do x
|
||||
test = do
|
||||
blah !(thunk "This has to laksdjf alsdkfj alskdjf asdf be a long enough string to force a line break")
|
||||
|
||||
test2 =
|
||||
("adsf",
|
||||
'(Text.toUtf8
|
||||
"adsfsfdgsfdgsdfgsdfgsfdgsfdgsdgsgsgfsfgsgsfdgsgfsfdgsgfsfdgsdgsdfgsgf"))
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
@ -821,7 +826,7 @@ test = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> edit test
|
||||
.> edit test test2
|
||||
.> load roundtrip.u
|
||||
```
|
||||
|
||||
|
@ -2167,11 +2167,16 @@ thunk x = do x
|
||||
test = do
|
||||
blah !(thunk "This has to laksdjf alsdkfj alskdjf asdf be a long enough string to force a line break")
|
||||
|
||||
test2 =
|
||||
("adsf",
|
||||
'(Text.toUtf8
|
||||
"adsfsfdgsfdgsdfgsdfgsfdgsfdgsdgsgsgfsfgsgsfdgsgfsfdgsgfsfdgsdgsdfgsgf"))
|
||||
|
||||
```
|
||||
|
||||
|
||||
```ucm
|
||||
.> edit test
|
||||
.> edit test test2
|
||||
|
||||
☝️
|
||||
|
||||
@ -2184,6 +2189,12 @@ test = do
|
||||
blah
|
||||
!(thunk
|
||||
"This has to laksdjf alsdkfj alskdjf asdf be a long enough string to force a line break")
|
||||
|
||||
test2 : (Text, '{g} Bytes)
|
||||
test2 =
|
||||
( "adsf"
|
||||
, '(toUtf8
|
||||
"adsfsfdgsfdgsdfgsdfgsfdgsfdgsdgsgsgfsfgsgsfdgsgfsfdgsgfsfdgsdgsdfgsgf") )
|
||||
|
||||
You can edit them there, then do `update` to replace the
|
||||
definitions currently in this namespace.
|
||||
@ -2197,6 +2208,7 @@ test = do
|
||||
⍟ These names already exist. You can `update` them to your
|
||||
new definition:
|
||||
|
||||
test : 'Text
|
||||
test : 'Text
|
||||
test2 : (Text, '{g} Bytes)
|
||||
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user