Menu
  • HOME
  • TAGS

Haskell fast concurrent queue

haskell,concurrency,profiling,stm,haskell-pipes

So I can give you a little overview of some of the analysis of Chan and TQueue (which pipes-concurrency is using internally here) that motivated some design decisions that went into unagi-chan. I'm not sure if it will answer your question. I recommend forking different queues and playing with variations...

Subsampling a huge json array with Haskell

json,haskell,haskell-pipes

I believe you will not be able to reuse aeson for this. From the aeson Parser documentation: It can be useful to think of parsing as occurring in two phases: Identification of the textual boundaries of a JSON value. This is always strict, so that an invalid JSON document can...

Parsing a stream of JSON with pipes-aeson

haskell,haskell-pipes

decoded (the one from Pipes.Aeson.Unchecked) is a lens than transforms a Producer of raw bytes into a Producer of parsed FromJSON values. So, we must first create the Producer of bytes out of the socket using the fromSocket function from the pipes-network package. Something like this: -- to help with...

Pipes get Network.Socket.ByteString.recv: failed (Unknown error)

haskell,haskell-pipes

The error is this part: HTTP.withHTTP req m return There is a convention (not enforced by the types) that when a function begins with the word with that you are not allowed to let the resource it allocates escape from the block it encloses. The reason why is that these...

How to detect end of input with pipes

haskell,haskell-pipes

Even more than pipes-parse you quite possibly want to take a look at pipes-group. In particular, let's examine the function -- this type is slightly specialized chunksOf :: Monad m => Int -> Lens' (Producer a m x) (FreeT (Producer a m) m x) The Lens' bit is perhaps scary...

Construct a pipes Proxy inside-out

haskell,haskell-pipes

Actually, I think makeProxy is possible if you slightly change the type. I am on my phone so I cannot type check this just yet, but I believe this works: {-# LANGUAGE RankNTypes #-} import Control.Monad.Trans.Class (lift) import Pipes.Core makeProxy :: Monad m => ( forall n. Monad n =>...

Clarification on Streaming and Effects in context of Pipes Library

haskell,haskell-pipes

Streaming does indeed imply interleaved effects. The text you quote does not say otherwise. To paraphrase the pipes documentation: If you don't have effects, then you're just left with lazy data structures. They compose nicely but you can't do IO (except lazy IO, which we're trying to avoid). If you...

In Haskell, how do I promptly close resources?

haskell,haskell-pipes

The equivalent function is readFile from Pipes.Safe.Prelude, which you can find here. I've pasted the source below for reference: withFile :: MonadSafe m => FilePath -> IO.IOMode -> (IO.Handle -> m r) -> m r withFile file ioMode = bracket (liftIO $ IO.openFile file ioMode) (liftIO . IO.hClose) readFile ::...