list_to_entrytree_ d eee@(e@(e_x, e_d, e_e):ee)
    | e_d<d     = ([], eee)
    | e_d==d    = (et:more, ee__)
    | otherwise = error "Invalid depths in list"
    where
        et = EntryTree e_x False e_e e_ch
        (e_ch, ee_) = list_to_entrytree_ (d+1) ee
        (more, ee__) = list_to_entrytree_ d ee_
list_to_entrytree_ d eee@(e@(e_x, e_d, e_e):ee)
    | e_d<d     = ([], eee)
    | e_d==d    = (et:more, ee__)
    | otherwise = error "Invalid depths in list"
    where
        et = EntryTree e_x False e_e e_ch
        (e_ch, ee_) = list_to_entrytree_ (d+1) ee
        (more, ee__) = list_to_entrytree_ d ee_
list_to_entrytree_ d eee@(e@(e_x, e_d, e_e):ee)
    | e_d<d     = ([], eee)
    | e_d==d    = (et:more, ee__)
    | otherwise = error "Invalid depths in list"
    where
        et = EntryTree e_x False e_e e_ch
        (e_ch, ee_) = list_to_entrytree_ (d+1) ee
        (more, ee__) = list_to_entrytree_ d ee_