Re[5]: [Haskell-cafe] Re: [Haskell] installing streams library

2006-05-31 Thread Bulat Ziganshin
Hello Bulat, Sunday, May 28, 2006, 2:44:37 PM, you wrote: type PtrLen a = (Ptr a, Int) encodePtrLen :: (Binary a) = a - (PtrLen a - IO b) - IO b decodePtr :: (Binary a) = Ptr a - IO a Finally i've implemented the following (you then would use 'withForeignPtr' to work with contents of

Re: [Haskell-cafe] Re: [Haskell] installing streams library

2006-05-31 Thread Jacques Carette
[See comments at bottom] Bulat Ziganshin wrote: Finally i've implemented the following (you then would use 'withForeignPtr' to work with contents of ForeignPtr): -- - -- Encode/decode contents of memory buffer

Re: [Haskell-cafe] Re: [Haskell] installing streams library

2006-05-31 Thread Jacques Carette
You would need to define a type class (Binary a) = EncodedPtr a b where the 'a' is as you have it currently, and the b would be an enumerated type which tracks the memory representation. I agree they are different concepts - that is why an EncodedPtr would require 2 type parameters. Of

Re[2]: [Haskell-cafe] Re: [Haskell] installing streams library

2006-05-31 Thread Bulat Ziganshin
Hello Jacques, Wednesday, May 31, 2006, 5:33:39 PM, you wrote: encodePtr :: (Binary a, Integral size) = a - IO (ForeignPtr x, size) encodePtrLE :: (Binary a, Integral size) = a - IO (ForeignPtr x, size) encodePtrBitAligned :: (Binary a, Integral size) = a - IO

[Haskell-cafe] Re[2]: [Haskell] My summer of code project: HsJudy

2006-05-31 Thread Bulat Ziganshin
(moved to haskell-cafe) Hello Jean-Philippe, Tuesday, May 30, 2006, 2:58:01 PM, you wrote: you should also see to the Collections package: darcs get --partial http://darcs.haskell.org/packages/collections/ although it contains only _immutable_ datastructures at this moment. may be, you can

Re: [Haskell-cafe] Re: [Haskell] installing streams library

2006-05-31 Thread Tim Newsham
Am I the only one who finds this encoding-of-types in the _name_ of a function quite distateful? There is no type safety being enforced here, no ensuring one will not be encoding a Ptr one way and decoding it another. Why not use Haskell's type system to help you there? When marshalling

Re: [Haskell-cafe] Re: [Haskell] installing streams library

2006-05-31 Thread Jacques Carette
I have no problems with marshalling/unmarshalling (and even with the implicit casting going on). What I dislike is having a bunch of functions which are the same but with different names, where the difference boils down to enumerated types that end up being encoded in the function name.

Re: [Haskell-cafe] Re: [Haskell] installing streams library

2006-05-31 Thread Jacques Carette
Bulat Ziganshin wrote: i'm not against your idea, you absolutely right that this will be more Haskell way, but can this be implemented without additional complications for library users? C is a language which pushes the boundaries of no complications (ie convenience) quite far (and yet

[Haskell-cafe] Polymorphic Sudoku solver

2006-05-31 Thread Chris Kuklewicz
A while back there was a long thread about Sudoku solvers (some of which ended up on http://haskell.org/haskellwiki/Sudoku ). I contributed my brute-force dancing links solver at the time, and mentioned that I had a by-logic solver that, while a bit slow, was as good as most of those being

Re: [Haskell-cafe] Editors for Haskell

2006-05-31 Thread Brian Hulley
Doaitse Swierstra wrote: On 2006 mei 30, at 17:33, Brian Hulley wrote: But the buffer will nearly always be incomplete as you're editing it. I was kind of hoping that the syntax of Haskell could be changed so that for any sequence of characters there would be a unique parse that had a minimum

Re[2]: [Haskell-cafe] Re: [Haskell] installing streams library

2006-05-31 Thread Bulat Ziganshin
Hello Jacques, Wednesday, May 31, 2006, 8:07:29 PM, you wrote: I am completely biased in this regard: I have spent several years maintaining ~800Kloc of legacy dynamically typed [commercial] code. A lot of this code has a life-span of roughly 20 years [ie once written, it takes an average

Re: [Haskell-cafe] Re[2]: [Haskell] My summer of code project: HsJudy

2006-05-31 Thread Benjamin Franksen
On Wednesday 31 May 2006 17:12, Bulat Ziganshin wrote: 6. There is no class framework for container types other than this Data.Collections module, Edison? Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Tips for converting Prolog to typeclasses?

2006-05-31 Thread Greg Buchholz
Lately, in my quest to get a better understanding of the typeclass system, I've been writing my typeclass instance declarations in Prolog first, then when I've debugged them, I port them over back over to Haskell. The porting process involves a lot trial and error on my part trying to decide

Re: [Haskell-cafe] Tips for converting Prolog to typeclasses?

2006-05-31 Thread Robert Dockins
On Wednesday 31 May 2006 08:22 pm, Greg Buchholz wrote: Lately, in my quest to get a better understanding of the typeclass system, I've been writing my typeclass instance declarations in Prolog first, then when I've debugged them, I port them over back over to Haskell. The porting process

[Haskell-cafe] Filtering on data constructors with TH

2006-05-31 Thread Christophe Poucet
Dear, After having read Bulat's mail regarding TH when I had mentioned my wish for Pretty, I decided to use TH for a much smaller project. That's why today I have created an automated derivation for data constructor filtering. As I started coding someone mentioned that something similar can