summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2016-02-23 12:39:08 -0500
committerAndrew Cady <d@jerkface.net>2016-02-23 12:39:08 -0500
commitaad209be278b2c6b96c461d6d7b221b29bd964cc (patch)
treed45aeade56f69cc2c56f376d3f02e74e4facc1a4
parent2191e88da4b3cace8d30ac91854a1e566c6bb7b2 (diff)
avoid forked xml-conduit
turns out it wasn't necessary
-rw-r--r--Presence/XMPPServer.hs14
-rw-r--r--stack.yaml6
2 files changed, 13 insertions, 7 deletions
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs
index 8845ea72..08e0b8c3 100644
--- a/Presence/XMPPServer.hs
+++ b/Presence/XMPPServer.hs
@@ -248,6 +248,18 @@ wlog s = putStrLn s >> hFlush stdout
248wlogb :: ByteString -> IO () 248wlogb :: ByteString -> IO ()
249wlogb s = Strict8.putStrLn s >> hFlush stdout 249wlogb s = Strict8.putStrLn s >> hFlush stdout
250 250
251flushPassThrough :: Monad m => Conduit a m b -> Conduit (Flush a) m (Flush b)
252flushPassThrough c = getZipConduit $ ZipConduit (onlyChunks =$= mapOutput Chunk c) <* ZipConduit onlyFlushes
253 where
254 onlyChunks :: Monad m => Conduit (Flush a) m a
255 onlyFlushes :: Monad m => Conduit (Flush a) m (Flush b)
256 onlyChunks = awaitForever yieldChunk
257 onlyFlushes = awaitForever yieldFlush
258 yieldFlush Flush = yield Flush
259 yieldFlush _ = return ()
260 yieldChunk (Chunk x) = yield x
261 yieldChunk _ = return ()
262
251xmlStream :: ReadCommand -> WriteCommand -> ( Source IO XML.Event 263xmlStream :: ReadCommand -> WriteCommand -> ( Source IO XML.Event
252 , Sink (Flush XML.Event) IO () ) 264 , Sink (Flush XML.Event) IO () )
253xmlStream conread conwrite = (xsrc,xsnk) 265xmlStream conread conwrite = (xsrc,xsnk)
@@ -255,7 +267,7 @@ xmlStream conread conwrite = (xsrc,xsnk)
255 xsrc = src $= XML.parseBytes XML.def 267 xsrc = src $= XML.parseBytes XML.def
256 xsnk :: Sink (Flush Event) IO () 268 xsnk :: Sink (Flush Event) IO ()
257 xsnk = -- XML.renderBytes XML.def =$ snk 269 xsnk = -- XML.renderBytes XML.def =$ snk
258 XML.renderBuilderFlush XML.def 270 flushPassThrough (XML.renderBuilder XML.def)
259 =$= builderToByteStringFlush 271 =$= builderToByteStringFlush
260 =$= discardFlush 272 =$= discardFlush
261 =$ snk 273 =$ snk
diff --git a/stack.yaml b/stack.yaml
index 75d3a726..e2280624 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -7,12 +7,6 @@ resolver: lts-5.4
7# Local packages, usually specified by relative directory name 7# Local packages, usually specified by relative directory name
8packages: 8packages:
9- '.' 9- '.'
10- location:
11 git: git@github.com:afcady/xml.git
12 commit: 3096cfd59ea95944fab4b0af26e1722863f02090
13 subdirs:
14 - xml-conduit
15 extra-dep: true
16# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) 10# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
17extra-deps: [] 11extra-deps: []
18 12