[Haskell-cafe] how to inject another source into conduit

Alexander V Vershilov alexander.vershilov at gmail.com
Mon Nov 12 04:02:40 CET 2012


Hello.

I have problems with writing next code (using network-conduit)

slightly simplified version:

> app ad = appSource ad $$ sink
>   where 
>     cMap = M.fromList [ ("upload", cmdUpload), ("download", cmdDownload) ]
>     sink = takeLine >>= \c -> case c of Just run -> run ; Nothing -> return ()
>     cmdUpload = {- ... -} CB.sinkFile path
>     cmdDownload = do
>         {- code here -}
>         CB.sourceFile path $$ appSink ad  -- this will not work because of 
>                                           -- type error

And I'm catching "cannot construct the infinite type".

I've found an example in [1], but it's not exactly solves my problem, as all
the logic is inside conduit, and it will break upload function.

[1] http://www.yesodweb.com/blog/2012/06/conduit-0-5

--
Alexander Vershilov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121112/f1164c6d/attachment.pgp>


More information about the Haskell-Cafe mailing list