blob: a8e20c3c59ee89d58118dcdb94ea8249631cac95 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
import Control.Monad.IO.Class
import Control.Monad.Trans.Resource
-- import Control.Monad.Trans.Class
import Data.Conduit
import Data.Conduit.List as CL
-- import Data.XML.Types
import System.Environment
import Text.XML.Stream.Parse
import XMPPToTox
{-
parse :: ConduitM Event o (ResourceT IO) ()
parse = do
return ()
-}
showTox :: CryptoMessage -> ResourceT IO ()
showTox = liftIO . print
main :: IO ()
main = do
args <- getArgs
let xmlfile = args !! 0
-- runConduit :: Monad m => ConduitM () Void m r -> m r
-- test-xmpp.hs:19:51: warning: [-Wdeprecations]
-- In the use of ‘$$’
-- (imported from Data.Conduit, but defined in conduit-1.3.0.3:Data.Conduit.Internal.Conduit):
-- Deprecated: "Use runConduit and .|"
--
-- runResourceT $ parseFile def xmlfile =$= parse $$ return ()
runResourceT $ runConduit $ do
parseFile def xmlfile
.| xmppToTox
-- CL.mapM_ :: Monad m => (a -> m ()) -> ConduitT a o m ()
.| CL.mapM_ showTox
|