Re: [Haskell-cafe] Mystery of an Eq instance

2013-09-21 Thread Bardur Arantsson
On 2013-09-21 06:16, Mike Meyer wrote: The single biggest gotcha is that two calculations we expect to be equal often aren't. As a result of this, we warn people not to do equality comparison on floats. The Eq instance for Float violates at least one expected law of Eq: Prelude let nan =

Re: [Haskell-cafe] Mystery of an Eq instance

2013-09-21 Thread Bardur Arantsson
On 2013-09-20 18:31, Brandon Allbery wrote: [--snip--] unless you have a very clever representation that can store in terms of some operation like sin(x) or ln(x).) I may just be hallucinating, but I think this is called describable numbers, i.e. numbers which can described by some (finite)

Re: [Haskell-cafe] Mystery of an Eq instance

2013-09-21 Thread Bardur Arantsson
On 2013-09-21 23:08, Mike Meyer wrote: Exactly. The Eq and Ord instances aren't what's broken, at least when you're dealing with numbers (NaNs are another story). That there are pairs According to Haskell NaN *is* a number. Eq and Ord are just the messengers. No. When we declare something an

Re: [Haskell-cafe] Lifting strictness to types

2013-08-22 Thread Bardur Arantsson
On 2013-08-22 18:19, Thiago Negri wrote: I think Scala has this optional laziness too. Indeed, but it's _not_ apparent in types (which can be an issue). Due to the somewhat weird constructor semantics of the JVM it also means you can have immutable values which start out(!) as null and end up

Re: [Haskell-cafe] Alternative name for return

2013-08-07 Thread Bardur Arantsson
On 2013-08-07 22:38, Joe Quinn wrote: On 8/7/2013 11:00 AM, David Thomas wrote: twice :: IO () - IO () twice x = x x I would call that evaluating x twice (incidentally creating two separate evaluations of one pure action description), but I'd like to better see your perspective here. x

Re: [Haskell-cafe] ANNOUNCE: hdbi-1.0.0 and hdbi-postgresql-1.0.0

2013-07-31 Thread Bardur Arantsson
On 2013-07-31 09:22, Alexey Uimanov wrote: Regard parameterized SQL: It might be worth using named parameters (e.g. :foo and :bar or something like that) rather than ? as placeholders in SQL/prepared SQL. This will make it slightly more flexible if you need to provide different SQL strings

Re: [Haskell-cafe] ANNOUNCE: hdbi-1.0.0 and hdbi-postgresql-1.0.0

2013-07-30 Thread Bardur Arantsson
On 2013-07-31 05:45, Alexey Uimanov wrote: Hello, haskellers. This is the first release of HDBI (Haskell Database Independent interface). It is the fork of HDBC. HDBI has some improvements in design, it also has better testing and performance (mainly because of using Text instead of String

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-23 Thread Bardur Arantsson
On 2013-07-22 17:09, i c wrote: Usage of shadowing is generally bad practice. It is error-prone. Hides obnoxious bugs like file descriptors leaks. These claims need to be substantiated, I think. (Not that I disagree, I just think that asserting this without evidence isn't going to convince

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-23 Thread Bardur Arantsson
On 2013-07-23 21:37, i c wrote: let's consider the following: let fd = Unix.open ... let fd = Unix.open ... At this point one file descriptor cannot be closed. Static analysis will have trouble catching these bugs, so do humans. Disallowing variable shadowing prevents this. The two fd

Re: [Haskell-cafe] tangential request...

2013-06-24 Thread Bardur Arantsson
On 06/24/2013 06:18 AM, Mark Lentczner wrote: Thanks all, I’ve got what I needed. Finally, 15% seem to be using horrid bitmap console fonts. _How can you stand to look at them?!?!_ (Don't worry, you'll have Plush soon enough...) ​ I realize this is probably a bit tongue-in-cheek, but for my

Re: [Haskell-cafe] I wish cabal-dev to travel back in time

2013-05-11 Thread Bardur Arantsson
On 05/11/2013 11:10 AM, Alberto G. Corona wrote: Hi Café: I created just now an issue in cabal-dev: https://github.com/creswick/cabal-dev/issues/101 When compiling old developments, I wish cabal-dev to install and build dependencies that were available at a that time I

Re: [Haskell-cafe] Backward compatibility

2013-05-03 Thread Bardur Arantsson
On 05/03/2013 06:44 PM, Niklas Hambüchen wrote: While I certainly enjoy the discussion, how about addressing one of the original problems: On 02/05/13 13:27, Adrian May wrote: I just tried to use Flippi. It broke because of the syntax change so I tried WASH. I couldn't even install it

Re: [Haskell-cafe] Backward compatibility

2013-05-03 Thread Bardur Arantsson
On 05/03/2013 06:49 PM, Edward Kmett wrote: Tantamount to a new language to fix a minor detail in a typeclass hierarchy? That is just histrionic. *No* language is that stable. Scala makes dozens of changes like that between *minor* versions, and while I hardly hold up their development

Re: [Haskell-cafe] How far compilers are allowed to go with optimizations?

2013-02-09 Thread Bardur Arantsson
On 02/09/2013 09:56 AM, Johan Holmquist wrote: [--snip--] It just so happened that the old code triggered some aggressive optimization unbeknownst to everyone, **including the original developer**, while the new code did not. (This optimization maybe even was triggered only on a certain

Re: [Haskell-cafe] How far compilers are allowed to go with optimizations?

2013-02-09 Thread Bardur Arantsson
On 02/09/2013 10:50 AM, Johan Holmquist wrote: I guess I fall more to the reason about code side of the scale rather than testing the code side. Testing seem to induce false hopes about finding all defects even to the point where the tester is blamed for not finding a bug rather than the

Re: [Haskell-cafe] Ticking time bomb

2013-01-31 Thread Bardur Arantsson
On 01/30/2013 08:27 PM, Edward Z. Yang wrote: https://status.heroku.com/incidents/489 Unsigned Hackage packages are a ticking time bomb. Somewhere else that shall not be mentioned, someone posted this link which points to an interesting solution to this problem:

Re: [Haskell-cafe] Can cabal be turned into a package manager?

2012-12-12 Thread Bardur Arantsson
On 12/12/2012 06:01 PM, Janek S. wrote: In the recent months there was a lot of dicussion about cabal, dependency hell and alike. After reading some of these discussions there is a question I just have to ask: Why not create a package manager (like rpm or apt) for Haskell software? I've

Re: [Haskell-cafe] Fwd: education or experience?

2012-12-09 Thread Bardur Arantsson
On 12/10/2012 01:20 AM, Eli Frey wrote: Jerzy makes a good point that you might not be the best judge of what you should learn. Not only that: you have *no reliable way of knowing* what you might be missing. Any half-decent CS education gives you a very broad grounding in the field so that

Re: [Haskell-cafe] How can I avoid buffered reads?

2012-11-28 Thread Bardur Arantsson
On 11/28/2012 08:38 PM, Leon Smith wrote: I have some code that reads (infrequently) small amounts of data from /dev/urandom, and because this is pretty infrequent, I simply open the handle and close it every time I need some random bytes. The problem is that I recently discovered that,

Re: [Haskell-cafe] One of the new buzz phrases is Event-Sourcing; is Haskell suitable for this?

2012-09-30 Thread Bardur Arantsson
On 09/30/2012 02:46 AM, KC wrote: http://martinfowler.com/eaaDev/EventSourcing.html http://martinfowler.com/articles/lmax.html Sure, why not? See http://hackage.haskell.org/package/cqrs-0.8.0 and http://hackage.haskell.org/package/cqrs-example-0.8.0 for an example application. I

Re: [Haskell-cafe] What is the surefire way to handle all exceptions and make sure the program doesn't fail?

2012-07-17 Thread Bardur Arantsson
On 07/17/2012 08:34 AM, Yifan Yu wrote: First of all, apologise if the question is too broad. The background goes like this: I've implemented a server program in Haskell for my company intended to replace the previous one written in C which crashes a lot (and btw the technology of the company

Re: [Haskell-cafe] What is the surefire way to handle all exceptions and make sure the program doesn't fail?

2012-07-17 Thread Bardur Arantsson
On 07/17/2012 10:17 PM, Christopher Done wrote: On 17 July 2012 22:10, Bardur Arantsson s...@scientician.net wrote: On 07/17/2012 08:34 AM, Yifan Yu wrote: I can only tell if I browse the source code. So the question is, how can I determine all the exceptions that can be thrown by a given

Re: [Haskell-cafe] haskell.org is so fragile

2012-07-12 Thread Bardur Arantsson
On 07/12/2012 11:04 PM, Ganesh Sittampalam wrote: Hi, On 12/07/2012 13:06, Takayuki Muranushi wrote: Today I have observed that hackage.haskell.org/ timeout twice (in the noon and in the evening.) What is the problem? Is it that haskell users have increased so that haskell.org is

Re: [Haskell-cafe] ghci and TH cannot: unknown symbol `stat64`

2012-07-11 Thread Bardur Arantsson
On 07/11/2012 05:12 PM, Michael Snoyman wrote: Thanks for the feedback. However, looking at sqlite3.c, I see the necessary #include statements: #include sys/types.h #include sys/stat.h #include unistd.h I'm confident that none of my code is making calls to stat/stat64 via the FFI. In

Re: [Haskell-cafe] Most C++ compilers will not optimize x^2.0 as x*x but instead will do an expensive ...

2012-05-23 Thread Bardur Arantsson
On 05/24/2012 04:13 AM, Brandon Allbery wrote: On Wed, May 23, 2012 at 9:47 PM, KC kc1...@gmail.com wrote: exponentiation and logarithm. So, I believe this C++ versus Haskell versus (your language of choice) is a Penn Teller misdirection. Whereas, another level of indirection solves

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-16 Thread Bardur Arantsson
On 05/16/2012 09:02 PM, Gregg Lebovitz wrote: Isaac, I was looking at the debian coding contest benchmarks referenced by others in this discussion. All of the benchmarks algorithms, appear to be short computationally intensive programs with a fairly low level of abstraction. In almost

Re: [Haskell-cafe] Learn you

2012-05-02 Thread Bardur Arantsson
On 05/02/2012 07:37 PM, Brandon Allbery wrote: On 2 May 2012 18:18, Brent Yorgeybyor...@seas.upenn.edu wrote: I am curious how the title was translated. Of course, the English title Learn You a Haskell for Great Good uses intentionally ungrammatical/unidiomatic English for humorous effect.

Re: [Haskell-cafe] Summer of Code idea: Haskell Web Toolkit

2012-03-06 Thread Bardur Arantsson
On 03/06/2012 11:38 PM, Christopher Done wrote: I might as well chime in on this thread as it is relevant to my interests. I made a write up on a comparison of HJScript (JavaScript EDSL) and my Ji (control browser from Haskell) library: https://github.com/chrisdone/ji HJScript is OK, hpaste.org

Re: [Haskell-cafe] Reasons for Super-Linear Speedup

2012-03-05 Thread Bardur Arantsson
On 03/05/2012 04:58 PM, burak ekici wrote: Dear List; I have parallelized RSA decryption and encryption schemes by using second generation strategies of Haskell p.l. In that case, what I got in the sense of speed up was nearly 10 times of better performances (on a quad-core CPU with 8M cache)

Re: [Haskell-cafe] [haskell-cafe] Some reflections on Haskell

2012-02-14 Thread Bardur Arantsson
On 02/14/2012 04:13 PM, Doug McIlroy wrote: Nevertheless, I share Jardine's concern about the central problem. It is hard to find one's way in this ecosystem. It needn't be, as Java illustrates. As a professional Java developer this sounds really strange, but maybe I just haven't found it

Re: [Haskell-cafe] Subject: A universal data store interface

2012-02-13 Thread Bardur Arantsson
On 02/13/2012 09:36 PM, Michael Snoyman wrote: You make it sound like your options are use the crippled abstraction layer or use the full-powered database layer. You're leaving out two very important points: 1. There's a reason the abstraction layer exists: it can be clumsy to go directly to

Re: [Haskell-cafe] Need advice: Haskell in Web Client

2012-01-26 Thread Bardur Arantsson
On 01/26/2012 11:16 AM, dokondr wrote: On Thu, Jan 19, 2012 at 1:37 AM, Dag Odenhalldag.odenh...@gmail.comwrote: On Tue, 2012-01-17 at 22:05 +0300, dokondr wrote: I prefer using Turing complete PL to program web client, like the one used in GWT (Java) or Cappuccino (Objective-J).

Re: [Haskell-cafe] How to make asynchronous I/O composable and safe?

2012-01-14 Thread Bardur Arantsson
On 01/14/2012 11:42 AM, Joey Adams wrote: On Sat, Jan 14, 2012 at 1:29 AM, Bardur Arantssons...@scientician.net wrote: So, the API becomes something like: runSocketServer :: ((Chan a, Chan b) - IO ()) - ... - IO () where the first parameter contains the client logic and A is the type

Re: [Haskell-cafe] How to make asynchronous I/O composable and safe?

2012-01-13 Thread Bardur Arantsson
On 01/14/2012 06:24 AM, Joey Adams wrote: I'm not happy with asynchronous I/O in Haskell. It's hard to reason about, and doesn't compose well. At least in my code. [--snip--] Async I/O *is* tricky if you're expecting threads to do their own writes/reads directly to/from sockets. I find

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-03 Thread Bardur Arantsson
2012/1/3 Yucheng Zhangyczhan...@gmail.com (Hopefully being a little more explicit about this can help you understand where things are going wrong.) [--snip--] legSome :: LegGram nt t s - nt - Either String ([t], s) The 'nt' you see above legSome (LegGram g) ntV = case Main.lookup

[Haskell-cafe] Is the haddock generator on Hackage down?

2012-01-03 Thread Bardur Arantsson
Hi all, No Haddock documentation seems to have been generated on Hackage in the past few days. See e.g. http://hackage.haskell.org/package/copilot-2.0.3 or http://hackage.haskell.org/package/derive-2.5.5 Does anyone know if the cron job (or whatever) isn't running for some reason?

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Bardur Arantsson
On 12/29/2011 07:07 PM, Steve Horne wrote: On 29/12/2011 10:05, Jerzy Karczmarczuk wrote: Sorry, a long and pseudo-philosophical treatise. Trash it before reading. Heinrich Apfelmus: You could say that side effects have been moved from functions to some other type (namely IO) in Haskell. I

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Bardur Arantsson
On 12/29/2011 11:06 PM, Steve Horne wrote: On 29/12/2011 21:01, Chris Smith wrote: On Thu, 2011-12-29 at 18:07 +, Steve Horne wrote: By definition, an intentional effect is a side-effect. To me, it's by deceptive redefinition - and a lot of arguments rely on mixing definitions - but

Re: [Haskell-cafe] On the purity of Haskell /Random generators

2011-12-30 Thread Bardur Arantsson
On 12/29/2011 09:39 PM, Jerzy Karczmarczuk wrote: Truly random numbers are very rarely used, forget about them. Well, obviously, but why should we forget about them? The usual approach(*) is to gather entropy from a truly(**) random source and use that to seed (and perhaps periodically

Re: [Haskell-cafe] (...) Random generators

2011-12-30 Thread Bardur Arantsson
On 12/30/2011 04:38 PM, Jerzy Karczmarczuk wrote: Bardur Arantsson: Random streams are not referentially transparent, though, AFAICT...? Either way this thread has gone on long enough, let's not prolong it needlessly with this side discussion. Sure. But the discussion on randomness

Re: [Haskell-cafe] On the purity of Haskell

2011-12-30 Thread Bardur Arantsson
On 12/30/2011 10:10 PM, Steve Horne wrote: On 30/12/2011 10:47, Bardur Arantsson wrote: On 12/29/2011 11:06 PM, Steve Horne wrote: Calling it a straw man won't convince anyone who has the scars from being attacked by those straw men. I've been in those arguments, being told that C has side

Re: [Haskell-cafe] On the purity of Haskell

2011-12-29 Thread Bardur Arantsson
On 12/29/2011 08:47 PM, Steve Horne wrote: On 29/12/2011 19:21, Heinrich Apfelmus wrote: BTW - why use an IO action for random number generation? There's a perfectly good pure generator. It's probably handy to treat it monadically to sequence the generator state/seed/whatever but random

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-22 Thread Bardur Arantsson
Alexander Solla wrote: I happen to only write Haskell programs that terminate. It is not that hard. We must merely restrict ourselves to the total fragment of the language, and there are straight-forward methods to do so. Do (web/XML-RPC/whatever) server type programs terminate?

Re: [Haskell-cafe] What happens if you get hit by a bus?

2011-12-16 Thread Bardur Arantsson
Michael Litchard wrote: [--snip--] If getting hit by a bus is a significant factor in the overall outcome of the project then I think those are pretty good odds, aren't they? (I do realize that traffic accidents are a lot more frequent than we like to think, but still...) -- Bárður

Re: [Haskell-cafe] What happens if you get hit by a bus?

2011-12-16 Thread Bardur Arantsson
Andrew Coppin wrote: On 16/12/2011 07:05 PM, Bardur Arantsson wrote: Michael Litchard wrote: [--snip--] If getting hit by a bus is a significant factor in the overall outcome of the project then I think those are pretty good odds, aren't they? (I do realize that traffic accidents

Re: [Haskell-cafe] ANNOUNCE: hxournal-0.5.0.0 - A pen notetaking program written in haskell

2011-12-12 Thread Bardur Arantsson
On 12/13/2011 02:43 AM, Brandon Allbery wrote: On Mon, Dec 12, 2011 at 19:22, Ian-Woo Kimianwoo...@gmail.com wrote: A workaround is to make a symbolic link to libstdc++.so.6 with the name of libstdc++.so in /usr/lib or /usr/local/lib or other dynamic library path like the following. ln -s

Re: [Haskell-cafe] A small Darcs anomoly

2011-04-28 Thread Bardur Arantsson
On 04/28/2011 12:19 AM, Ganesh Sittampalam wrote: On 26/04/2011 12:17, Malcolm Wallace wrote: On 25 Apr 2011, at 11:13, Andrew Coppin wrote: On 24/04/2011 06:33 PM, Jason Dagit wrote: This is because of a deliberate choice that was made by David Roundy. In darcs, you never have multiple

[Haskell-cafe] Re: Monads and Functions sequence and sequence_

2010-10-29 Thread Bardur Arantsson
On 2010-10-30 07:07, Mark Spezzano wrote: Hi, Can somebody please explain exactly how the monad functions sequence and sequence_ are meant to work? I have almost every Haskell textbook, but there's surprisingly little information in them about the two functions. From what I can gather,

[Haskell-cafe] Re: Sockets get bound to wrong port on Windows

2010-06-02 Thread Bardur Arantsson
On 2010-06-03 05:10, Matthias Reisner wrote: Hi, there's something wrong with port numbers in the Network.Socket module of package network. Printing values gives: *Main PortNum 47138 *Main PortNum 47138 Try (fromIntegral ) :: PortNumber (Yes, it's weird.) Cheers, Bardur

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-03-25 Thread Bardur Arantsson
On 2010-02-24 20:50, Brandon S. Allbery KF8NH wrote: tcpdump 'host ps3 and tcp[tcpflags] 0x27 != 0' (Indulging in some serious thread necromancy here, but...) Alright, I've _finally_ got round to doing a dump with leaking file descriptors (or threads as the case may be). The bits of lsof

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-24 Thread Bardur Arantsson
On 2010-02-24 05:10, Brandon S. Allbery KF8NH wrote: On Feb 21, 2010, at 20:17 , Jeremy Shaw wrote: The PS3 does do something though. If we were doing a write *and* read select on the socket, the read select would wakeup. So, it is trying to notify us that something has happened, but we are not

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-21 Thread Bardur Arantsson
Jeremy Shaw wrote: Hello, I think to make progress on this bug we really need a failing test case that other people can reproduce. I have hacked up small server that should reproduce the error (using fdWrite instead of sendfile). And a small C client which is intended to reproduce the error --

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-21 Thread Bardur Arantsson
Taru Karttunen wrote: Excerpts from Bardur Arantsson's message of Wed Feb 17 21:27:07 +0200 2010: For sendfile, a timeout of 1 second would probably be fine. The *ONLY* purpose of threadWaitWrite in the sendfile code is to avoid busy-waiting on EAGAIN from the native sendfile. Of course this

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-17 Thread Bardur Arantsson
Jeremy Shaw wrote: On Wed, Feb 17, 2010 at 2:36 AM, Taru Karttunen tar...@taruti.net wrote: So for sendfile, instead of threadWaitWrite we could do: r - timeout (60 * 10^6) threadWaitWrite case r of Nothing - ... -- timed out (Just ()) - ... -- keep going For sendfile, a timeout of

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-16 Thread Bardur Arantsson
Jeremy Shaw wrote: On Sun, Feb 14, 2010 at 2:04 PM, Bardur Arantsson s...@scientician.netwrote: Not sure what the best solution for this would be, API-wise... Maybe actually have sendfile read the data and supply it to a user-defined function which could react to the data in some way? (Could

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-16 Thread Bardur Arantsson
Bardur Arantsson wrote: Jeremy Shaw wrote: [--snip--] Re: a test case, you'll probably need to run the test case code on a client whose OS allows (from userspace) the sudden dropping of connections without sending a proper connection shutdown sequence. I'm not sure that that OS would

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-16 Thread Bardur Arantsson
Taru Karttunen wrote: Excerpts from Bardur Arantsson's message of Tue Feb 16 22:57:23 +0200 2010: As far as I can tell, all nonblocking networking code is vulnerable to this issue (unless it actually does use threadWaitRead, obviously :)). There are a few easy fixes: 1) socket timeouts with

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-14 Thread Bardur Arantsson
Jeremy Shaw wrote: import Control.Concurrent import Control.Concurrent.MVar import System.Posix.Types data RW = Read | Write threadWaitReadWrite :: Fd - IO RW threadWaitReadWrite fd = do m - newEmptyMVar rid - forkIO $ threadWaitRead fd putMVar m Read wid - forkIO $

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-12 Thread Bardur Arantsson
Jeremy Shaw wrote: import Control.Concurrent import Control.Concurrent.MVar import System.Posix.Types data RW = Read | Write threadWaitReadWrite :: Fd - IO RW threadWaitReadWrite fd = do m - newEmptyMVar rid - forkIO $ threadWaitRead fd putMVar m Read wid - forkIO $

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-11 Thread Bardur Arantsson
Jeremy Shaw wrote: On Wed, Feb 10, 2010 at 1:15 PM, Bardur Arantsson s...@scientician.netwrote: I've also been contemplating some solutions, but I cannot see any solutions to this problem which could reasonably be implemented outside of GHC itself. GHC lacks a threadWaitError, so there's

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-11 Thread Bardur Arantsson
Thomas DuBuisson wrote: Bardur Arantsson s...@scientician.net wrote: ... then do errno - getErrno if errno == eAGAIN then do threadDelay 100 sendfile out_fd in_fd poff bytes else throwErrno

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-11 Thread Bardur Arantsson
Jeremy Shaw wrote: On Feb 11, 2010, at 1:57 PM, Bardur Arantsson wrote: [--snip lots of technical info--] Thanks for digging so much into this. Just a couple of comments: The whole point of the sendfile library is to use sendfile(), so not using sendfile() seems like the wrong solution

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-10 Thread Bardur Arantsson
Jeremy Shaw wrote: On Feb 9, 2010, at 6:47 PM, Thomas Hartman wrote: Matt, have you seen this thread? Jeremy, are you saying this a bug in the sendfile library on hackage, or something underlying? I'm saying that the behavior of the sendfile library is buggy. But it could be due to

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-07 Thread Bardur Arantsson
Bardur Arantsson wrote: Bardur Arantsson wrote: (sorry about replying-to-self) During yet another bout of debugging, I've added even more I am here instrumentation code to the SendFile code, and the culprit seems to be threadWaitWrite. As Jeremy Shaw pointed out off-list, the symptoms

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-07 Thread Bardur Arantsson
Jeremy Shaw wrote: It's not clear to me that this is actually a bug in threadWaitWrite. I believe that under Linux, select() does not wakeup just because the file descriptor was closed. select() has the option of specifying an exceptfds FD_SET where I'd certainly _expect_ select() to flag an

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-06 Thread Bardur Arantsson
Brandon S. Allbery KF8NH wrote: On Feb 5, 2010, at 02:56 , Bardur Arantsson wrote: [--snip--] Broken pipe is normally handled as a signal, and is only mapped to an error if SIGPIPE is set to SIG_IGN. I can well imagine that the SIGPIPE signal handler isn't closing resources properly

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-06 Thread Bardur Arantsson
Felipe Lessa wrote: On Sat, Feb 06, 2010 at 09:16:35AM +0100, Bardur Arantsson wrote: Brandon S. Allbery KF8NH wrote: On Feb 5, 2010, at 02:56 , Bardur Arantsson wrote: [--snip--] Broken pipe is normally handled as a signal, and is only mapped to an error if SIGPIPE is set to SIG_IGN. I can

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-06 Thread Bardur Arantsson
Bardur Arantsson wrote: (sorry about replying-to-self) During yet another bout of debugging, I've added even more I am here instrumentation code to the SendFile code, and the culprit seems to be threadWaitWrite. I think I've pretty much confirmed this. I've changed the code again

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-05 Thread Bardur Arantsson
Jeremy Shaw wrote: Actually, We should start by testing if native sendfile leaks file descriptors even when the whole file is sent. We have a test suite, but I am not sure if it tests for file handle leaking... I should have posted this earlier, but the exact message I'm seeing in the case

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-05 Thread Bardur Arantsson
Thomas Hartman wrote: Do you have a test script to reproduce the behavior? Unfortunately not, but the behavior *is* 100% reproducible with my PS3 client. The production of a leaked FD appears to require a particularly abrupt disconnect (see my other reply in this thread), so you're probably

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-05 Thread Bardur Arantsson
I desperation, I've tried to instrument a couple of the functions in SendFile: sendFile'' :: Socket - Handle - Integer - Integer - IO () sendFile'' outs inp off count = do let out_fd = Fd (fdSocket outs) in_fd - handleToFd inp putStrLn (in_fd= ++ show in_fd)

[Haskell-cafe] sendfile leaking descriptors on Linux?

2010-02-04 Thread Bardur Arantsson
Hi all, I've been using the sendfile package off Hackage, but it seems to be leaking file descriptors when using the Linux-native build. What's happening in my specific case is the following: 1) client requests a range of a file 2) server starts sending the range 3) client

[Haskell-cafe] Re: PROPOSAL: Web application interface

2010-01-24 Thread Bardur Arantsson
Michael Snoyman wrote: [--snip--] Next, I have made the ResponseBodyClass typeclass specifically with the goal of allowing optimizations for lazy bytestrings and sending files. The former seems far-fetched; the latter provides the ability to use a sendfile system call instead of copying the

[Haskell-cafe] Is it just me... or is cabal/hackage a little broken?

2009-12-22 Thread Bardur Arantsson
Hi all, Sorry about the inflammatory title, but I just got this message from an uploaded package (hums): Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. The thing is, I got the same message while trying

[Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Bardur Arantsson
byte order (hton). Oleg's Iteratee does look very interesting though. Maybe I'll have a go at trying to use his ideas in my UPnP server. Cheers, Bardur Arantsson ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

[Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Bardur Arantsson
John Goerzen wrote: On Thu, Jan 08, 2009 at 10:37:55PM +0100, Bardur Arantsson wrote: Don't get me wrong -- the socket support is pretty decent, but there are also some weird idiosyncrasies, for example requiring that the PortNum is specified in network byte order and lacking a function

[Haskell-cafe] Re: Hypothetical Haskell job in New York

2009-01-08 Thread Bardur Arantsson
a useful function. It can be used properly, or not, just as while or read() in C can be. It's a great way to introduce unavoidable handle leaks, that's for sure. Cheers, Bardur Arantsson ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http