Streaming refactoring.
#991
#1076
#1077
The streaming functionality (Servant.API.Stream) is refactored to use
servant’s own SourceIO type (see Servant.Types.SourceT documentation),
which replaces both StreamGenerator and ResultStream types.
New conversion type-classes are ToSourceIO and FromSourceIO
(replacing ToStreamGenerator and BuildFromStream).
There are instances for conduit, pipes and machines in new packages:
servant-conduit
servant-pipes and
servant-machines
respectively.
Writing new framing strategies is simpler. Check existing strategies for examples.
This change shouldn’t affect you, if you don’t use streaming endpoints.
servant-client Separate streaming client.
#1066
We now have two http-client based clients,
in Servant.Client and Servant.Client.Streaming.
Their API is the same, except for
Servant.Client cannot request Stream endpoints.
Servant.Client is run by direct
runClientM :: ClientM a -> ClientEnv -> IO (Either ServantError a)
Servant.Client.Streaming can request Stream endpoints.
Servant.Client.Streaming is used by CPSised
withClientM :: ClientM a -> ClientEnv -> (Either ServantError a -> IO b) -> IO b
To access Stream endpoints use Servant.Client.Streaming with
withClientM; otherwise you can continue using Servant.Client with runClientM.
You can use both too, ClientEnv and BaseUrl types are same for both.
Note: Servant.Client.Streaming doesn’t stream non-Stream endpoints.
Requesting ordinary Verb endpoints (e.g. Get) will block until
the whole response is received.
There is Servant.Client.Streaming.runClientM function, but it has
restricted type. NFData a constraint prevents using it with
SourceT, Conduit etc. response types.
runClientM :: NFData a => ClientM a -> ClientEnv -> IO (Either ServantError a)
This change shouldn’t affect you, if you don’t use streaming endpoints.