loc_rm_effect loc locv = 
    if null notafter then
        Just loc
    else if has_init loc (last notafter) then
        Nothing -- loc will be removed!
    else
        Just $ foldl sub_effect loc (reverse $ notafter)
    where
        notafter = filter (\l -> l<=loc) $ rm_inits $ sort locv
        sub_effect (Loc ll) (Loc su) = Loc $ rm_effect_ su ll
loc_rm_effect loc locv = 
    if null notafter then
        Just loc
    else if has_init loc (last notafter) then
        Nothing -- loc will be removed!
    else
        Just $ foldl sub_effect loc (reverse $ notafter)
    where
        notafter = filter (\l -> l<=loc) $ rm_inits $ sort locv
        sub_effect (Loc ll) (Loc su) = Loc $ rm_effect_ su ll
loc_rm_effect loc locv = 
    if null notafter then
        Just loc
    else if has_init loc (last notafter) then
        Nothing -- loc will be removed!
    else
        Just $ foldl sub_effect loc (reverse $ notafter)
    where
        notafter = filter (\l -> l<=loc) $ rm_inits $ sort locv
        sub_effect (Loc ll) (Loc su) = Loc $ rm_effect_ su ll