# Lazy idempotent monadic actions

**URL:** <https://discourse.haskell.org/t/lazy-idempotent-monadic-actions/8875>\
**Category:** Learn\
**Created:** [February 23, 2024, 3:44am UTC](https://discourse.haskell.org/t/lazy-idempotent-monadic-actions/8875 "2024-02-23T03:44:08Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![olf](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/olf/32/3813_2.png) [@olf](https://discourse.haskell.org/u/olf)\
**Post date:** [February 27, 2024, 7:15am UTC](https://discourse.haskell.org/t/lazy-idempotent-monadic-actions/8875/3 "2024-02-27T07:15:17Z")

</div>

There is also an old discussion about “occult effects” on [haskell cafe](https://mail.haskell.org/pipermail/haskell-cafe/2020-November/132905.html). The discussion is about monads `m` where `idem = pure`, in which case your first requirement can be more concisely written as `a >> b = b`. There are Haskell monads that have this property, but not many. The mathematicians call these the “affine” monads, the effect researchers call it a “discardable” effect.  
My gut feeling is that `idem` can not be implemented for general `m` because it is undecidable in general whether a function is constant or not. (It would solve the halting problem.)

---

_[View the full topic](https://discourse.haskell.org/t/lazy-idempotent-monadic-actions/8875)._
