$\DeclareMathOperator\Set{\mathit{Set}}\DeclareMathOperator\Dom{\mathit{Dom}}\DeclareMathOperator\Hilb{\mathit{Hilb}}$Many different kinds of data structures can be captured as Monads. Lists and trees are two good examples. A domain (dcpo) is like a tree, with extra axioms.

Definition.Adirected subsetof a partially ordered set is a nonempty subset which contains an upper bound for every pair of elements in it. Adomainordcpo(directed-complete partial order) is a partially ordered set such that every directed subset has a supremum.

Can domains be encoded as a monad or comonad?

My intuition is telling me you can get both based on this paper.

One thought for the base category I would like to fix is $\Set$. So the functor $\Dom : \Set \rightarrow \Set $ maps a set to the set of all domains on that set. I am not sure how this functor works on morphisms. Another category of interest is $\Hilb$, so $\Dom_H : \Hilb \rightarrow \Hilb$. Below are some notes about $\Dom_H$.

It may be impossible to define such a monad, but we would need a proof.

[Edit] I am still trying to find a Domain monad. Tim Campion's suggestion about the base category is important. I suggested Set as the base, but Andrej Bauer has stated that it is unlikely to find a suitable functor. I am intrigued by Tim's comment that "there exists upper bounds" but they are not expressly defined. Perhaps the domain on Sets is a kind of abstract structure for the more specific domains we can define on more structured sets. To be precise, if we define the monad on structured objects, we can expressly state how to find upper bounds given a directed set. I am working from a physicist's perspective so I am thinking about Hilbert spaces. There is the spectral order as seen here and it forms a domain. They don't state how to compute upper bounds given a directed set, but perhaps this is a better, more concrete example where we can explicitly state how to comput upper bounds, thus making it a better candidate for a monad.

semanticsof a language to take values. Are you sure you want a "domain" data structure? Note also that the "nonalgebraic" nature of the definition of a domain (saying thereexistupper bounds but notspecifiedupper bounds) is not very monad-friendly. $\endgroup$ – Tim Campion♦ Feb 27 '18 at 17:445more comments