Skip to content

Commit daf54bf

Browse files
committed
Fix warnings about deprecation in streaming-bytestring
1 parent 24f1dd7 commit daf54bf

File tree

1 file changed

+15
-5
lines changed
  • kubernetes-client/src/Kubernetes/Client

1 file changed

+15
-5
lines changed

kubernetes-client/src/Kubernetes/Client/Watch.hs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE FlexibleContexts #-}
23
{-# LANGUAGE OverloadedStrings #-}
4+
35
module Kubernetes.Client.Watch
46
( WatchEvent
57
, eventType
@@ -11,14 +13,22 @@ import Control.Monad
1113
import Control.Monad.Trans (lift)
1214
import Data.Aeson
1315
import qualified Data.ByteString as B
14-
import qualified Data.ByteString.Streaming.Char8 as Q
1516
import qualified Data.Text as T
16-
import Kubernetes.OpenAPI.Core
1717
import Kubernetes.OpenAPI.Client
18+
import Kubernetes.OpenAPI.Core
1819
import Kubernetes.OpenAPI.MimeTypes
1920
import Kubernetes.OpenAPI.Model (Watch(..))
2021
import Network.HTTP.Client
2122

23+
#if MIN_VERSION_streaming_bytestring(0,1,7)
24+
import qualified Streaming.ByteString.Char8 as Q
25+
type ByteStream = Q.ByteStream
26+
#else
27+
import qualified Data.ByteString.Streaming.Char8 as Q
28+
type ByteStream = Q.ByteString
29+
#endif
30+
31+
2232
data WatchEvent a = WatchEvent
2333
{ _eventType :: T.Text
2434
, _eventObject :: a
@@ -68,7 +78,7 @@ dispatchWatch ::
6878
Manager
6979
-> KubernetesClientConfig
7080
-> KubernetesRequest req contentType resp accept
71-
-> (Q.ByteString IO () -> IO a)
81+
-> (ByteStream IO () -> IO a)
7282
-> IO a
7383
dispatchWatch manager config request apply = do
7484
let watchRequest = applyOptionalParam request (Watch True)
@@ -78,14 +88,14 @@ dispatchWatch manager config request apply = do
7888
withHTTP ::
7989
Request
8090
-> Manager
81-
-> (Response (Q.ByteString IO ()) -> IO a)
91+
-> (Response (ByteStream IO ()) -> IO a)
8292
-> IO a
8393
withHTTP request manager f = withResponse request manager f'
8494
where
8595
f' resp = do
8696
let p = (from . brRead . responseBody) resp
8797
f (resp {responseBody = p})
88-
from :: IO B.ByteString -> Q.ByteString IO ()
98+
from :: IO B.ByteString -> ByteStream IO ()
8999
from io = go
90100
where
91101
go = do

0 commit comments

Comments
 (0)