RE: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Glynn Clements
MR K P SCHUPKE wrote: > >In the general case, it needs to be a bit more complex than that, > > Thats why the functions handled lists not individual characters, > I was assuming that each [Word8] -> [Char] represented a valid > and complete encoding block... IE at the start of each call it > assu

Re: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Glynn Clements
Gabriel Ebner wrote: > > For case testing, locale-dependent sorting and the like, you need to > > convert to characters. [Although possibly only temporarily; you can > > sort a list of byte strings based upon their corresponding character > > strings using sortBy. This means that a decoding failu

Re: [Haskell-cafe] Interoperability with other languages and haskell in industry

2004-09-16 Thread Andy Moran
On Thursday 16 September 2004 02:46 pm, Vincenzo aka Nick Name wrote: > Again, I will try to take benefit of the thread on the "senior" list to > ask a question to everybody who uses haskell in industry (so you people > at Galois Connection can't avoid to answer, I know you are there :D ): > are y

[Haskell-cafe] Interoperability with other languages and haskell in industry

2004-09-16 Thread Vincenzo aka Nick Name
Again, I will try to take benefit of the thread on the "senior" list to ask a question to everybody who uses haskell in industry (so you people at Galois Connection can't avoid to answer, I know you are there :D ): are your solutions entierely written in haskell, or are there parts written in o

RE: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Glynn Clements
Simon Marlow wrote: > >>> Which is why I'm suggesting changing Char to be a byte, so that we > >>> can have the basic, robust API now and wait for the more advanced > >>> API, rather than having to wait for a usable API while people sort > >>> out all of the issues. > >> > >> An easier way is ju

[Haskell-cafe] ghc-6-2-1_1.msi MD5 sum

2004-09-16 Thread Sergey Zaharchenko
Could anyone give me the MD5 sum of http://www.haskell.org/ghc/dist/6.2.1/ghc-6-2-1_1.msi I've been writing in Haskell for FreeBSD, and now I wanted to compile one under windows. The .msi file seems to be broken, and I just wanted to check... -- DoubleF "The more data I punch in this card, the

Re: [Haskell-cafe] Lifting makes lazy

2004-09-16 Thread Iavor S. Diatchki
hello, the types IO(IO ()) and IO() are not the same. think of a value of type "IO a" as a _program_ that when executed will return a result of type "a" (and while executing may print some stuff to the screen). now consider these types: putStrLn :: String -> IO () this is a _pure function_ which

Re: [Haskell-cafe] Lifting makes lazy

2004-09-16 Thread Mike Gunter
This should *not* display anything. Look at the types! displayFile1 returns a value that is the "displaying action". It does not "run" it. Replace "liftM" with "(=<<)" or use "join displayFile1" if you want to run the displaying action. mike >> displayFile1 :: IO (IO ()) >> displayFi

Re: [Haskell-cafe] Lifting makes lazy

2004-09-16 Thread Jeremy Shaw
At Thu, 16 Sep 2004 18:26:35 +0200, [EMAIL PROTECTED] wrote: > > > L.S., > > In my enthusiasm to reduce imperative style coding to a minimum, I changed > a program to something too lazy to do anything. The following is an > extremely simplified version of the program: > > > import Monad >

[Haskell-cafe] Lifting makes lazy

2004-09-16 Thread hjgtuyl
L.S., In my enthusiasm to reduce imperative style coding to a minimum, I changed a program to something too lazy to do anything. The following is an extremely simplified version of the program: import Monad displayFile1 :: IO (IO ())displayFile1 = liftM putStr contents -- Displays nothing

[Haskell-cafe] Maybe bytes *are* text (was Re: Writing binary files?)

2004-09-16 Thread Ben Rudiak-Gould
On Thu, 16 Sep 2004, Udo Stenzel wrote: > Having a seperate byte based api is far better. If you don't know the > encoding, all you have is bytes, no text. Okay, after reading large chunks of this discussion, I'm going to rock the boat a bit by suggesting that bytes *are* text, and *do* belong i

Re: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread MR K P SCHUPKE
>CommandLineToArgvW provides a way to obtain a Unicode Don't forget there are multiple encodings for unicode: UTF-8, UTF-16, UTF-32... Keean. ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Scott Turner
On 2004 September 16 Thursday 06:19, Simon Marlow wrote: > Argv and the environment - I don't know. Windows CreateProcess() allows > these to be UTF-16 strings, but I don't know what encoding/decoding > happens between CreateProcess() and what the target process sees in its > argv[] (can't be both

Re: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Gabriel Ebner
Glynn Clements <[EMAIL PROTECTED]> writes: >> > If you want text, well, tough; what comes out most system calls and >> > core library functions (not just read()) are bytes. >> >> Which need to be interpreted by the program depending on where these >> bytes come from. > > They don't necessarily ne

RE: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread MR K P SCHUPKE
>In the general case, it needs to be a bit more complex than that, Thats why the functions handled lists not individual characters, I was assuming that each [Word8] -> [Char] represented a valid and complete encoding block... IE at the start of each call it assumes no escapes. All this means is th

RE: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Glynn Clements
MR K P SCHUPKE wrote: > >E.g. what happens if you call getDirectoryContents for a directory > >which contains filenames which aren't valid in the current encoding? > > Surely this shows the problem with the idea of a 'current encoding' Yes. In case I haven't already made this clear, my argumen

RE: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Simon Marlow
On 16 September 2004 10:35, Glynn Clements wrote: > Simon Marlow wrote: > >>> Which is why I'm suggesting changing Char to be a byte, so that we >>> can have the basic, robust API now and wait for the more advanced >>> API, rather than having to wait for a usable API while people sort >>> out all

RE: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread MR K P SCHUPKE
>E.g. what happens if you call getDirectoryContents for a directory >which contains filenames which aren't valid in the current encoding? Surely this shows the problem with the idea of a 'current encoding' ... You could be reading files from two remote servers each using different encodings... So

Re: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Glynn Clements
Udo Stenzel wrote: > > > One more reason to fix the I/O functions to handle encodings and have > > > a seperate/underlying binary I/O API. > > > > The problem is that we also need to fix them to handle *no encoding*. > > What are you proposing here? Making the breakage even worse by specifying

RE: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Glynn Clements
Simon Marlow wrote: > > Which is why I'm suggesting changing Char to be a byte, so that we can > > have the basic, robust API now and wait for the more advanced API, > > rather than having to wait for a usable API while people sort out all > > of the issues. > > An easier way is just to declare

Re: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Udo Stenzel
Glynn Clements <[EMAIL PROTECTED]> schrieb am 16.09.04 10:46:58: > Gabriel Ebner wrote: > > One more reason to fix the I/O functions to handle encodings and have > > a seperate/underlying binary I/O API. > > The problem is that we also need to fix them to handle *no encoding*. What are you propos

RE: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Simon Marlow
On 16 September 2004 00:02, Glynn Clements wrote: > Which is why I'm suggesting changing Char to be a byte, so that we can > have the basic, robust API now and wait for the more advanced API, > rather than having to wait for a usable API while people sort out all > of the issues. An easier way is

Re: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Glynn Clements
Gabriel Ebner wrote: > > The RTS doesn't know the encoding. Assuming that the data will use the > > locale's encoding will be wrong too often. > > If the program wants to get bytes, it should get bytes explicitly, not > some sort of pseudo-Unicode String. Er, that's what I've been saying. And m

Re: [Haskell-cafe] Writing binary files?

2004-09-16 Thread Glynn Clements
Marcin 'Qrczak' Kowalczyk wrote: > >> When I switch my environment to UTF-8, which may happen in a few > >> years, I will convert filenames to UTF-8 and set up mount options to > >> translate vfat filenames to/from UTF-8 instead of to ISO-8859-2. > > > > But what about files which were been creat

Re: [Haskell-cafe] Writing binary files?

2004-09-16 Thread Marcin 'Qrczak' Kowalczyk
Glynn Clements <[EMAIL PROTECTED]> writes: > But this seems to be assuming a closed world. I.e. the only files > which the program will ever see are those which were created by you, > or by others who are compatible with your conventions. Yes, unless you set the default encoding to Latin1. >> So

Re: [Haskell-cafe] Re: Writing binary files?

2004-09-16 Thread Glynn Clements
Gabriel Ebner wrote: > >> 3. The default encoding is settable from Haskell, defaults to > >>ISO-8859-1. > > > > Agreed. > > So every haskell program that did more than just passing raw bytes > From stdin to stdout should decode the appropriate environment > variables, and set the encoding by

Re: [Haskell-cafe] Layered I/O

2004-09-16 Thread Marcin 'Qrczak' Kowalczyk
[EMAIL PROTECTED] writes: > The discussion of i18n i/o highlighted the need for general overlay > streams. We should be able to place a processing layer onto a handle > -- and to peel it off and place another one. The layers can do > character encoding, subranging (limiting the stream to the speci

Re: [Haskell-cafe] FilePath handling [Was: Writing binary files?]

2004-09-16 Thread Henning Thielemann
On Wed, 15 Sep 2004, Glynn Clements wrote: > Henning Thielemann wrote: > > > I even plead for an abstract data type FilePath which supports operations > > like 'enter a directory', 'go one level higher' and so on. > > Are you referring to "pure" operations on the FilePath, e.g. appending > and