addCostCentres :: WXC.TreeCtrl a -> WXC.TreeItem -> [CostCentre] -> IO ()
addCostCentres tree node ccs =
  forM_ (sortOn (negate . timePercent . ccInherited . ccData) ccs) $ \cc -> do
    let
      cd = ccData cc
      text = Text.unwords
        [ Text.concat [ccModule cd, ".", ccName cd]
        , showText (timePercent (ccInherited cd))
        , Text.concat ["(", showText (timePercent (ccIndividual cd)), ")"]
        ]
    item <- treeAppendText tree node $ Text.unpack text
    addCostCentres tree item $ ccChildren cc
addCostCentres :: WXC.TreeCtrl a -> WXC.TreeItem -> [CostCentre] -> IO ()
addCostCentres tree node ccs =
  forM_ (sortOn (negate . timePercent . ccInherited . ccData) ccs) $ \cc -> do
    let
      cd = ccData cc
      text = Text.unwords
        [ Text.concat [ccModule cd, ".", ccName cd]
        , showText (timePercent (ccInherited cd))
        , Text.concat ["(", showText (timePercent (ccIndividual cd)), ")"]
        ]
    item <- treeAppendText tree node $ Text.unpack text
    addCostCentres tree item $ ccChildren cc
addCostCentres tree node ccs =
  forM_ (sortOn (negate . timePercent . ccInherited . ccData) ccs) $ \cc -> do
    let
      cd = ccData cc
      text = Text.unwords
        [ Text.concat [ccModule cd, ".", ccName cd]
        , showText (timePercent (ccInherited cd))
        , Text.concat ["(", showText (timePercent (ccIndividual cd)), ")"]
        ]
    item <- treeAppendText tree node $ Text.unpack text
    addCostCentres tree item $ ccChildren cc