In what kinds of categories is a monic epi an isomorphism?

Is there a general description of categories $\mathscr{C}$ in which all monic epis are actually isomorphisms?

In general, monic epis need not be isomorphisms. For example, in the $\mathbf{Ab}$-category with a single object and whose morphisms are the elements of some (not necessarily commutative) unital ring $R$, all the regular elements of $R$ are monic epis, but only the units are isomorphisms.

A more concrete example is the category of (edit: Hausdorff; thanks Zhen Lin) topological spaces; the embedding of any dense proper subspace (ex. $\mathbb{Q}$ in $\mathbb{R}$, with the usual topology) is monic since it is injective, and it is an epi since a continuous map from a space to a Hausdorff space is determined by its restriction to a dense subspace. Another example from this category is any continuous bijection that is not a homeomorphism, such as $[0,1)\rightarrow S^1$.

On the other hand, in the category $R$-$\mathbf{mod}$, a monic is injective and an epi is surjective, and a bijective morphism is an isomorphism; thus a monic epi is an isomorphism. By the Freyd-Mitchell Embedding Theorem, it follows that if $\mathscr{C}$ is a small abelian category, a monic epi is an isomorphism. (See these questions to remove the condition "small.")

Likewise, if $\mathscr{C}$ is a concrete category such that monicness and epicness are preserved by the forgetful functor, and an inverse morphism at the level of sets lifts to an inverse in the category, such as $\mathbf{Grp}$ (or $\mathbf{Set}$ for that matter), then monic + epic $\Rightarrow$ isomorphism.

Thus monic + epic $\Rightarrow$ iso is a condition that holds in abelian categories and some other categories, but not all categories.

Is there a reasonable (e.g. clean or elegant) general description of the categories in which monic + epic $\Rightarrow$ iso?

Addendum: for anyone else confused (as I was) on the point Zhen Lin and Qiaochu Yuan mention below about Hausdorff vs. more general topological spaces:

If $X,Y$ are topological spaces and $f,g:X\rightarrow Y$ are continuous maps that agree on a dense subset $D\subset X$, in general there is no guarantee that $f=g$. Indeed, if $Y$ is an indiscrete space, every map to it is continuous, so if it has at least two elements, $f$ and $g$ can be freely chosen to differ outside of $D$ without affecting continuity.

However, if $Y$ is Hausdorff, $f,g$ must agree everywhere, and Hausdorffness is exactly what's needed to force this: if $\exists x\in X$ with $f(x)\neq g(x)$, then there exist disjoint open neighborhoods $U\ni f(x)$ and $V\ni g(x)$ in $Y$, by the Hausdorff assumption, and then $f^{-1}(U)\cap g^{-1}(V)$ is a nonempty open subset of $X$ (since it contains $x$), which thus meets $D$, say in a point $x'$, and therefore $f(x')=g(x')$ is a common point of $U$ and $V$, contrary to their construction.


A category with this property is called balanced, although I think this term is terrible.

In practice, the problem that arises is that the monomorphisms in some category correspond to our intuitive notion of the "injective" maps, but the epimorphisms frequently fail to correspond to our intuitive notion of the "surjective" maps; for example, in $\text{Ring}$, localizations like $\mathbb{Z} \to \mathbb{Q}$ are epimorphisms, and in Hausdorff spaces, any map with dense image is an epimorphism.

To get the "surjective" maps back usually requires working with a stronger notion of epimorphism, such as strong epimorphisms or effective epimorphisms. With any of these stronger notions that I'm aware of, a monomorphism which is an epimorphism in a stronger sense is an isomorphism. So the failure of monic epis to be isos can be thought of as the failure of epis to be some stronger notion of epi.

In an abelian category, more or less by definition, every epimorphism is effective, so we're fine. In general the condition that every epimorphism is effective is a form of the first isomorphism theorem, and I don't know of any abstract nonsense that easily guarantees it: it seems to me that abstract nonsense can't easily distinguish between the category of groups and the category of monoids, and the category of groups has the property that every epimorphism is effective while the category of monoids doesn't (it's again true that any localization is an epimorphism).

For concrete categories $U : C \to \text{Set}$, the second condition you describe (that isomorphisms lift) means that the forgetful functor $U$ is conservative. This is notably the case if $U$ is monadic (and in particular has a left adjoint). $U$ often preserves limits and hence monomorphisms, but it often fails to preserve epimorphisms and hence colimits. This is just a fact of life. (The forgetful functor from groups to sets notably preserves epimorphisms despite hardly preserving any colimits.)

You can get around all of this by proving things about some stronger notion of epimorphism rather than about epimorphisms.