
Hi Cafe, I'm wondering why Data.Void does not have a Monoid instance, or, what would be the problem if we do "mempty = absurd mempty"? Long story: I was using a monad with some transformers, then I realize I can collapse State and Reader into RWST with Void being Writer output. (well, I could have just used Unit but I wanna give Void a try...) I know beforehand that Void is Semigroup but is a bit surprise it doesn't have Monoid instance. Javran Cheng

On Sun, Jan 13, 2019 at 4:00 PM Javran Cheng
Hi Cafe,
I'm wondering why Data.Void does not have a Monoid instance, or, what would be the problem if we do "mempty = absurd mempty"?
This diverges, does it not? A monoid has an identity element, and void does not.
Long story: I was using a monad with some transformers, then I realize I can collapse State and Reader into RWST with Void being Writer output. (well, I could have just used Unit but I wanna give Void a try...) I know beforehand that Void is Semigroup but is a bit surprise it doesn't have Monoid instance.
How would you write return with void as the writer? You can accomplish what you want with the free monoid over Void - i.e. [Void], which is isomorphic to unit. So unit seems like the right choice. --Will
participants (2)
-
Javran Cheng
-
William Yager