base' = mbase {domDelegate = Nothing, domImport = Nothing}
-- print base
if depth <= 0 then return $ Left "Nesting of imports is too deep"
else case ((domDelegate mbase), (domImport mbase)) of
(Nothing, Nothing ) -> return $ Right base'
(Nothing, Just keys) -> foldM mergeIncl1 (Right base') keys
base' = mbase {domDelegate = Nothing, domImport = Nothing}
-- print base
if depth <= 0 then return $ Left "Nesting of imports is too deep"
else case ((domDelegate mbase), (domImport mbase)) of
(Nothing, Nothing ) -> return $ Right base'
(Nothing, Just keys) -> foldM mergeIncl1 (Right base') keys