http4s/http4s.g8

Why is the template based on `Stream`?

armanbilge opened this issue · 3 comments

Specifically this part:

def stream[F[_]: Async]: Stream[F, Nothing] = {

Seems like a vanilla Resource would work just fine via useForever instead of this thing:

Motivation: just got a question about this on the Discord. IMO Stream is a very big step up from IO and Resource for a newcomer.

Interestingly, the IO version of the template uses Resource and useForever exactly like what you would expect.
https://github.com/http4s/http4s-io.g8/blob/66150a467f6a046ff40e2fca6fd65de2fe3c6e7e/src/main/g8/src/main/scala/$package__packaged$/$name__Camel$Server.scala

If this is meant to be an "advanced" template, maybe we should make the distinction more clear?

I would say legacy. StreamApp predates IOApp. I've been trying to teach at work that a Stream[F, ExitCode] is almost never what you want.

I'm going to fix this template to use Resource and useForever like the other one.