Interesting. There seem to be quite a few of these.
const id (Identity x) (Identity y) = Identity y = liftA2 (const id) (Identity x) (Identity y)
If m is occlusive, so is ReaderT e m:
liftA2 (const id) (ReaderT f) (ReaderT g) = ReaderT $ \r -> liftA2 (const id) (f r) (g r) = ReaderT $ \r -> g r = ReaderT g
I believe this works for StateT as well. The first counterexample is Writer w for a non-trivial monoid w.
By an occult effect I mean that under the type signature (M a -> M b -> M b) of a particular monad M, the two expressions (const id) and (liftM2 $ const id) are equivalent.
Occult here refers to how the effect of the second parameter blocks the effect of the first one.
In your opinion, is there a better word than occult to describe the property of such monads?
--
-- Kim-Ee
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.