Questions tagged [haskell-pipes]

`pipes` is a group of libraries written in Haskell to provide safe, functional, and strict I/O.

139 questions
1
vote
1 answer

Clarification on Streaming and Effects in context of Pipes Library

The pipes tutorial have mentioned this in their documentation: If you sacrifice Effects you get Haskell's pure and lazy lists, which you can transform using composable functions in constant space, but without interleaving effects. If you sacrifice…
Sibi
  • 47,472
  • 16
  • 95
  • 163
1
vote
1 answer

In Haskell, how do I promptly close resources?

Old pipes tutorial has following example. How would this code look like with version 4.1.1? read' :: FilePath -> Frame Text IO C C () read' file = do liftU $ putStrLn "Opening file..." h <- liftU $ openFile file ReadMode -- The…
Rumca
  • 1,809
  • 12
  • 17
1
vote
1 answer

Catching exceptions in a pipe without terminating it

This feels like kind of a long shot, but I wrote a pipe to connect to a database, get a list of databases on the server, connect to each one, then perform a query on each one (a user count), then print those counts. Unfortunately this is about as…
David McHealy
  • 2,471
  • 18
  • 34
1
vote
2 answers

Typechecking problems with pipes-attoparsec

I've been trying out pipes-attoparsec but haven't been having much luck. It appears that there is a type mismatch between Void and X in (what seems to be) relatively straightforward code. From what I've read in the library (that this will be a type…
user1219
  • 103
  • 5
1
vote
1 answer

How to "vertically stack" Control.Frames?

In the pipes package, the tutorial Control.Pipes.Tutorial [1] shows how to "vertically stack" pipe components using the monad >> operator. How would I go about doing that with Control.Frame? For example, using the definitions from the Control.Frame…
ErikR
  • 51,541
  • 9
  • 73
  • 124
0
votes
0 answers

Await with timeout using purescript-pipes

I'm trying to use a combination of purescript-pipes, and purescript-pipes-aff to write a version of await which will return Nothing if it doesn't receive a value in a specified amount of time. So far, I've written the following: timeOut :: forall a…
Joe
  • 1,479
  • 13
  • 22
0
votes
1 answer

Parsing an iterable without listifying each chunk

Suppose I want to achieve a splitting of a Python iterable, without listifying each chunk, similar to itertools.groupby, whose chunks are lazy. But I want to do it on a more sophisticated condition than equality of a key. So more like a parser. For…
Eric Auld
  • 1,156
  • 2
  • 14
  • 23
0
votes
1 answer

"Yield from" in Haskell Pipes

In Haskell Pipes, suppose I am writing f :: Producer a m () and I am inside a do block with respect to m (Edit: this doesn’t make sense; I want a producer do block). Inside this do block, I want to yield from g :: Producer a m () before returning to…
Eric Auld
  • 1,156
  • 2
  • 14
  • 23
0
votes
1 answer

Pipes `run` with State

I have a producer: p :: Producer Message IO r. I can process all messages using: runEffect $ for p processMessage where processMessage :: Message -> Effect IO (). How can I implement stateful processing using something like: processMessage ::…
krokodil
  • 1,326
  • 10
  • 18
0
votes
1 answer

how to insert an IO operation into a Pipe

I have a Haskell function which given a directory from which to get recursively all files and writes the filenames into a file. This is a simple example to start with. In the next step I must replace the mapping from file to a text (the transf…
user855443
  • 2,596
  • 3
  • 25
  • 37
0
votes
0 answers

How to write GroupBy function using the Pipes library

I've figured out a way to implement this function on the InCore representation of the data as follows: groupByCol :: (Eq a, Ord a, RecVec rs) => (forall (f :: * -> *). Functor f => (a -> f a) -> Record…
josiah
  • 1,314
  • 1
  • 13
  • 33
0
votes
2 answers

How to use a ZMQ subscriber in Haskell with pipes

I can get a ZMQ subscriber to work in Haskell, but would appreciate guidance on how to use that data with Pipes. My attempt at writing a Producer fails at 'stack build' with the following error: Couldn't match type ‘Proxy X () c'0 c0 (ZMQ z)’ with…
Stuart
  • 51
  • 5
0
votes
1 answer

GroupBy of stream by agreggateId (Haskell / concurrency streaming)

Context : I'm implementing an App in CQRS and I'm trying to optimize the processing of commands (1 stream by aggregate Id basically)... Problem : I would like to have a first stream that receives all the commands and dispatches these ones by their…
Nicolas Henin
  • 3,244
  • 2
  • 21
  • 42
0
votes
1 answer

Reading strings from stdin or argument in Haskell CLI

I'm trying to build a Haskell CLI that can either read in strings from stdin or from arguments like so: cat colors-multi-line | colorshift -d 10 colorshift -d 10 "#FFFFFF" How would I accomplish this?
0
votes
0 answers

Turtle: dealing with non-utf8 input

In my path to learning Pipes, I've run into problems when dealing with non-utf8 files. That is why I've took a detour into the Turtle library to try to understand how to solve the problem there, at higher level of abstraction. The exercise I want to…
Damian Nadales
  • 4,907
  • 1
  • 21
  • 34
1 2 3
9
10