entrytree_expand :: Entry a => [EntryTree a] -> Loc -> Maybe [EntryTree a]
entrytree_expand = entrytree_map_path f
    where
        f e Nothing _
            | entrytree_expanded e || length (entrytree_children e) == 0 = Nothing
            | otherwise = Just [e{entrytree_expanded = True}]
        f e (Just nch) _ =
            Just [e{entrytree_expanded = True, entrytree_children=nch}]
entrytree_expand :: Entry a => [EntryTree a] -> Loc -> Maybe [EntryTree a]
entrytree_expand = entrytree_map_path f
    where
        f e Nothing _
            | entrytree_expanded e || length (entrytree_children e) == 0 = Nothing
            | otherwise = Just [e{entrytree_expanded = True}]
        f e (Just nch) _ =
            Just [e{entrytree_expanded = True, entrytree_children=nch}]
entrytree_expand = entrytree_map_path f
    where
        f e Nothing _
            | entrytree_expanded e || length (entrytree_children e) == 0 = Nothing
            | otherwise = Just [e{entrytree_expanded = True}]
        f e (Just nch) _ =
            Just [e{entrytree_expanded = True, entrytree_children=nch}]