1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Add a Show instance over BranchElement.

This commit is contained in:
Rob Rix 2016-05-20 21:54:33 -04:00
parent 3aaa9f79ca
commit 419bcfe776

View File

@ -214,6 +214,11 @@ instance Arbitrary Child where
instance Show Child where
show Child {..} = childMargin ++ "(" ++ childKey ++ childContents ++ ")"
instance Show BranchElement where
show (Child' key contents) = show (showContents <$> contents)
where showContents contents = "(" ++ key ++ contents ++ ")"
show (Margin contents) = show contents
counts :: [Join These (Int, a)] -> Both Int
counts numbered = fromMaybe 0 . getLast . mconcat . fmap Last <$> Join (unalign (runJoin . fmap Prelude.fst <$> numbered))