Re: [Haskell-cafe] Prompt Monad

2008-08-13 Thread Martin Hofmann
Thanks a lot. That is exactly what I have been looking for. Cheers, Martin On Tue, 2008-08-12 at 10:28 -0700, Ryan Ingram wrote: Latest code is on hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MonadPrompt There is a sample file with lots of other monads implemented

Re: [Haskell-cafe] two problems with Data.Binary and Data.ByteString

2008-08-13 Thread Ketil Malde
Don Stewart [EMAIL PROTECTED] writes: You really, really want to be using rnf for this job, instead of turning your brain into a pretzel shape. The Pretzel being one of the lesser-known lazy, cyclic, functional data structures. So pretzel-brain is actually a honorific, rather than

Re: [Haskell-cafe] two problems with Data.Binary and Data.ByteString

2008-08-13 Thread Don Stewart
ketil: Don Stewart [EMAIL PROTECTED] writes: You really, really want to be using rnf for this job, instead of turning your brain into a pretzel shape. The Pretzel being one of the lesser-known lazy, cyclic, functional data structures. So pretzel-brain is actually a honorific,

Re: [Haskell-cafe] Dealing with heterogeneously-typed lists?

2008-08-13 Thread Thomas Davie
On 13 Aug 2008, at 00:44, Leif Warner wrote: Hi all, I'm dealing with some datatype, say: data Invoice = Invoice { invoiceNum:: String, dollarAmt :: Currency, printDate :: Date, dueDate :: Date,

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread Thomas Davie
On 13 Aug 2008, at 05:06, [EMAIL PROTECTED] wrote: G'day all. Quoting Thomas Davie [EMAIL PROTECTED]: Why is separate compilation important? I'm a little shocked that anyone on this list should have to ask this question. Two people have asked it now. The simplest answer is that unless

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread Henning Thielemann
On Wed, 13 Aug 2008, Thomas Davie wrote: On 13 Aug 2008, at 05:06, [EMAIL PROTECTED] wrote: Quoting Thomas Davie [EMAIL PROTECTED]: Why is separate compilation important? I'm a little shocked that anyone on this list should have to ask this question. Two people have asked it now.

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread Thomas Davie
On 13 Aug 2008, at 11:10, Henning Thielemann wrote: On Wed, 13 Aug 2008, Thomas Davie wrote: On 13 Aug 2008, at 05:06, [EMAIL PROTECTED] wrote: Quoting Thomas Davie [EMAIL PROTECTED]: Why is separate compilation important? I'm a little shocked that anyone on this list should have to ask

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread C.M.Brown
Andrew, [...] For the record, I have no problem with modules depending on each other, so long as they only depend on their well-defined interfaces. Finally, as chris suggests, if separate compilation is important to you, why not have a flag in ghc -frequire-hi-boot or something? Well,

[Haskell-cafe] Re: ``Orphan instances'' should be avoided anyway.

2008-08-13 Thread Yitzchak Gale
Moving from libraries to haskell-cafe... I wrote: ...there must be some way to control the import and export of instances, just as we can now control the import and export of every other kind of symbol binding. Henning Thielemann wrote: For me it's most often the case that an instance is

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread ajb
G'day all. Quoting C.M.Brown [EMAIL PROTECTED]: But isn't this exactly the point I was trying to make!? The whole point, to me, in functional programming, is that we shouldn't have to worry about the underlying implementation. It is not exposing an underlying implementation detail to mandate

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread C.M.Brown
Andrew, But isn't this exactly the point I was trying to make!? The whole point, to me, in functional programming, is that we shouldn't have to worry about the underlying implementation. It is not exposing an underlying implementation detail to mandate that modules should have

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread ajb
G'day all. Quoting Thomas Davie [EMAIL PROTECTED]: To be honest, ghc compiles things so fast (at least on any of my systems) that I couldn't care less if it took 10 times as long (I would however like some added convenience for that time spent) Have you ever compiled GHC itself? Just

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread Thomas Davie
On 13 Aug 2008, at 13:18, [EMAIL PROTECTED] wrote: G'day all. Quoting Thomas Davie [EMAIL PROTECTED]: To be honest, ghc compiles things so fast (at least on any of my systems) that I couldn't care less if it took 10 times as long (I would however like some added convenience for that time

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread ajb
G'day. Quoting C.M.Brown [EMAIL PROTECTED]: However I saw no real argument for not having cyclic inclusions. You say we shouldn't have to spend time writing hi-boot files, and yet you also think that GHC should not do it automatically. So we have to restrict all programmers to never

Re: [Haskell-cafe] two problems with Data.Binary and Data.ByteString

2008-08-13 Thread Duncan Coutts
On Tue, 2008-08-12 at 14:13 -1000, Tim Newsham wrote: I also noticed another issue while testing. If my program loads the data at startup by calling loadState then all later calls to saveState give an error: Log: savedState.bin: openFile: resource busy (file is locked) You're not using

[Haskell-cafe] The Italian Haskellers Summer Meeting is Over: What Next?

2008-08-13 Thread Titto Assini
E cosi' il primo incontro balnear/ricreativo degli Haskeller Italiani si e' felicemente concluso. Come da programma, rigidamente rispettato, abbiamo fatto il bagno e mangiato pizza e gelato ma soprattutto ci siamo conosciuti ed abbiamo discusso di tutto e di piu', prevalentemente Haskell (folds,

[Haskell-cafe] Re: ``Orphan instances'' should be avoided anyway.

2008-08-13 Thread Henning Thielemann
On Wed, 13 Aug 2008, Yitzchak Gale wrote: Why is it that when I say import Control.Monad.Error (throwError, runErrorT) there is no way to prevent also getting a surprising Monad Either instance? Never mind how things should have been named in Control.Monad.Error - that's the way it is right

[Haskell-cafe] Haskell Weekly News: Issue 81 - August 13, 2008

2008-08-13 Thread Brent Yorgey
--- Haskell Weekly News http://sequence.complete.org/hwn/20080813 Issue 81 - August 13, 2008 --- Welcome to issue 81 of HWN, a newsletter covering

[Haskell-cafe] whatever happened to sendFile?

2008-08-13 Thread Jason Dusek
I found an old lib for it: http://www.haskell.org/ghc/docs/6.0/html/unix/System.Sendfile.html Hoogle turns up nothing, though. -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread Iavor Diatchki
Hello, The Haskell'98 report does not specify if/how recursive modules should work. I wrote a paper a long time ago that formalizes and implements this feature (http://www.purely-functional.net/yav/publications/modules98.pdf). I very much doubt that separate compilation is much of a problem in

Re: [Haskell-cafe] whatever happened to sendFile?

2008-08-13 Thread Chaddaï Fouché
2008/8/13 Jason Dusek [EMAIL PROTECTED]: I found an old lib for it: http://www.haskell.org/ghc/docs/6.0/html/unix/System.Sendfile.html Hoogle turns up nothing, though. That don't sound very useful... Maybe when we only had String it was much more performant for big transfert, but now

Re: [Haskell-cafe] whatever happened to sendFile?

2008-08-13 Thread Brandon S. Allbery KF8NH
On 2008 Aug 13, at 15:01, Chaddaï Fouché wrote: 2008/8/13 Jason Dusek [EMAIL PROTECTED]: I found an old lib for it: http://www.haskell.org/ghc/docs/6.0/html/unix/System.Sendfile.html Hoogle turns up nothing, though. That don't sound very useful... Maybe when we only had String it was

Re: [Haskell-cafe] whatever happened to sendFile?

2008-08-13 Thread Jason Dusek
Chaddaï Fouché [EMAIL PROTECTED] wrote: Maybe when we only had String it was much more performant for big transfert, but now we can recode this in one short line of ByteString code and get the same performance as C. Oh? Using lazy ByteString? -- _jsn

Re: [Haskell-cafe] whatever happened to sendFile?

2008-08-13 Thread Brandon S. Allbery KF8NH
On 2008 Aug 13, at 15:04, Brandon S. Allbery KF8NH wrote: On 2008 Aug 13, at 15:01, Chaddaï Fouché wrote: 2008/8/13 Jason Dusek [EMAIL PROTECTED]: I found an old lib for it: http://www.haskell.org/ghc/docs/6.0/html/unix/System.Sendfile.html Hoogle turns up nothing, though. That don't

Re: [Haskell-cafe] whatever happened to sendFile?

2008-08-13 Thread Chaddaï Fouché
2008/8/13 Brandon S. Allbery KF8NH [EMAIL PROTECTED]: I should clarify: what sendfile() is supposed to optimize isn't writing large strings, or even the user-kernel roundtrips; it's an optimization to the kernel network stack (network buffer management, to be specific). Web servers use it

Re: [Haskell-cafe] whatever happened to sendFile?

2008-08-13 Thread Jason Dusek
Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: I should clarify: what sendfile() is supposed to optimize isn't writing large strings, or even the user-kernel roundtrips; it's an optimization to the kernel network stack (network buffer management, to be specific). Web servers use it to

Re: [Haskell-cafe] two problems with Data.Binary and Data.ByteString

2008-08-13 Thread Tim Newsham
Ah, that would be a bug in older ByteString implementations, that were a bit incautious about closing handles. This example works for me with bytestring-0.9.1.0 Yup, thank you Don and Duncan for pointing this out. I updated my bytestring library and the test case no longer fails. However,

[Haskell-cafe] help

2008-08-13 Thread shoulders
- 雅虎邮箱,您的终生邮箱!___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Phantoms

2008-08-13 Thread Andrew Coppin
Bulat Ziganshin wrote: Hello Andrew, Wednesday, August 6, 2008, 10:09:43 PM, you wrote: Here's the thing though... How do I get it so that Foo Int and Foo Double produce slightly different strings when printed? instnace Show (Foo Int) ... instnace Show (Foo Double) ... ...WHY

[Haskell-cafe] What's in a name?

2008-08-13 Thread Andrew Coppin
The naming of cats is a difficult matter... Ahem. So as you may have noticed, we seem to have a profusion of packages all called binary or something dangeriously similar. There's also several MD5 packages. I could point out a few others. So what I'm wondering is... Do we have a formal

Re: [Haskell-cafe] Prompt Monad

2008-08-13 Thread Ryan Ingram
No problem. Let me know what you end up doing with it, or if you have any questions! -- ryan On Tue, Aug 12, 2008 at 11:32 PM, Martin Hofmann [EMAIL PROTECTED] wrote: Thanks a lot. That is exactly what I have been looking for. Cheers, Martin On Tue, 2008-08-12 at 10:28 -0700, Ryan

Re: [Haskell-cafe] two problems with Data.Binary and Data.ByteString

2008-08-13 Thread Tim Newsham
Should the file be closed when the last byte is read (in this case its definitely reading all four bytes) or when the first byte after that is read (in this case it probably doesn't attempt to read more than 4 bytes)? I'll answer my own question. Both Prelude.readFile and

Re: [Haskell-cafe] two problems with Data.Binary and Data.ByteString

2008-08-13 Thread Don Stewart
newsham: Should the file be closed when the last byte is read (in this case its definitely reading all four bytes) or when the first byte after that is read (in this case it probably doesn't attempt to read more than 4 bytes)? I'll answer my own question. Both Prelude.readFile and

Re: [Haskell-cafe] What's in a name?

2008-08-13 Thread Thomas M. DuBuisson
Do we have a formal convention for the naming of packages and/or the naming of the modules they contain? There is a recommended set of categories and in general I believe library authors try and follow the previously established names. How are name collisions supposed to be avoided? In

Re: [Haskell-cafe] whatever happened to sendFile?

2008-08-13 Thread Jason Dusek
Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: Right. I intended that to be a heads-up in both directions: it is not simply a library convenience function, so one needs to think about when to use it. In particular, it's possible that overuse of sendfile() in the wrong circumstances will

Re: [Haskell-cafe] whatever happened to sendFile?

2008-08-13 Thread Brandon S. Allbery KF8NH
On 2008 Aug 13, at 18:25, Jason Dusek wrote: Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: Right. I intended that to be a heads-up in both directions: it is not simply a library convenience function, so one needs to think about when to use it. In particular, it's possible that overuse of

[Haskell-cafe] Re: whatever happened to sendFile?

2008-08-13 Thread Jason Dusek
It looks like there could be a Haskell sendfile for Windows as as well *NIX. However, the *NIX implementations are: :: File Descriptor - File Descriptor - IO () while the Windows version is: :: File Descriptor - Socket - IO () A cross platfrom implementation would cover the case we

Re: [Haskell-cafe] Re: whatever happened to sendFile?

2008-08-13 Thread John Meacham
On Wed, Aug 13, 2008 at 03:40:43PM -0700, Jason Dusek wrote: A cross platfrom implementation would cover the case we most care about -- writing services that pass static files back to clients -- but would have to cut some functionality from the *NIX sendfile(). There isn't a standard

Re: [Haskell-cafe] Re: whatever happened to sendFile?

2008-08-13 Thread Jason Dusek
John Meacham [EMAIL PROTECTED] wrote: There isn't a standard unix sendfile, while a few different ones have functions called 'sendfile', they have different meanings/prototypes in general. If 'sendfile(2)' is going to be exposed, it should be in a low level platform specific library, however,

[Haskell-cafe] Bug with QuickCheck 1.1 and GHC 6.8.2

2008-08-13 Thread Patrick Perry
I'm running into problems with generating an arbitrary function of type Double - Double. Specifically, the following code: {-# LANGUAGE PatternSignatures #-} import Test.QuickCheck import Text.Show.Functions prop_ok (f :: Double - Double) = f (-5.5) `seq` True prop_bug (f :: Double -

Re: [Haskell-cafe] two problems with Data.Binary and Data.ByteString

2008-08-13 Thread Antoine Latter
On Wed, Aug 13, 2008 at 5:02 PM, Tim Newsham [EMAIL PROTECTED] wrote: However, I think probably the real blame here should probably go to Data.Binary which doesn't attempt to check that it has consumed all of its input after doing a decode. If decode completes and there is unconsumed data,

Re: [Haskell-cafe] Bug with QuickCheck 1.1 and GHC 6.8.2

2008-08-13 Thread Patrick Perry
The bug is in the variant function in QuickCheck. I replaced variant :: Int - Gen a - Gen a variant v (Gen m) = Gen (\n r - m n (rands r !! (v+1)) where rands r0 = r1 : rands r2 where (r1, r2) = split r0 with variant :: Int - Gen a - Gen a variant v (Gen m) = Gen (\n r - m n (rands r !!

Re: [Haskell-cafe] two problems with Data.Binary and Data.ByteString

2008-08-13 Thread Tim Newsham
Ok, surely at least everyone must agree that this is a bug: force :: Word8 - IO Word8 force x = print x return x -- force = return . (`using` rnf) main = do d - force = decodeFile stateFile encodeFile stateFile d where stateFile = 1word32.bin test8.hs: 1word32.bin:

Re: [Haskell-cafe] two problems with Data.Binary and Data.ByteString

2008-08-13 Thread Don Stewart
newsham: Ok, surely at least everyone must agree that this is a bug: force :: Word8 - IO Word8 force x = print x return x -- force = return . (`using` rnf) main = do d - force = decodeFile stateFile encodeFile stateFile d where stateFile = 1word32.bin

Re: [Haskell-cafe] two problems with Data.Binary and Data.ByteString

2008-08-13 Thread Tim Newsham
So am I understanding you correctly that you believe this is not a bug? That the use Data.Binary.decodeFile function leaks a file descriptor and this is proper behavior? I still don't understand your explanation of how isEmpty can return True without having read to EOF. The ByteString