[Haskell-cafe] Why does `mzip /= liftM2 (,)`

Mateusz Kowalczyk fuuzetsu at fuuzetsu.co.uk
Thu Apr 20 18:52:36 UTC 2017


Hi,

Today after half a decade I have found `MonadZip` in `base`.

The laws state:

```
liftM (f *** g) (mzip ma mb) = mzip (liftM f ma) (liftM g mb)


liftM (const ()) ma = liftM (const ()) mb
==>
munzip (mzip ma mb) = (ma, mb)
```

The question is why does

```
mzip /= liftM2 (,)
```

in plain words. Notably we can see lack of IO instance which I'm
guessing has something to do asynchronous exceptions but I'm probably
wrong…. Rather than investigating for next 30 minutes, I thought I'd
just sample existing knowledge (that I could not find out from Google).

In what circumstances can we not replace `liftM2 (,)` with `mzip`?

-- 
Mateusz K.


More information about the Haskell-Cafe mailing list