maps :: (Functor f, Monad m) => (forall x. f x -> g x) -> Stream f m r -> Stream g m r Note the first argument: this function replaces the functor but leaves the value inside it unchanged. Why? Because it’s under forall, we can’t do anything with it other than pass it around. Thus, we are guaranteed that the stream structure remains unchanged.