I'm just wondering whether there's a concise term for something that's both a monad and a comonad. I've done some searching, and I know these structures exist, but I haven't found a name for them.
Asked
Active
Viewed 424 times
7
-
1Something that is both an X and a co-X is often called a "bi-X", so maybe "bimonad"? I don't know if people actually use the word "bimonad", though. – kini Nov 27 '14 at 15:50
-
1@KeshavKini: that notion of bimonad would be incompatible with [bifunctors](http://hackage.haskell.org/package/bifunctors/docs/Data-Bifunctor.html#t:Bifunctor). – leftaroundabout Nov 27 '14 at 16:15
-
1... are you asking the name of the cathegory theory's concept? In this case your question is wildly off-topic and should be asked on the Computer Science.SE. If you are asking if there exist type-classes for such a thing that *state so*, so that your question becomes more programming related, although I still doubt it could considered on-topic since it would basically be an external resources search. – Bakuriu Nov 27 '14 at 19:53
-
The problem is, if you have both a return and an extract function, then your (co)-monad does'nt really is of great use, as it basically enforces nothing. On the other hand, maybe you are thinking of arrows, which is at the intersection of monads and comonads. – PatJ Jan 31 '15 at 20:25
2 Answers
1
Such a creature, subject to certain conditions, is sometimes called a "Hopf monad" or a "Bimonad" (http://ncatlab.org/nlab/show/Hopf+monad).
However, this also requires fulfilling a number of axioms regarding distributive properties, and I haven't seen it come up in a programming context in any particular way.

sclv
- 38,665
- 7
- 99
- 204
0
As far as I know, there is no term to define it because a monad-comonad would enforce nothing: you can always do a return
to get in or an extract
to get out.
As types are there to enforce some constraints, a too permissive constraint wouldn't be of any use. As no one would use it (except for the identity), no one probably bothered to name it.

PatJ
- 5,996
- 1
- 31
- 37
-
I don't see your argument. You seem to be saying, there are no interesting monads that are also comonads. Well, that's wrong, [the linked question](http://stackoverflow.com/questions/16551734/can-a-monad-be-a-comonad) discusses such functors; [non-empty lists](http://hackage.haskell.org/package/semigroups-0.16.1/docs/Data-List-NonEmpty.html) are the obvious example. At any rate, `return` and `extract` need to have no particular relationship, neither knows about the other. I suppose `extract . return` will necessarily always be `id`, but `return . extract` is by no means trivial. – leftaroundabout Feb 11 '15 at 20:05
-
I did not think of that, could you show a minimal example of non-identity `return . extract` ? I'm not good with haskell and can't get to one through this interesting discussion. (I'm making this question wiki so that it can easily be edited (well I'm still new to SO policy so I'm not sure it's the way to do this)) – PatJ Feb 11 '15 at 23:55
-
1