Re: [Haskell-cafe] forkProcess, forkIO, and multithreaded runtime

2012-10-15 Thread Simon Marechal
On 15/10/2012 09:47, Michael Snoyman wrote: > With the program at the end of this email, I would expect that, once per > second, I would get a message printed from each forkIO'd green thread, > the forked process, and the master process. And if I spawn 8 or less > child threads that's precisely wha

[Haskell-cafe] ANNOUNCE: hslogstash (library for working with Logstash and related tools)

2013-01-25 Thread Simon Marechal
This is a library for sysadmins and/or tool writers. It provides proper types and correct serialization for Logstash messages, along with small utilities for working with ElasticSearch or Redis (using hedis). This library focus will be on safety (no messages lost). Right now, it can be used to: *

[Haskell-cafe] "branching" conduits

2013-01-31 Thread Simon Marechal
Hello, I have found the Conduit abstraction to be very well suited to a set of problems I am facing. I am however wondering how to implement "branching" conduits, and even conduit pools. I am currently in the process of rewriting parts (the simple parts) of the Logstash tool. Ther

Re: [Haskell-cafe] "branching" conduits

2013-01-31 Thread Simon Marechal
On 31/01/2013 13:50, Michael Snoyman wrote: > * To simplify, we start off with a call to injectLeftovers. This means > that we can entirely ignore the Leftover constructor in the main function. > * Since a Sink will never yield values, we can also ignore the > HaveOutput constructor. > * As soon as

[Haskell-cafe] Yet another Conduit question

2013-01-31 Thread Simon Marechal
I am working with bulk sources and sinks, that is with a type like: Source m [a] Sink [a] m () The problem is that I would like to work on individual values in my conduit. I can have this: concat :: (Monad m) => Conduit [a] m a concat = awaitForever (mapM_ yield) But how can I do it the other w

Re: [Haskell-cafe] Yet another Conduit question

2013-01-31 Thread Simon Marechal
On 02/01/2013 05:21 AM, Michael Snoyman wrote: > Firstly, what's the use case that you want to deal with lists? If it's > for efficiency, you'd probably be better off using a Vector instead. That is a good point, and I wanted to go that way, but was not sure it would help me a lot here. My use cas

Re: [Haskell-cafe] Yet another Conduit question

2013-02-01 Thread Simon Marechal
On 01/02/2013 08:21, Michael Snoyman wrote: > So you're saying you want to keep the same grouping that you had > originally? Or do you want to batch up a certain number of results? > There are lots of ways of approaching this problem, and the types don't > imply nearly enough to determine what you'

Re: [Haskell-cafe] Yet another Conduit question

2013-02-04 Thread Simon Marechal
On 03/02/2013 16:06, Felipe Almeida Lessa wrote: > I guess you could use the Flush datatype [1] depending on how your > data is generated. Thank you for this suggestion. I tried to do exactly this by modifying my bulk Redis source so that it can timeout and send empty lists [1]. Then I wrote a few

Re: [Haskell-cafe] How to quantify the overhead?

2013-02-15 Thread Simon Marechal
On 13/02/2013 23:06, Daryoush Mehrtash wrote: > Suppose I have a big list of integers and I like to find the first two > that add up to a number, say 10. > > One approach is to put the numbers in the map as I read them and each > step look for the 10-x of the number before going on to the next va

Re: [Haskell-cafe] JSON querying

2013-02-17 Thread Simon Marechal
On 02/17/2013 04:01 PM, Sergey Mironov wrote: > Hi folks. Hackage contains several JSON packages but as far as I see, > they all provide 'static' conversion from JSON format to Haskell data > type. Is there a method of converting object containing optional filed > 'a' to for example Maybe a. Data.

[Haskell-cafe] Split and substitution using regex-pcre

2013-02-24 Thread Simon Marechal
I could not find the perl-equivalents of these functions on Hackage, so I quickly wrote mine. Code is there: https://github.com/bartavelle/pcre-utils It should behave like perl (not really tested actually), and do strange things like : > splitCompile "a" "b" Right ["","","","","b"] > splitCo

Re: [Haskell-cafe] ANN: retry 0.1 - retry combinators for monadic actions that often fail

2013-03-13 Thread Simon Marechal
On 13/03/2013 05:14, Ozgun Ataman wrote: > In either case, there is a ceiling for the number of total retries. This is something that I might want to use in many places. Is it possible to have an infinite number of retries, instead of specifying impossibly large values ? _

[Haskell-cafe] The rmonad package is mysterious

2013-04-10 Thread Simon Marechal
I tried to do something simple using the rmonad package (attached). I followed the example that's in haddocks (it is wrong, constraints has no arguments), grabbed the list of extensions from rmonad's source, but this program doesn't typecheck: Could not deduce (Hashable a) arising from a use of `

Re: [Haskell-cafe] Fwd: Backward compatibility

2013-05-05 Thread Simon Marechal
On 05/05/2013 11:41 AM, Adrian May wrote: > Half a decade is nothing to most programming cultures. > A newbie looks for sample code and blames himself if he can't get it > working. I ran into this kind of trouble when I was starting to learn Haskell. I had error messages like that : test.hs:1:8:

[Haskell-cafe] Debugging embedded ruby interpreter

2013-05-22 Thread Simon Marechal
Hello, I am trying to embed a ruby interpreter into my Haskell library. It didn't seem complicated, and went flawlessly until I tried using it a lot. Then I got segfaults. Here is a test program that corrupts the Array object that is being created : https://github.com/bartavelle/hruby/bl

Re: [Haskell-cafe] Debugging embedded ruby interpreter

2013-05-23 Thread Simon Marechal
On 05/22/2013 11:36 PM, Simon Marechal wrote: > Anyone has an idea on how I should approach this problem ? For future reference : I believe I have found the problem, and it was quite obvious ... When generating Ruby objects from Haskell, they are not referenced by anything in the interpre