While writing down this answer, mostly to get a better understanding of pairs as monads, I stumbed into this source code on Hackage where I read, in reference to the Monad
instance of (,) a
only this
instance Monoid a => Monad ((,) a) where
(u, a) >>= k = case k a of (v, b) -> (u <> v, b)
where's return
??? I expected to find something like this
return a = (mempty, a)
in addition to the two lines above. Is this definition of return
somehow implied by something else? Or maybe it's defined somewhere else?