Gabriella439 / pipes

Compositional pipelines
BSD 3-Clause "New" or "Revised" License
487 stars 72 forks source link

Fix ListT MMonad instance #188

Closed ivan-timokhin closed 7 years ago

ivan-timokhin commented 7 years ago

Current instance (e3fc775) is

instance MMonad ListT where
    embed f m = Select (enumerate (embed f m))

…which is just an infinite loop, unless I'm completely misunderstanding something.

For a simple demonstration,

runEffect $ for (enumerate $ pure False) (lift . print)

prints False, whereas

runEffect $ for (enumerate $ embed lift $ pure False) (lift . print)

loops indefinitely, even though embed lift should be equal to id by MMonad laws.

Gabriella439 commented 7 years ago

I verified that both examples succeed and produced the same result after this fix. The fix is up on Hackage as pipes-4.3.2

ivan-timokhin commented 7 years ago

Thanks!

Gabriella439 commented 7 years ago

You're welcome!