Questions tagged [conduit]

conduit is a Haskell library for composable processing of streaming data.

conduit is a Haskell library for composable processing of streaming data. It was developed as an alternative to iteratee implementations such as enumerator and is now used by several popular packages, including WAI and http-conduit (formerly http-enumerator).

255 questions
0
votes
2 answers

conduit http streaming to file (sinkFile) avoid file creation when http returns error

What is a value that I need to return from the getSrc when the http code is unsuccessful and I wish not to create a file (by sinkFile) If i just return getResponseBody res the http error itself is saved into the file. downloadURL :: String ->…
Barak
  • 43
  • 5
0
votes
0 answers

Fuse two input-files with haskell conduit library

I'm trying to fuse two input files with conduit. file1.dat: META 1 META 2 META 3 TS 1 1 2 3 TS 2 3 4 5 file2.dat: META 1 META 2 META 3 TS 1 0.1 0.0 0.3 TS 2 0.1 0.2 0.1 what I need is a function to source and fuse the input files, discard…
michelk
  • 163
  • 1
  • 6
0
votes
1 answer

How to create json pretty printer with conduit

I'm learning conduit and want to create a processor that would take json input from stdin, process it in some way and then output to stdout. Pretty printing have been chosen just as example. For now I want just decode json and print it. But seems…
user1685095
  • 5,787
  • 9
  • 51
  • 100
0
votes
1 answer

MonadResource for reading files with error handling

I'm creating a Conduit that will read binary files. Stuff can go wrong, so I need a monad with some error handling; for now Maybe is good enough. I'd like to use sourceFile, which requires that the conduit monad be a MonadResource, and this is the…
jorgen
  • 3,425
  • 4
  • 31
  • 53
0
votes
1 answer

How to preserve color when writing to stdout

#!/usr/bin/env stack {- stack --install-ghc --resolver lts-8.8 runghc -} import System.IO import System.Process main = createProcess (proc "ls" []) Although stdout is considered by Haskell as a tty, as hIsTerminalDevice stdout returns True, ls…
0
votes
0 answers

Recover from Exceptions in callProcess

In my following code, I use callProcess to run external git pull. What I want is that if git pull fails in one directory, the program will skip it and try the next directory. But with my code, the program stops with the error messages from…
McBear Holden
  • 5,741
  • 7
  • 33
  • 55
0
votes
1 answer

TLS certification. TLSParameters with CXF conduit

I am trying to establish TLS connection. I read that in order to implement it I should initTLS params and set it to the conduit. This is a generic method that called from consumer side in order to get JaxWs proxy. Could you please advise me What I…
liotur
  • 809
  • 2
  • 17
  • 36
0
votes
1 answer

Data.ByteString.Char8 does not export stripSuffix

I'm working on a stream of ByteStrings. I've imported ByteString via: import qualified Data.ByteString as B I can call every function from the ByteString library e.g.: reverseBS :: Monad m => Conduit B.ByteString m B.ByteString reverseBS = CL.map…
Thomas Vanhelden
  • 879
  • 8
  • 20
0
votes
0 answers

Setting and activate a Multitech Conduit at Bluemix?

I have a MultiTech Conduit Gateway and try to activate it at BlueMix. I have created two Conduit devices. However, the Conduit status is disconnected. How to activate it? Broker = epbb4j.messaging.internetofthings.ibmcloud.com Client ID =…
sliawatimena
  • 338
  • 1
  • 4
  • 16
0
votes
1 answer

Keeping track of length when using requestBodySourceIO

In Network.HTTP.Conduit, requestBodySourceIO has this type signature: Prelude Network.HTTP.Conduit Data.Conduit Control.Monad.Trans.Resource> :t requestBodySourceIO requestBodySourceIO :: GHC.Int.Int64 -> Source IO…
Sal
  • 4,312
  • 1
  • 17
  • 26
0
votes
1 answer

Passing a source with ExceptT to a sink

Given a conduit source with following type signature: sourceMsg :: MonadIO m => ExceptT Err (ConduitM () ByteString m) () how can it be passed to Data.Conduit.List.mapM_? Something like below won't work because output is of type ConduitM a o m (),…
Sal
  • 4,312
  • 1
  • 17
  • 26
0
votes
1 answer

Conduit's "await" receives Maybe. Why? And how to?

I am interested in Conduit's await :: Monad m => ConduitM i o m (Maybe i). Can anyone explain why it happens and, in particular, how do I yield such an optional value or how do I write a producer/source that can do it?
Alexey Raga
  • 7,457
  • 1
  • 31
  • 40
0
votes
1 answer

Haskell Conduit from process capturing both stdout and stderr

Is there a Haskell conduit that can execute a process and capture both its stderr and stdout streams (separately)? The ability to pass in a stdin to the process would be perfect as a conduit too would be perfect, but not a requirement (I can use a…
luispedro
  • 6,934
  • 4
  • 35
  • 45
0
votes
1 answer

Can csv-conduit read a string in csv form and parse it into some intermediate datatype?

The documentation found on csv-conduit's github page is scant, my use case involve reading a string in csv form, ie: csv :: String csv = "\"column1 (text)\",\"column2 (text)\",\"column3 (number)\",\"column4…
xiaolingxiao
  • 4,793
  • 5
  • 41
  • 88
0
votes
1 answer

Why does await always return Nothing when using network conduits?

I'm trying to learn how to use conduits. I have a conduit that takes bytestrings and groups them into packets that represent actions being sent to a server. I then have a conduit that takes these packets, acts on them and yields a response packet.…
user467526
  • 517
  • 5
  • 19
1 2 3
16
17