Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-03 Thread Ketil Malde
On Tue, 2007-10-02 at 14:32 -0700, Stefan O'Rear wrote: UTF-8 supports CJK languages too. The only question is efficiency, and I believe CJK is still a relatively uncommon case compared to English and other Latin-alphabet languages. (That said, I live in a country all of whose dominant

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-03 Thread Ketil Malde
On Tue, 2007-10-02 at 21:45 -0400, Brandon S. Allbery KF8NH wrote: Due to the additional complexity of handling UTF-8 -- EVEN IF the actual text processed happens all to be US-ASCII -- will UTF-8 perhaps be less efficient than UTF-16, or only as fast? UTF8 will be very slightly faster

[Haskell-cafe] Parsing R5RS Scheme with Parsec

2007-10-03 Thread Pasqualino 'Titto' Assini
Hi Alex, I hope not to spoil your fun but have you had a look at this: Write Yourself a Scheme in 48 Hours http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html Regards, titto ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-03 Thread Jules Bean
PR Stanley wrote: Yes and thanks for the reply. When a function is declared in C the argument variable has an address somewhere in the memory: int f ( int x ) { return x * x; } any value passed to f() is assigned to x. x is the identifier for a real slot in the memory (the stack most likely)

[Haskell-cafe] GLFW for WinHugs

2007-10-03 Thread Peter Verswyvelen
The latest version of SOE comes with a wrapper for a nice GLFW library. This library comes with a demo of a 3D bouncing Amiga ball so it must be the best library in the world ;-) ;-) Since I'm letting my students play with WinHugs, I would prefer to have a WinHugs compatible version of that

[Haskell-cafe] Curry and uncurry

2007-10-03 Thread PR Stanley
Hi The following is from the Hutton book: Without looking at the standard prelude, define the higher-order library function curry that converts a function on pairs into a curried function, and conversely, the function uncurry that converts a curried

Re: [Haskell-cafe] Parsing R5RS Scheme with Parsec

2007-10-03 Thread Alex Queiroz
Hallo, On 10/3/07, Pasqualino 'Titto' Assini [EMAIL PROTECTED] wrote: Hi Alex, I hope not to spoil your fun but have you had a look at this: Write Yourself a Scheme in 48 Hours http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html Yes, I'm actually using it as a

[Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-03 Thread Stephane Bortzmeyer
On Wed, Oct 03, 2007 at 12:01:50AM +0200, Twan van Laarhoven [EMAIL PROTECTED] wrote a message of 24 lines which said: Lots of people wrote: I want a UTF-8 bikeshed! No, I want a UTF-16 bikeshed! Personnally, I want an UTF-32 bikeshed. UTF-16 is as lousy as UTF-8 (for both of them,

Re: [Haskell-cafe] Curry and uncurry

2007-10-03 Thread Stuart Cook
On 10/3/07, PR Stanley [EMAIL PROTECTED] wrote: Without looking at the standard prelude, define the higher-order library function curry that converts a function on pairs into a curried function, and conversely, the function uncurry that converts a

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-03 Thread Johan Tibell
What the heck does it matter what encoding the library uses internally? +1 It can even use a non-standard encoding scheme if it wants. Sounds good to me. I (think) one of my initial questions was if the encoding should be visible in the type of the UnicodeString type or not. My gut feeling

Re: [Haskell-cafe] Curry and uncurry

2007-10-03 Thread Derek Elkins
On Wed, 2007-10-03 at 22:31 +1000, Stuart Cook wrote: On 10/3/07, PR Stanley [EMAIL PROTECTED] wrote: Without looking at the standard prelude, define the higher-order library function curry that converts a function on pairs into a curried function, and

[Haskell-cafe] with and preserving for local state

2007-10-03 Thread Jules Bean
Lots of external libraries contain state, but one that really contains a *lot* of state is the OpenGL libraries, since OpenGL is specified as a statemachine. This means that when you're writing structured code you quite often want to save and restore chunks of state 'automatically'. For the

[Haskell-cafe] Hugs, dotnet, C#...

2007-10-03 Thread Peter Verswyvelen
In the (Win)Hugs documentation, I found Only the ccall, stdcall and *dotnet *calling conventions are supported. All others are flagged as errors. However, I fail to find any more information on how to invoke dotnet methods. This might be really handy for me, as I'm very familiar with the

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-03 Thread Jonathan Cast
On Wed, 2007-10-03 at 14:15 +0200, Stephane Bortzmeyer wrote: On Wed, Oct 03, 2007 at 12:01:50AM +0200, Twan van Laarhoven [EMAIL PROTECTED] wrote a message of 24 lines which said: Lots of people wrote: I want a UTF-8 bikeshed! No, I want a UTF-16 bikeshed! Personnally, I want

[Haskell-cafe] Haskell FFI and finalizers

2007-10-03 Thread Maxime Henrion
Hello all, I have recently developed a small set of bindings for a C library, and encountered a problem that I think could be interesting to others. My problem was that the C function I was writing bindings to expects to be passed a FILE *. So, I had basically two possibles routes to

Re: [Haskell-cafe] Curry and uncurry

2007-10-03 Thread Justin Bailey
On 10/3/07, PR Stanley [EMAIL PROTECTED] wrote: I didn't even know about the curry and uncurry functions. I'm not looking for the answer but some guidance would be much appreciated. Thanks, Paul You can look at the types without seeing the implementation, too. Just start up GHCI and type:

Re: [Haskell-cafe] Haskell FFI and finalizers

2007-10-03 Thread Bulat Ziganshin
Hello Maxime, Wednesday, October 3, 2007, 7:57:58 PM, you wrote: And then I discovered Foreign.Concurrent, which allows one to associate a plain Haskell IO action to a pointer. The 'Foreign.Concurrent' name is a bit misleading to me; it seems this module is named so because it needs

[Haskell-cafe] Function composition

2007-10-03 Thread Tiago Miguel Laureano Alves
Hi, I'm playing a little bit with pointfree and function composition and I would like to ask you if the following is theoretical correct and how can I express it in haskell. Imagine that I have the following functions f :: a - b - c - d g :: d - e I want to compose these two

Re: [Haskell-cafe] Haskell FFI and finalizers

2007-10-03 Thread Ryan Ingram
I think you want to use wrapper functions from the FFI: type HsPlayerFinalizer = Ptr PlayerStruct - IO () foreign import ccall wrapper mkPlayerFinalizer :: HsPlayerFinalizer - IO (FunPtr HsPlayerFinalizer) You can then make an arbitrary Haskell function (including a partially applied function

Re: [Haskell-cafe] Re: bizarre memory usage with data.binary

2007-10-03 Thread Spencer Janssen
On Tuesday 02 October 2007 19:51:47 Anatoly Yakovenko wrote: If its specifically the list instance, where we currently trade laziness for efficiency of encoding (which may or may not be the right thing), I'd suggest a fully lazy encoding instance? Its not really a list, its more of a tree

Re: [Haskell-cafe] Function composition

2007-10-03 Thread Ryan Ingram
On 10/3/07, Tiago Miguel Laureano Alves [EMAIL PROTECTED] wrote: Imagine that I have the following functions f :: a - b - c - d g :: d - e I want to compose these two functions such that: (g . f) :: a - b - c - e Here's a pointfree derivation of the composition function you are

Re: [Haskell-cafe] Re: bizarre memory usage with data.binary

2007-10-03 Thread Jules Bean
Spencer Janssen wrote: On Tuesday 02 October 2007 19:51:47 Anatoly Yakovenko wrote: If its specifically the list instance, where we currently trade laziness for efficiency of encoding (which may or may not be the right thing), I'd suggest a fully lazy encoding instance? Its not really a list,

Re: [Haskell-cafe] Function composition

2007-10-03 Thread Jorge Marques Pelizzoni
Here is a generalized version, using type classes and some extensions. Tiago, in order to compile this you'll have to use: -fglasgow-exts -fallow-undecidable-instances -fallow-overlapping-instances Cheers, Jorge. - module Main where class Pipeline t1 t2 t3 | t1 t2 - t3 where

Re: [Haskell-cafe] Haskell FFI and finalizers

2007-10-03 Thread Stefan O'Rear
On Wed, Oct 03, 2007 at 05:57:58PM +0200, Maxime Henrion wrote: I have recently developed a small set of bindings for a C library, and encountered a problem that I think could be interesting to others. My problem was that the C function I was writing bindings to expects to be passed a FILE

[Haskell-cafe] GHC doesn't work

2007-10-03 Thread Andrew Coppin
Greetings. I have a PC that had GHC 6.6 running on it. Worked fine. Then I uninstalled 6.6 and installed 6.6.1, and now it doesn't appear to work at all. Any attempt to run GHC results in a message that says The entry point OpenThread could not be found in KERNEL32.dll. or something very

[Haskell-cafe] Why not assign a type to unsafePerformIO?

2007-10-03 Thread Justin Bailey
One of the holes in real-world Haskell is you never know if a library/function is calling unsafePerformIO and you have to trust the library author. I recognize the necessity of the function, but should it announce itself? unsafePerformIO has this type: unsafePerformIO :: IO a - a Would there

Re: [Haskell-cafe] Re: bizarre memory usage with data.binary

2007-10-03 Thread Anatoly Yakovenko
...and indeed it can't be done, except by the naive brute-force method of comparing every subtree, possibly optimized by cryptographically hashing a representation of every subtree, since sharing isn't an observable property. i was thinking that instead of having a reference to a node, each

Re: [Haskell-cafe] Why not assign a type to unsafePerformIO?

2007-10-03 Thread Justin Bailey
On 10/3/07, Victor Nazarov [EMAIL PROTECTED] wrote: But how would you know that evil dictator uses unsafePerformIO??? You don't. unsafePerformIO can't be taken it away (there are legitimate reasons to strip IO), which is why I wonder if it's useful at all. p.s. CC'ed to haskell-cafe

Re: [Haskell-cafe] Why not assign a type to unsafePerformIO?

2007-10-03 Thread Jonathan Cast
On Wed, 2007-10-03 at 14:47 -0700, Justin Bailey wrote: One of the holes in real-world Haskell is you never know if a library/function is calling unsafePerformIO and you have to trust the library author. I recognize the necessity of the function, but should it announce itself? unsafePerformIO

Re: [Haskell-cafe] Haskell FFI and finalizers

2007-10-03 Thread Maxime Henrion
Stefan O'Rear wrote: On Wed, Oct 03, 2007 at 05:57:58PM +0200, Maxime Henrion wrote: I have recently developed a small set of bindings for a C library, and encountered a problem that I think could be interesting to others. My problem was that the C function I was writing bindings to

Re: [Haskell-cafe] Why not assign a type to unsafePerformIO?

2007-10-03 Thread Victor Nazarov
On 10/4/07, Justin Bailey [EMAIL PROTECTED] wrote: On 10/3/07, Victor Nazarov [EMAIL PROTECTED] wrote: But how would you know that evil dictator uses unsafePerformIO??? You don't. unsafePerformIO can't be taken it away (there are legitimate reasons to strip IO), which is why I wonder if

Re: [Haskell-cafe] Haskell FFI and finalizers

2007-10-03 Thread Stefan O'Rear
On Thu, Oct 04, 2007 at 12:55:41AM +0200, Maxime Henrion wrote: When writing the binding for foo_new(), I need to open a file with fopen() to pass it the FILE *. Then I get a struct foo * that I can easily associate the the foo_destroy() finalizer. However, when finalizing the struct foo *

[Haskell-cafe] The Exp - Term a problem (again), how to dynamically create (polymorphic) typed terms in Haskell ??

2007-10-03 Thread Pasqualino 'Titto' Assini
Hi, I am trying to write an interpreter for a little functional language but I am finding very problematic to dynamically create a typed representations of the language terms. I have googled around and found a few solutions but none seem to solve the problem. This is the example code:

[Haskell-cafe] Space and time leaks

2007-10-03 Thread Ronald Guida
I need some help with space and time leaks. I know of two types of space leak. The first type of leak occurs when a function uses unnecessary stack or heap space. GHCi sum [1..10^6] *** Exception: stack overflow Apparently, the default definition for sum has a space leak. I can define my own