1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Extract showThese to the top.

This commit is contained in:
Rob Rix 2016-05-20 22:03:13 -04:00
parent 097220a454
commit f09f9cf3a2

View File

@ -229,9 +229,11 @@ instance Show Child where
instance Show BranchElement where
show (Child' key contents) = showThese (showContents <$> contents)
where showContents contents = "(" ++ key ++ contents ++ ")"
showThese = these (('<':) . show) (('>':) . show) (\ a b -> a ++ " | " ++ b) . runJoin
show (Margin contents) = show contents
showThese :: Join These String -> String
showThese = these (('<':) . show) (('>':) . show) (\ a b -> a ++ " | " ++ b) . runJoin
counts :: [Join These (Int, a)] -> Both Int
counts numbered = fromMaybe 0 . getLast . mconcat . fmap Last <$> Join (unalign (runJoin . fmap Prelude.fst <$> numbered))