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

2012-11-12 Thread Alexander V Vershilov
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


signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2012-11-12 Thread Michael Snoyman
I don't think there's enough information in the snippet you've given to
determine what the problem is. And in general, it's a good idea to include
the actual error message from the compiler.


On Mon, Nov 12, 2012 at 5:02 AM, Alexander V Vershilov 
alexander.vershi...@gmail.com wrote:

 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

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe