Re[2]: [Haskell-cafe] GC'ing file handles and other resources

2008-04-16 Thread Bulat Ziganshin
Hello Abhay, Wednesday, April 16, 2008, 9:30:34 AM, you wrote: i think it will not work with current ghc GC - it scans entire memory/nursery when garbage collected so anyway you will need to wait until next GC event occurs Your mail gives me an idea, though I am not an iota familiar with

Re: Re[2]: [Haskell-cafe] GC'ing file handles and other resources

2008-04-16 Thread Abhay Parvate
I am not saying that it should claim it as soon as it is unused; all I am saying that as soon as a priority object becomes unreferenced, it should be the first choice for collecting in the next collect. Further I was under the impression (I may be wrong) that it uses a generational GC and

Re[4]: [Haskell-cafe] GC'ing file handles and other resources

2008-04-16 Thread Bulat Ziganshin
Hello Abhay, Wednesday, April 16, 2008, 10:51:07 AM, you wrote: I am not saying that it should claim it as soon as it is unused; all I am saying that as soon as a priority object becomes unreferenced, it should be the first choice for collecting in the next collect. on the GC, all

Re: Re[4]: [Haskell-cafe] GC'ing file handles and other resources

2008-04-16 Thread Abhay Parvate
Thanks, both for the summary and for the link. Will try to go through it. Regards, Abhay On Wed, Apr 16, 2008 at 12:37 PM, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Abhay, Wednesday, April 16, 2008, 10:51:07 AM, you wrote: I am not saying that it should claim it as soon as it is

[Haskell-cafe] Re: GC'ing file handles and other resources

2008-04-16 Thread Peter Hercek
Abhay Parvate wrote: I am not saying that it should claim it as soon as it is unused; all I am saying that as soon as a priority object becomes unreferenced, it should be the first choice for collecting in the next collect. Further I was under the impression (I may be wrong) that it uses a

[Haskell-cafe] C++ interface with Haskell

2008-04-16 Thread Miguel Lordelo
Hi all, Well...somehow I'm a beginner in Haskell. But actually my interest in Haskell will increase if it is possible to call a haskell function in C++. Something like GreenCard ( http://www.haskell.org/greencard/ ) simplifying the task of interfacing Haskell programs to external libraries

[Haskell-cafe] compressed pointers?

2008-04-16 Thread Ketil Malde
One of the downsides of a 64-bit environment is the increased size of pointers. This means that the cost of a String increases from something like 12 bytes per char to something like 24. I notice BEA uses something called compressed pointers to get the 64-bit (more registers, etc) benefits

Re: [Haskell-cafe] monadic debugging

2008-04-16 Thread pepe
On 16/04/2008, at 0:53, Galchin, Vasili wrote: Hello, I have an Linux executable of my Haskell library and test case. I see there are several debuggers, e.g. Buddha, Hat, etc. Which debugger is currently preferred for monadic (imperative) code? Thanks. Vasili For debugging IO

Re: [Haskell-cafe] compressed pointers?

2008-04-16 Thread Jan-Willem Maessen
On Apr 16, 2008, at 4:45 AM, Ketil Malde wrote: I notice BEA uses something called compressed pointers to get the 64-bit (more registers, etc) benefits without paying the (cache-thrashing) cost. But only if you're not *actually* using a 64-bit address space. From their own documentation:

[Haskell-cafe] Funny State monad dependency

2008-04-16 Thread Hans Aberg
When I load the State module in Hugs, then I can define the function f below, but I do not immediately see exactly what function return returns. Explanation welcome. For example: f [2..4] [6..9] [6,7,8,9,6,7,8,9,6,7,8,9] That is, it just repeats the second argument as many times as the

Re: [Haskell-cafe] Funny State monad dependency

2008-04-16 Thread Miguel Mitrofanov
It has nothing to do with State; it actually works in List monad. return y is just another way of writing [y]. You don't need to import Control.Monad.State for this to work; you only need Control.Monad (which is imported by the former). On 16 Apr 2008, at 16:56, Hans Aberg wrote: When I

Re: [Haskell-cafe] Funny State monad dependency

2008-04-16 Thread Miguel Mitrofanov
Before somebody noticed: I'm wrong. It's not List monad, but also a (-) x monad, also defined in Control.Monad. Therefore, return y is just const y. Therefore, x = (return y) = x = (const y) = x y On 16 Apr 2008, at 17:04, Miguel Mitrofanov wrote: It has nothing to do with State; it

Re: [Haskell-cafe] Funny State monad dependency

2008-04-16 Thread Roberto Zunino
Miguel Mitrofanov wrote: It has nothing to do with State; it actually works in List monad. return y is just another way of writing [y]. Actually, it seems that in this case return is from the ((-) a) monad, i.e. return=const. f x y = x = return y = x = const y = (concat . map)

Re: [Haskell-cafe] Funny State monad dependency

2008-04-16 Thread Daniel Fischer
Am Mittwoch, 16. April 2008 14:56 schrieb Hans Aberg: When I load the State module in Hugs, then I can define the function f below, but I do not immediately see exactly what function return returns. Explanation welcome. For example: f [2..4] [6..9] [6,7,8,9,6,7,8,9,6,7,8,9] That

Re: [Haskell-cafe] Funny State monad dependency

2008-04-16 Thread Hans Aberg
On 16 Apr 2008, at 15:22, Daniel Fischer wrote: The point is the instance Monad ((-) a) where return x = const x f = g = \x - g (f x) x which is defined in Control.Monad.Instances... Thank you. I suspected there was an instance somewhere, and I wanted to know where it is defined.

[Haskell-cafe] Searching for possible PhD supervisors/projects

2008-04-16 Thread Ivan Miljenovic
Next year, I'm thinking of going overseas (I'm currently in Australia) to do a PhD. Preferably, I'd like to do something in the area of computational combinatorics using Haskell. Does anyone know of any particular unis/supervisors I should be looking at/talking to about this? -- Ivan Lazar

Re: [Haskell-cafe] Funny State monad dependency

2008-04-16 Thread Hans Aberg
On 16 Apr 2008, at 15:14, Miguel Mitrofanov wrote: Before somebody noticed: I'm wrong. It's not List monad, but also a (-) x monad, also defined in Control.Monad. Therefore, return y is just const y. Therefore, x = (return y) = x = (const y) = x y Right. It is an interesting monad, but

[Haskell-cafe] looking for examples of non-full Functional Dependencies

2008-04-16 Thread Tom Schrijvers
Hello, I'm looking for practical examples of non-full functional dependencies and would be grateful if anyone could show me some or point to applications using them. A non-full functional dependency is one involves only part of the parameters of a type class. E.g. class C a b c |

Re: [Haskell-cafe] C++ interface with Haskell

2008-04-16 Thread Dan Mead
write the C wrapper that calls haskell, then link that to your C++ objects I think what you're really asking is how to call C from C++ -Dan 2008/4/16 Miguel Lordelo [EMAIL PROTECTED]: Hi all, Well...somehow I'm a beginner in Haskell. But actually my interest in Haskell will increase if it

Re: [Haskell-cafe] compressed pointers?

2008-04-16 Thread Don Stewart
ketil: One of the downsides of a 64-bit environment is the increased size of pointers. This means that the cost of a String increases from something like 12 bytes per char to something like 24. I notice BEA uses something called compressed pointers to get the 64-bit (more registers, etc)

Re: [Haskell-cafe] Module for parsing C (pre-processed header files only)?

2008-04-16 Thread Don Stewart
magnus: Is there such a beast out there? If this were a list on some OO language I'd ask for something that created an AST and then offered an API based around a visitor pattern. The pre-processor (platform specific most likely, but could be cpphs of course) would be run

Re[2]: [Haskell-cafe] looking for examples of non-full Functional Dependencies

2008-04-16 Thread Bulat Ziganshin
Hello Martin, Wednesday, April 16, 2008, 7:06:07 PM, you wrote: i'm not 100% sure that you'll find there appropriate examples but i suggest you too look into http://haskell.org/haskellwiki/Library/Streams where i've used very sophisticated (for me) FDs We're also looking for (practical)

Re: [Haskell-cafe] looking for examples of non-full Functional Dependencies

2008-04-16 Thread Ross Paterson
On Wed, Apr 16, 2008 at 04:30:27PM +0200, Tom Schrijvers wrote: I'm looking for practical examples of non-full functional dependencies and would be grateful if anyone could show me some or point to applications using them. A non-full functional dependency is one involves only part of the

Re: [Haskell-cafe] looking for examples of non-full Functional Dependencies

2008-04-16 Thread Martin Sulzmann
We're also looking for (practical) examples of multi-range functional dependencies class C a b c | c - a b Notice that there are multiple (two) parameters in the range of the FD. It's tempting to convert the above to class C a b c | c - a, c - b but this yields a weaker (in terms of type

[Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread John Goerzen
On 2008-04-15, Joe Buehler [EMAIL PROTECTED] wrote: John Goerzen wrote: So I have a need to write data to a POSIX named pipe (aka FIFO). Long story involving a command that doesn't have an option to read data from stdin, but can from a named pipe. How about /dev/stdin? Only works on

Re: [Haskell-cafe] Module for parsing C (pre-processed header files only)?

2008-04-16 Thread Magnus Therning
On Wed, Apr 16, 2008 at 4:01 PM, Don Stewart [EMAIL PROTECTED] wrote: magnus: Is there such a beast out there? If this were a list on some OO language I'd ask for something that created an AST and then offered an API based around a visitor pattern. The pre-processor

Re: [Haskell-cafe] Module for parsing C (pre-processed header files only)?

2008-04-16 Thread Don Stewart
magnus: On Wed, Apr 16, 2008 at 4:01 PM, Don Stewart [EMAIL PROTECTED] wrote: magnus: Is there such a beast out there? If this were a list on some OO language I'd ask for something that created an AST and then offered an API based around a

Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Brandon S. Allbery KF8NH
On Apr 16, 2008, at 11:16 , John Goerzen wrote: On 2008-04-15, Joe Buehler [EMAIL PROTECTED] wrote: John Goerzen wrote: So I have a need to write data to a POSIX named pipe (aka FIFO). Long story involving a command that doesn't have an option to read data from stdin, but can from a named

Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Miguel Mitrofanov
You are insulting other Unixes. It works on Mac OS X, for example. On 16 Apr 2008, at 19:16, John Goerzen wrote: On 2008-04-15, Joe Buehler [EMAIL PROTECTED] wrote: John Goerzen wrote: So I have a need to write data to a POSIX named pipe (aka FIFO). Long story involving a command that

Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Brandon S. Allbery KF8NH
On Apr 16, 2008, at 13:23 , Miguel Mitrofanov wrote: You are insulting other Unixes. It works on Mac OS X, for example. Not just that, but IIRC Linux was late to the party: Solaris got / dev/fd/ and /dev/stdin before Linux got /proc/$$/fd/ (which gets symlinked to /dev/fd/). -- brandon

Re: [Haskell-cafe] ANN: datapacker 1.0.0

2008-04-16 Thread Denis Bueno
On Wed, Apr 16, 2008 at 12:02 AM, John Goerzen [EMAIL PROTECTED] wrote: Hi, I'm pleased to announce the first release of datapacker. Your datapacker depends on MissingH 1.0.1 which, although on hackage, fails to build with GHC 6.8.2. (It may build with earlier versions, but I haven't tried.)

Re: [Haskell-cafe] looking for examples of non-full Functional Dependencies

2008-04-16 Thread Iavor Diatchki
Hello, On Wed, Apr 16, 2008 at 8:06 AM, Martin Sulzmann [EMAIL PROTECTED] wrote: We're also looking for (practical) examples of multi-range functional dependencies class C a b c | c - a b Notice that there are multiple (two) parameters in the range of the FD. It's tempting to convert

Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Donn Cave
On Apr 16, 2008, at 10:25 AM, Brandon S. Allbery KF8NH wrote: On Apr 16, 2008, at 13:23 , Miguel Mitrofanov wrote: You are insulting other Unixes. It works on Mac OS X, for example. Not just that, but IIRC Linux was late to the party: Solaris got / dev/fd/ and /dev/stdin before Linux got

Re: [Haskell-cafe] looking for examples of non-full Functional Dependencies

2008-04-16 Thread Dan Weston
Iavor Diatchki wrote: Hello, On Wed, Apr 16, 2008 at 8:06 AM, Martin Sulzmann [EMAIL PROTECTED] wrote: We're also looking for (practical) examples of multi-range functional dependencies class C a b c | c - a b Notice that there are multiple (two) parameters in the range of the FD. It's

Re: [Haskell-cafe] ANN: datapacker 1.0.0

2008-04-16 Thread Marc Weber
src/System/IO/Binary.hs:266:8: Illegal signature in pattern: ForeignPtr CChar Use -XPatternSignatures to permit it Hackage confirms this build failure: http://hackage.haskell.org/packages/archive/MissingH/1.0.1/logs/failure/ghc-6.8 Should not be hard to fix :) just add it to

Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread John Goerzen
On Wed April 16 2008 12:20:37 pm Brandon S. Allbery KF8NH wrote: On Apr 16, 2008, at 11:16 , John Goerzen wrote: On 2008-04-15, Joe Buehler [EMAIL PROTECTED] wrote: John Goerzen wrote: So I have a need to write data to a POSIX named pipe (aka FIFO). Long story involving a command that

Re: [Haskell-cafe] ANN: datapacker 1.0.0

2008-04-16 Thread John Goerzen
On Wed April 16 2008 1:08:08 pm Marc Weber wrote: src/System/IO/Binary.hs:266:8: Illegal signature in pattern: ForeignPtr CChar Use -XPatternSignatures to permit it Hackage confirms this build failure: http://hackage.haskell.org/packages/archive/MissingH/1.0.1/logs/failure/

[Haskell-cafe] Hoogle

2008-04-16 Thread Galchin, Vasili
Hello, I tried d to use Hoogle to find openFd's signature and more importantly FileMode. I found FileMode which is a type synonym with CMode. I don't understand what are the values for FileMode (so I can call openFd). ?? Thanks, Vasili ___

Re: [Haskell-cafe] Hoogle

2008-04-16 Thread Antoine Latter
2008/4/16 Galchin, Vasili [EMAIL PROTECTED]: Hello, I tried d to use Hoogle to find openFd's signature and more importantly FileMode. I found FileMode which is a type synonym with CMode. I don't understand what are the values for FileMode (so I can call openFd). ?? Values of type

Re: [Haskell-cafe] Hoogle

2008-04-16 Thread Neil Mitchell
Hi I tried d to use Hoogle to find openFd's signature and more importantly FileMode. Hoogle does not search the Posix library, because in general people should steer clear of it - otherwise I won't be able to run your programs :-) - The next version of Hoogle will permit selecting to

Re: [Haskell-cafe] ANN: datapacker 1.0.0

2008-04-16 Thread Brandon S. Allbery KF8NH
On Apr 16, 2008, at 14:08 , Marc Weber wrote: src/System/IO/Binary.hs:266:8: Illegal signature in pattern: ForeignPtr CChar Use -XPatternSignatures to permit it Hackage confirms this build failure: http://hackage.haskell.org/packages/archive/MissingH/1.0.1/logs/ failure/ghc-6.8

Re: [Haskell-cafe] Re: Embedding newlines into a string?

2008-04-16 Thread Ariel J. Birnbaum
That's exactly what I was thinking about, but your hanoi_shower only handles list of exactly one action, but you have to handle longer lists, too. This could be done with explicit recursion This seems to be a common pitfall for Haskell newcomers: mistaking a single-element list pattern (such

[Haskell-cafe] Shim: finding modules

2008-04-16 Thread Graham Fawcett
Hi folks, I'm a newbie, so please forgive any terminological mistakes. I've been using Shim in Emacs with great success, but there's one issue I've encountered, and I don't know if it's configuration problem or something fundamental. Consider a module 'App' and submodules 'App.Front' and

Re: [Haskell-cafe] Hoogle

2008-04-16 Thread Galchin, Vasili
hi Antoine, I already found this link. Thanks in any case. I want to O_CREATE a file, i.e. do a openFd creating a new file. O_CREATE should be the FileMode, but I don't see in the link below. Thanks, Vasili On Wed, Apr 16, 2008 at 1:46 PM, Antoine Latter [EMAIL PROTECTED] wrote: 2008/4/16

Re: [Haskell-cafe] Hoogle

2008-04-16 Thread Neil Mitchell
Hi Vasili, I already found this link. Thanks in any case. I want to O_CREATE a file, i.e. do a openFd creating a new file. O_CREATE should be the FileMode, but I don't see in the link below. What do you want to do beyond writeFile/openFile/readFile? If you can, its better to use the

Re: [Haskell-cafe] Hoogle

2008-04-16 Thread John Goerzen
On Wed April 16 2008 3:54:45 pm Galchin, Vasili wrote: hi Antoine, I already found this link. Thanks in any case. I want to O_CREATE a file, i.e. do a openFd creating a new file. O_CREATE should be the FileMode, but I don't see in the link below. Indeed. It seems there is no way to pass

Re: [Haskell-cafe] Hoogle

2008-04-16 Thread Graham Fawcett
On Wed, Apr 16, 2008 at 5:30 PM, John Goerzen [EMAIL PROTECTED] wrote: On Wed April 16 2008 3:54:45 pm Galchin, Vasili wrote: hi Antoine, I already found this link. Thanks in any case. I want to O_CREATE a file, i.e. do a openFd creating a new file. O_CREATE should be the

Re: [Haskell-cafe] looking for examples of non-full Functional Dependencies

2008-04-16 Thread Ryan Ingram
I'm still confused about this point: On 4/16/08, Dan Weston [EMAIL PROTECTED] wrote: class C a b c | c - a b Notice that there are multiple (two) parameters in the range of the FD. It's tempting to convert the above to class C a b c | c - a, c - b but this yields a

[Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Simon Marlow
Donn Cave wrote: I have run into this problem, with Network.Socket (socket). If I remember right, ktrace showed me what was happening. This isn't my favorite thing about Haskell. Is there even a means provided to set it back to blocking? There isn't a way right now to open a file using a

Re: [Haskell-cafe] Hoogle

2008-04-16 Thread Brandon S. Allbery KF8NH
On Apr 16, 2008, at 17:30 , John Goerzen wrote: On Wed April 16 2008 3:54:45 pm Galchin, Vasili wrote: I already found this link. Thanks in any case. I want to O_CREATE a file, i.e. do a openFd creating a new file. O_CREATE should be the FileMode, but I don't see in the link below.

[Haskell-cafe] Mutually recursive types?

2008-04-16 Thread Ron Alford
Here's the setup: I have a series of problems that use various logical connectives. The problem is that they're not all the same. So instead of creating one giant datatype (or duplicating much code), I'd like to assemble them like toy blocks. I've boiled down an example here: data

Re: [Haskell-cafe] Hoogle

2008-04-16 Thread John Goerzen
On Wednesday 16 April 2008 6:16:56 pm Brandon S. Allbery KF8NH wrote: On Apr 16, 2008, at 17:30 , John Goerzen wrote: On Wed April 16 2008 3:54:45 pm Galchin, Vasili wrote: I already found this link. Thanks in any case. I want to O_CREATE a file, i.e. do a openFd creating a new file.

Re: [Haskell-cafe] looking for examples of non-full Functional Dependencies

2008-04-16 Thread Dan Weston
I think I was the one confused. I guess I was (falsely) thinking that both C Int Char T C Char Int T could both be instances of class C a b c | c - a, c - b but only one could be an instance of C a b c | c - a b. Sorry for adding noise to the discussion. Ryan Ingram wrote: I'm still

[Haskell-cafe] export question (GHC.Handle)

2008-04-16 Thread Graham Fawcett
I notice in the source for GHC.Handle that certain functions (e.g. fdToHandle_stat) are in the export list, but are not actually exported (at least, it seems you cannot import them). What mechanism causes these functions to be hidden, and are they still accessible in some way? Graham

Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Richard A. O'Keefe
One question is whether the program is statically or dynamically linked, and if the latter, whether it is possible (as it is in many Unices) to slide your own open(2) definition in between the program and the system library. If it is, it's possible to slide in something that fakes /dev/stdin.

Re: [Haskell-cafe] C++ interface with Haskell

2008-04-16 Thread Isaac Dupree
perhaps haskell: foreign export foo_func foo :: Int - IO Int -- I forget the rest of the syntax here C++: extern C { int foo_func(int i); } int some_cplusplus_function() { int bat = 3; int blah = foo_func(bat); return blah; } Is that all you need to do? Miguel Lordelo wrote: Hi

Re: [Haskell-cafe] Mutually recursive types?

2008-04-16 Thread Ryan Ingram
You probably want to look at this: http://wadler.blogspot.com/2008/02/data-types-la-carte.html which refers to a paper about this exact problem. The main types you want are: newtype Fix a = In { out :: a (Fix a) } data (f :+: g) x = Inl (f x) | Inr (g x) Yes, you end up with a ton of

Re: [Haskell-cafe] Mutually recursive types?

2008-04-16 Thread Ryan Ingram
minor correction: test = and [empty, empty] On 4/16/08, Ryan Ingram [EMAIL PROTECTED] wrote: You probably want to look at this: http://wadler.blogspot.com/2008/02/data-types-la-carte.html which refers to a paper about this exact problem. The main types you want are: newtype Fix a = In

Re: [Haskell-cafe] Re: Embedding newlines into a string?

2008-04-16 Thread Benjamin L. Russell
Ariel, Check out the following HaskellWiki pages: Common Misunderstandings - HaskellWiki http://www.haskell.org/haskellwiki/Common_Misunderstandings Things to avoid - HaskellWiki http://www.haskell.org/haskellwiki/Things_to_avoid Hope these help Benjamin L. Russell --- Ariel J. Birnbaum

Re: [Haskell-cafe] Re: Embedding newlines into a string?

2008-04-16 Thread Benjamin L. Russell
Ariel, In response to your comment, since there was apparently no section devoted to pitfalls of iterating over lists, I have added the section 1.4 Iterating Over a List in the following HaskellWiki page; viz: Common Misunderstandings - HaskellWiki

Re: [Haskell-cafe] looking for examples of non-full Functional Dependencies

2008-04-16 Thread Mark P Jones
Martin Sulzmann wrote: We're also looking for (practical) examples of multi-range functional dependencies class C a b c | c - a b Notice that there are multiple (two) parameters in the range of the FD. It's tempting to convert the above to class C a b c | c - a, c - b but this yields a

[Haskell-cafe] Intro to functional dependencies in Haskell?

2008-04-16 Thread Alexis Hazell
Hi all, i'm having some trouble 'getting' functional dependencies in the Haskell context (although my understanding of them in the context of relational database theory isn't that great either). Could someone please point me to an introduction / tutorial in this regard? Thanks! Alexis.

Re: [Haskell-cafe] export question (GHC.Handle)

2008-04-16 Thread Fraser Wilson
On Thu, Apr 17, 2008 at 2:09 AM, Graham Fawcett [EMAIL PROTECTED] wrote: I notice in the source for GHC.Handle that certain functions (e.g. fdToHandle_stat) are in the export list, but are not actually exported (at least, it seems you cannot import them). What mechanism causes these functions