Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Hell Is Other REPLs. Parent comment
It's (provably, I think) impossible for fully general monads, but for traversable-but-otherwise-general monads you can do[0]:
newtype (%) (f1::k1->Type) (f2::k2->k1) (a::k2) = Comp { unComp :: (f1 (f2 a)) } instance (Monad f1,Monad f2,Traversable f2) => Monad (f1 % f2) where join (Comp a) = Comp $ a >>= (map join . mapA (unComp )) (Comp a) >>= k = Comp $ a >>= (map join . mapA (unComp . k))
0: copied from my own code, so it might need other adjustment than s/map/fmap/ and s/mapA/traverse/.
It's (provably, I think) impossible for fully general monads, but for traversable-but-otherwise-general monads you can do[0]:
(For that matter, you only need f2 to be traversable; f1 can be any monad at all.)0: copied from my own code, so it might need other adjustment than s/map/fmap/ and s/mapA/traverse/.