fpco / unliftio

The MonadUnliftIO typeclass for unlifting monads to IO
Other
151 stars 51 forks source link

Redefine MonadUnliftIO idempotency laws #41

Closed brandon-leapyear closed 5 years ago

brandon-leapyear commented 5 years ago

:sparkles: This is an old work account. Please reference @brandonchinn178 for all future communication :sparkles:


The original law, askUnliftIO >>= (\u -> liftIO (unliftIO u m)) = m, conflates two things in my opinion: the fact that askUnliftIO itself doesn't modify the state, and that liftIO/unliftIO are inverse operations. So I separated these two properties into separate laws and named these the "idempotency laws" since these laws claim that the MonadUnliftIO-specific operations should not have side effects, but rather should only do the work of inversing liftIO.

Let me know what you think!