Re: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-17 Thread Levi Greenspan
On Tue, Nov 17, 2009 at 1:18 PM, Simon Peyton-Jones simo...@microsoft.com wrote: | What's the status of the TDNR proposal [1]? Personally I think it is a | very good idea and I'd like to see it in Haskell'/GHC rather sooner | than later. Working around the limitations of the current record |

Re: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-17 Thread Levi Greenspan
On Tue, Nov 17, 2009 at 1:18 PM, Simon Peyton-Jones simo...@microsoft.com wrote: I've added an informal straw poll to the bottom of [1] to allow you to express an opinion. Forgive my ignorance, but I can not find a way to edit the wiki page. What am I doing wrong? Cheers, Levi

[Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-16 Thread Levi Greenspan
What's the status of the TDNR proposal [1]? Personally I think it is a very good idea and I'd like to see it in Haskell'/GHC rather sooner than later. Working around the limitations of the current record system is one of my biggest pain points in Haskell and TDNR would be a major improvement. Thus

[Haskell-cafe] Monad woes

2009-08-23 Thread Levi Greenspan
Hi all, I try to create a simple monad using a stack of Reader and IO but when using it, I encounter some problems. The Monad is defined as M a: {-# LANGUAGE GeneralizedNewtypeDeriving #-} module Main where import Control.Monad.Reader import Control.Concurrent newtype M a = M { unM ::

Re: [Haskell-cafe] Monad woes

2009-08-23 Thread Levi Greenspan
Hi Jeremy, On Sun, Aug 23, 2009 at 5:08 PM, Jeremy Shawjer...@n-heptane.com wrote: What you probably want is: test2' :: IO () test2' = runM foo $ do    loop callback    liftIO $ print here This equals my test1 version which is fine without forkIO. return $ loop callback :: (Monad m) = IO

Re: [Haskell-cafe] Monad woes

2009-08-23 Thread Levi Greenspan
On Sun, Aug 23, 2009 at 5:21 PM, Jeremy Shawjer...@n-heptane.com wrote: Also, you could define a forkM function like this: forkM :: M () - M ThreadId forkM (M r) = M $ mapReaderT forkIO r which could be used like this: test = runM foo $ do         forkM $ loop callback         liftIO $

Re: FFI: Problem with Signal Handler Interruptions

2009-08-15 Thread Levi Greenspan
On Fri, Aug 14, 2009 at 11:45 PM, Simon Marlowmarlo...@gmail.com wrote: You should check for EINTR and restart the call as necessary.  This is standard best practice for POSIX programming anyway, and we do it for all the calls that can return EINTR in the IO library and RTS. [...] Blocking

Re: FFI: Problem with Signal Handler Interruptions

2009-08-08 Thread Levi Greenspan
Hi Bulat, On Fri, Aug 7, 2009 at 5:32 PM, Bulat Ziganshinbulat.zigans...@gmail.com wrote: Hello Levi, Friday, August 7, 2009, 6:48:42 PM, you wrote: 1.  How can one safely perform a blocking wait on a system call via FFI when compiling with -threaded i think you should use forkOS to

FFI: Problem with Signal Handler Interruptions

2009-08-07 Thread Levi Greenspan
Apologies for re-posting this subject here since I had sent already a message to haskell-café 3 days ago, but I just learned about this mailing list and it seems more appropriate to ask this question here I guess. I already got a reply from Simon Marlow but I posted some further (so far

[Haskell-cafe] Re: FFI: Problem with Signal Handler Interruptions

2009-08-07 Thread Levi Greenspan
On Thu, Aug 6, 2009 at 12:17 PM, Simon Marlowmarlo...@gmail.com wrote: The SIGVTALRM signal is delivered to one (random) thread in the program, so I imagine it just isn't being delivered to the thread that runs your second call to sleep.  (the main Haskell thread is a bound thread and hence

[Haskell-cafe] Re: FFI: Problem with Signal Handler Interruptions

2009-08-06 Thread Levi Greenspan
is a bound thread and hence gets an OS thread to itself). Is there some reason you can't use threadDelay?  threadDelay is much more friendly: it doesn't require another OS thread for each sleeping Haskell thread. Cheers,        Simon On 05/08/2009 17:01, Levi Greenspan wrote: Nobody

[Haskell-cafe] Re: FFI: Problem with Signal Handler Interruptions

2009-08-05 Thread Levi Greenspan
Nobody? On Tue, Aug 4, 2009 at 10:06 AM, Levi Greenspangreenspan.l...@googlemail.com wrote: Dear list members, In February this year there was a posting Why does sleep not work? (http://www.haskell.org/pipermail/haskell-cafe/2009-February/055400.html). The problem was apparently caused by

[Haskell-cafe] FFI: Problem with Signal Handler Interruptions

2009-08-04 Thread Levi Greenspan
Dear list members, In February this year there was a posting Why does sleep not work? (http://www.haskell.org/pipermail/haskell-cafe/2009-February/055400.html). The problem was apparently caused by signal handler interruptions. I noticed the same (not with sleep though) when doing some FFI work

Re: [Haskell-cafe] Slow Text.JSON parser

2009-01-18 Thread Levi Greenspan
On Sun, Jan 18, 2009 at 6:07 AM, Sigbjorn Finne sigbjorn.fi...@gmail.com wrote: Maybe. Handling the common cases reasonably well is probably worth doing first (+profiling) before opting for a heartlung transplant.. To wit, I've trivially improved the handling of string and integer lits in

Re: [Haskell-cafe] ANN: HTTPbis / HTTP-4000.x package available

2009-01-16 Thread Levi Greenspan
Sounds very good to me. However I would like to as one question regarding the HTTP lib. On hackage I read: HTTP: A library for client-side HTTP. Maybe you or someone on this list can tell me what the restrictions of the HTTP library are that restrict it to client side. What would be required to

Re: [Haskell-cafe] ANN: HTTPbis / HTTP-4000.x package available

2009-01-16 Thread Levi Greenspan
On Fri, Jan 16, 2009 at 8:11 PM, Sigbjorn Finne sigbjorn.fi...@gmail.com wrote: I'm guessing that you are reading something different into that than what's intended - it's client-side in the sense that it can only issue web requests and handle their responses. i.e., it doesn't handle incoming

[Haskell-cafe] How to simplify this code?

2009-01-15 Thread Levi Greenspan
Dear list members, I started looking into monadic programming in Haskell and I have some difficulties to come up with code that is concise, easy to read and easy on the eyes. In particular I would like to have a function add with following type signature: JSON a = MyData - String - a - MyData.

Re: [Haskell-cafe] How to simplify this code?

2009-01-15 Thread Levi Greenspan
On Fri, Jan 16, 2009 at 12:52 AM, Ryan Ingram ryani.s...@gmail.com wrote: Here's a series of refactorings that I feel gets to the essence of the code. Indeed it does. Final result: modifyJSON f m = m { json = f (json m) } add m k v = modifyJSON go m where go = showJSON . toJSObject .

[Haskell-cafe] Slow Text.JSON parser

2009-01-13 Thread Levi Greenspan
Dear list members, I tried Text.JSON from hackage and did an initial test to see how well it performs. I created a single JSON file of roughly 6 MB containing a single JSON array with 30906 JSON objects and used the following code to parse it: module Main where import System.IO import

[Haskell-cafe] Will GHC finally support epoll in 2009?

2008-12-31 Thread Levi Greenspan
Ticket #635 Replace use of select() in the I/O manager with epoll/kqueue/etc. (http://hackage.haskell.org/trac/ghc/ticket/635) dates back from 2005. Now its 2009 and GHC can handle hundreds of thousands of threads, yet having more than 1024 file descriptors open is still impossible. This

Re: [Haskell-cafe] Libevent FFI problems

2008-07-26 Thread Levi Greenspan
On Fri, 2008-07-25 at 13:45 -0700, Adam Langley wrote: I'd suggest that you write your server on the select() based system as-is for now. Then, when you need epoll you'll be sufficiently motivated to hack up the RTS to include it ;) The problem with a select() based approach is that I can not

Re: [Haskell-cafe] Libevent FFI problems

2008-07-25 Thread Levi Greenspan
PROTECTED] wrote: 2008/7/23 Levi Greenspan [EMAIL PROTECTED]: I would be grateful for any advices, hints or comments. And I really look forward to the FFI section in the Real World Haskell book. Generally it looks pretty good. I think I'm missing some C code (function wrapper). However, libevent

Re: [Haskell-cafe] Libevent FFI problems

2008-07-25 Thread Levi Greenspan
Thank you (and Christopher) for the link. I have one question though - I read this ticket in the GHC trac: http://hackage.haskell.org/trac/ghc/ticket/635 which plans to use epoll instead of select. The reason I thought of libevent is exactly the support for epoll and other better-than-select

[Haskell-cafe] Libevent FFI problems

2008-07-23 Thread Levi Greenspan
Dear list members, This is my first attempt to create a FFI to libevent (http://monkey.org/~provos/libevent/) which is an event notification library. A simple usage example is for instance given here: http://unx.ca/log/libevent_echosrv1c/ . In C one basically creates struct event instances which