entrytree_collapse :: Entry a => [EntryTree a] -> Loc -> Maybe [EntryTree a]
entrytree_collapse et loc = entrytree_map_path f et loc
    where
        f e _ eloc | loc==eloc =
            case entrytree_expanded e of
                True -> Just [e{entrytree_expanded = False}]
                False -> Nothing
        f e Nothing _ = Nothing
        f e (Just nch) _ =
            Just [e{entrytree_children=nch}]
entrytree_collapse :: Entry a => [EntryTree a] -> Loc -> Maybe [EntryTree a]
entrytree_collapse et loc = entrytree_map_path f et loc
    where
        f e _ eloc | loc==eloc =
            case entrytree_expanded e of
                True -> Just [e{entrytree_expanded = False}]
                False -> Nothing
        f e Nothing _ = Nothing
        f e (Just nch) _ =
            Just [e{entrytree_children=nch}]
entrytree_collapse et loc = entrytree_map_path f et loc
    where
        f e _ eloc | loc==eloc =
            case entrytree_expanded e of
                True -> Just [e{entrytree_expanded = False}]
                False -> Nothing
        f e Nothing _ = Nothing
        f e (Just nch) _ =
            Just [e{entrytree_children=nch}]