Align applications on for same function, plus minor fixup
Arguments of two function applications will only be aligned if the same function is called in both cases. The column transform was altered slightly to fix #65 properly as well. fixes #65, #128pull/132/head
parent
46de13256b
commit
90a2f65ba7
|
@ -501,6 +501,21 @@ func
|
|||
-> Proxy (str :: [*])
|
||||
-> m (Tagged str String)
|
||||
|
||||
#test issue 65
|
||||
widgetsDyn =
|
||||
[ [ vBox
|
||||
[ padTop Max outputLinesWidget
|
||||
, padRight Max wid1 <+> flowWidget -- alignment here is strange/buggy
|
||||
, padBottom (Pad 5) help
|
||||
]
|
||||
]
|
||||
| wid1 <- promptDyn
|
||||
, (flowWidget, _) <- flowResultD
|
||||
, outputLinesWidget <- outputLinesWidgetD
|
||||
, help <- suggestionHelpBox
|
||||
, parser <- cmdParserD
|
||||
]
|
||||
|
||||
#test issue 67
|
||||
fmapuv :: U.Unbox a => (a -> b) -> U.Vector a -> V.Vector b
|
||||
fmapuv f xs = G.generate (G.length xs) (f . (xs G.!))
|
||||
|
@ -527,3 +542,8 @@ spanKey p q = case minViewWithKey q of
|
|||
|
||||
#test issue 125
|
||||
a :: () ':- ()
|
||||
|
||||
#test issue 128
|
||||
func = do
|
||||
createDirectoryIfMissing True path
|
||||
openFile fileName AppendMode
|
||||
|
|
|
@ -455,7 +455,7 @@ alignColsLines bridocs = do -- colInfos `forM_` \colInfo -> do
|
|||
(BDCols ColRecUpdate _) -> False
|
||||
(BDCols ColListComp _) -> False
|
||||
(BDCols ColList _) -> False
|
||||
(BDCols ColApp _) -> True
|
||||
(BDCols ColApp{} _) -> True
|
||||
(BDCols ColTuple _) -> False
|
||||
(BDCols ColTuples _) -> False
|
||||
(BDCols ColOpPrefix _) -> False
|
||||
|
|
|
@ -117,12 +117,16 @@ layoutExpr lexpr@(L _ expr) = do
|
|||
(L _ (HsApp l r)) -> gather (r:list) l
|
||||
x -> (x, list)
|
||||
let (headE, paramEs) = gather [exp2] exp1
|
||||
let colsOrSequence = case headE of
|
||||
L _ (HsVar (L _ (Unqual occname))) ->
|
||||
docCols (ColApp $ Text.pack $ occNameString occname)
|
||||
_ -> docSeq
|
||||
headDoc <- docSharedWrapper layoutExpr headE
|
||||
paramDocs <- docSharedWrapper layoutExpr `mapM` paramEs
|
||||
docAltFilter
|
||||
[ -- foo x y
|
||||
( True
|
||||
, docCols ColApp
|
||||
, colsOrSequence
|
||||
$ appSep (docForceSingleline headDoc)
|
||||
: spacifyDocs (docForceSingleline <$> paramDocs)
|
||||
)
|
||||
|
|
|
@ -23,11 +23,12 @@ transformSimplifyColumns = Uniplate.rewrite $ \case
|
|||
BDLit{} -> Nothing
|
||||
BDSeq list | any (\case BDSeq{} -> True
|
||||
BDEmpty{} -> True
|
||||
_ -> False) list -> Just $ BDSeq $
|
||||
filter isNotEmpty list >>= \case
|
||||
_ -> False) list -> Just $ BDSeq $ list >>= \case
|
||||
BDEmpty -> []
|
||||
BDSeq l -> l
|
||||
x -> [x]
|
||||
BDSeq (BDCols sig1 cols1@(_:_):rest) ->
|
||||
BDSeq (BDCols sig1 cols1@(_:_):rest)
|
||||
| all (\case BDSeparator -> True; _ -> False) rest ->
|
||||
Just $ BDCols sig1 (List.init cols1 ++ [BDSeq (List.last cols1:rest)])
|
||||
BDLines lines | any (\case BDLines{} -> True
|
||||
BDEmpty{} -> True
|
||||
|
|
|
@ -174,7 +174,7 @@ data ColSig
|
|||
| ColRecUpdate -- used for both RecCon and RecUpd. TODO: refactor to reflect?
|
||||
| ColListComp
|
||||
| ColList
|
||||
| ColApp
|
||||
| ColApp Text
|
||||
| ColTuple
|
||||
| ColTuples
|
||||
| ColOpPrefix -- merge with ColList ? other stuff?
|
||||
|
|
Loading…
Reference in New Issue