`pipes` is a group of libraries written in Haskell to provide safe, functional, and strict I/O.
Questions tagged [haskell-pipes]
139 questions
2
votes
1 answer
Stream from `Managed` pipe
I'm using Control.Monad.Managed to wrap pipes-http's withHTTP in a continuation transformer, but I also want to stream the HTTP response out afterwards:
import Pipes
import Pipes.ByteString
import Pipes.HTTP
import Control.Applicative
import…

tranma
- 23
- 3
2
votes
3 answers
Generalizing a function to merge a set of Haskell pipes Producers
I am working with the Haskell pipes package.
I am trying to use pipes-concurrency to merge a list of Producers together.
What I want to arrive at is:
merge :: MonadIO m => [Producer a m ()] -> Producer a m ()
so given a producer s1 and another…

sh54
- 1,230
- 1
- 11
- 20
2
votes
2 answers
Is a one-yield-per-await restricted pipe possible?
I'm working with pipes-4.0.0. In that library, the number of yields to downstream a pipe makes is in general unrelated to the number of awaits from upstream.
But suppose I wanted to build a restricted pipe that enforced that one and only one yield…

danidiaz
- 26,936
- 4
- 45
- 95
2
votes
1 answer
MonadTransControl instance for ProxyFast/ProxyCorrect
Using pipes, I'm trying to write an instance of MonadTransControl for the ProxyFast or ProxyCorrect type. This is what I've got:
instance MonadTransControl (ProxyFast a' a b' b) where
data StT (ProxyFast a' a b' b) a = StProxy { unStProxy ::…

bennofs
- 11,873
- 1
- 38
- 62
2
votes
1 answer
Haskell Control.Proxy.TCP Producer
I've been playing with the Control.Proxy.TCP library and would like to to create a Producer from a network source.
producer :: Proxy p => HostName -> ServiceName -> () -> Producer p BS.ByteString IO ()
producer h p () = runIdentityP $
lift $…

Jon Nadal
- 729
- 9
- 14
1
vote
1 answer
pipes `take` with default value
I have a producer p with type Producer Message IO (Producer SB.ByteString IO ()).
Now I need optionally skip some messages and optionally process certain number of messages:
let p =
(processMBFile f >->
P.drop…

krokodil
- 1,326
- 10
- 18
1
vote
1 answer
Writing into a file in a streaming way and stop when we reach a given memory file size
Let's say I want to save a stream of MyItem into a file (in JSON for example). I would like to stop when the file reach a certain size limit in bytes.
I would like to do it in Haskell... streaming is not the issue for me it's more how to get the…

Nicolas Henin
- 3,244
- 2
- 21
- 42
1
vote
2 answers
Composing Pipes into a loop or cycle in haskell
This question is about the Haskell library Pipes.
This question is related to 2019 Advent of Code Day 11 (possible spoiler warning)
I have two Pipe Int Int m r brain and robot that need to pass information too each other in a continuous loop. That…

John F. Miller
- 26,961
- 10
- 71
- 121
1
vote
2 answers
How to get the current UTC time in Haskell?
i want to use system time in my code for having the record of time when the data is captured from the user interface.how to get system time using Haskell.

arjun a
- 151
- 7
1
vote
1 answer
Pipes (Haskell lib) - piping pipes with different state monad
My goal is to have the last value produced equal to 80 (40 + 40) (see code below)...
import Pipes
import Pipes.Prelude
import Pipes.Lift
import Control.Monad.State.Strict
data Input = A Integer | B Integer | C Integer
main :: IO ()
main =…

Nicolas Henin
- 3,244
- 2
- 21
- 42
1
vote
0 answers
Serialize Sources with conduit
I'm looking for a function that could have this signature :
serializeSources :: Monad m => [Source m a] -> Source m a
Having x sources with the same value produced that are serialized into 1 stream...First produced first received by downstream…

Nicolas Henin
- 3,244
- 2
- 21
- 42
1
vote
0 answers
Libs to have a minimal api rest server running with routing features fully integrated with conduit
I'd like to stream all the way in an API rest with the conduit lib using routing features etc... So far I have used scotty but I'm obliged to terminate the stream inside my api rest call instead to fully integrate conduit with it... Maybe scotty is…

Nicolas Henin
- 3,244
- 2
- 21
- 42
1
vote
1 answer
Passing State from a Producer to a Parser
I'm using pipes, attoparsec, and pipes-attoparsec to write a database dump file converter. The general format of the file is to have a create table command followed by an optional insert command. In addition to transforming the statements in…

cimmanon
- 67,211
- 17
- 165
- 171
1
vote
1 answer
cannot import Control.Proxy.Trans.Either
I'm trying to learn how to use pipes together with attoparsec by following the tutorial https://hackage.haskell.org/package/pipes-attoparsec-0.1.0.1/docs/Control-Proxy-Attoparsec-Tutorial.html . But I was not able to import…

user2812201
- 437
- 3
- 7
1
vote
1 answer
Lifting a pipe to work on tuples
I need a function with type Pipe a b m r -> Pipe (a, c) (b, c) m r.
But no matter how much I play with for, ~> or >~; I can not match the types properly.
Can you help me?

utdemir
- 26,532
- 10
- 62
- 81