UniCode

2001-10-05 Thread Krasimir Angelov

Why Char is 32 bit. UniCode characters is 16 bit.

__
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



scope in ghci

2001-10-05 Thread S.D.Mechveliani

Dear GHC,

Consider the following question concerning scopes in  
ghc -interpreted. 

A large application called  D  consists of 70 modules, 
it reexports all its public items via module  DExport.
It has also demonstration examplesDm1.hs ... Dm9.hs.
Each example imports 4-5 modules from  D
and lists precisely the imported items, like this:
import List (sort) 
import Foo1 (f, g, Dt(..)) 

There also exists the total  Dm.hs  which reexports   
Dm1 ... Dm9  and adds the total `test' function.

All this compiles successfully (Dm* may skip compilation).

Then,  ghci -package D  Dm1
   ...
   Dm1 sort $ dm1 [1%2,1%3]-- contrived example
is impossible.
Instead, it needs
Dm1 List.sort Prelude.$ dm1 [1 Ratio.% 2, 1 Ratio.% 3]

Also the user is expected to command :m DExport
and work with other modules than  Dm*.

I try to improve this as follows. Add

  (...module Prelude, module List, module Ratio, module Random...)

  import Prelude; import List; import Ratio; import Random;

to  DExport.hs
and replace the import part in  Dm1.hs ... Dm9.hs
with
   import DExport

Formally, everything works. But I doubt.
DExport imports and exports so many things that it looks natural 
to add all the standard Haskell library to it.
But the imports of  Dm1.hs ... Dm9.hs  are different.
I wonder, what is the difference between
 M.hs:  ...import Foo (f,g)
and  N.hs:  ...import DExport 

First, suppose  M.hs  contains name clashes with  DExport  
and wants to avoid qualified names.
Second, when compiling  M.hs  the name search is smaller
(would it compile any essentially faster?). 
Third, how GHC will react at :load Dm
?
By occasion, would not it load 9 copies of DExport ?
Shortly: is this all right to set  import DExport
to all the above  Dm* ?

Thanks to everyone for possible advice.

-
Serge Mechveliani
[EMAIL PROTECTED]







___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



what is :a

2001-10-05 Thread S.D.Mechveliani


Who would tell, please, what is the real difference between
:load  and  :add  in  ghci-5.02 ?

Thank you in advance for explanation.

-
Serge Mechveliani
[EMAIL PROTECTED]

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: scope in ghci

2001-10-05 Thread Marcin 'Qrczak' Kowalczyk

Fri, 05 Oct 2001 15:14:15 +0400, S.D.Mechveliani [EMAIL PROTECTED] pisze:

Dm1 sort $ dm1 [1%2,1%3]-- contrived example
 is impossible.
 Instead, it needs
 Dm1 List.sort Prelude.$ dm1 [1 Ratio.% 2, 1 Ratio.% 3]

This happens when the module Dm1 is compiled. It's because a compiled
module doesn't provide the information which names were in scope in
its source.

Perhaps ghc should use the .o/.hi files for execution and parse its
.hs for getting this information if it's set as the current module.

-- 
 __(  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/
  ^^  SYGNATURA ZASTÊPCZA
QRCZAK


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: UniCode

2001-10-05 Thread Ketil Malde

Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] writes:

 Fri, 5 Oct 2001 02:29:51 -0700 (PDT), Krasimir Angelov [EMAIL PROTECTED] pisze:
 
  Why Char is 32 bit. UniCode characters is 16 bit.

 No, Unicode characters have 21 bits (range U+..10).

We've been through all this, of course, but here's a quote:

 Unicode originally implied that the encoding was UCS-2 and it
 initially didn't make any provisions for characters outside the BMP
 (U+ to U+). When it became clear that more than 64k
 characters would be needed for certain special applications
 (historic alphabets and ideographs, mathematical and musical
 typesetting, etc.), Unicode was turned into a sort of 21-bit
 character set with possible code points in the range U- to
 U-0010. The 2×1024 surrogate characters (U+D800 to U+DFFF) were
 introduced into the BMP to allow 1024×1024 non-BMP characters to be
 represented as a sequence of two 16-bit surrogate characters. This
 way UTF-16 was born, which represents the extended 21-bit Unicode
 in a way backwards compatible with UCS-2. The term UTF-32 was
 introduced in Unicode to mean a 4-byte encoding of the extended
 21-bit Unicode. UTF-32 is the exact same thing as UCS-4, except
 that by definition UTF-32 is never used to represent characters
 above U-0010, while UCS-4 can cover all 231 code positions up to
 U-7FFF.

from a/the Unicode FAQ at http://www.cl.cam.ac.uk/~mgk25/unicode.html

Does Haskell's support of Unicode mean UTF-32, or full UCS-4?
Recent messages seem to indicate the former, but I don't see any
reason against the latter.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



scope in ghci

2001-10-05 Thread S.D.Mechveliani

To my 

 [..]
Dm1 sort $ dm1 [1%2,1%3]-- contrived example
 is impossible.
 Instead, it needs
 Dm1 List.sort Prelude.$ dm1 [1 Ratio.% 2, 1 Ratio.% 3]

Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] writes

 This happens when the module Dm1 is compiled. It's because a compiled
 module doesn't provide the information which names were in scope in
 its source.
 [..]


In this particular experiment  Dm1 ... Dm9  were *interpreted* 
and the rest  D  project was compiled and loaded as object code 
from library via package.
But the case of compiled  Dm1  is sufficient too to present certain
small question.

-
Serge Mechveliani
[EMAIL PROTECTED]






___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: UniCode

2001-10-05 Thread Andrew J Bromage

G'day all.

On Fri, Oct 05, 2001 at 02:29:51AM -0700, Krasimir Angelov wrote:

 Why Char is 32 bit. UniCode characters is 16 bit.

It's not quite as simple as that.  There is a set of one million
(more correctly, 1M) Unicode characters which are only accessible
using surrogate pairs (i.e. two UTF-16 codes).  There are currently 
none of these codes assigned, and when they are, they'll be extremely
rare.  So rare, in fact, that the cost of strings taking up twice the
space that the currently do simply isn't worth the cost.

However, you still need to be able to handle them.  I don't know what
the official Haskell reasoning is (it may have more to do with word
size than Unicode semantics), but it makes sense to me to store single
characters in UTF-32 but strings in a more compressed format (UTF-8 or
UTF-16).

See also: http://www.unicode.org/unicode/faq/utf_bom.html

It just goes to show that strings are not merely arrays of characters
like some languages would have you believe.

Cheers,
Andrew Bromage

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: UniCode

2001-10-05 Thread Marcin 'Qrczak' Kowalczyk

Fri, 5 Oct 2001 23:23:50 +1000, Andrew J Bromage [EMAIL PROTECTED] pisze:

 There is a set of one million (more correctly, 1M) Unicode characters
 which are only accessible using surrogate pairs (i.e. two UTF-16
 codes).  There are currently none of these codes assigned,

This information is out of date. AFAIR about 4 of them is assigned.
Most for Chinese (current, not historic).

 So rare, in fact, that the cost of strings taking up twice the
 space that the currently do simply isn't worth the cost.

In Haskell strings already have high overhead. In GHC a Char# value
(inside Char object) always takes the same size as the pointer
(32 or 64 bits), no matter how much of it is used.

 It just goes to show that strings are not merely arrays of characters
 like some languages would have you believe.

In Haskell String = [Char]. It's true that Char values don't
necessarily correspond to glyphs, but Strings are composed of Chars.

-- 
 __(  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/
  ^^  SYGNATURA ZASTÊPCZA
QRCZAK


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: UniCode

2001-10-05 Thread Marcin 'Qrczak' Kowalczyk

05 Oct 2001 14:35:17 +0200, Ketil Malde [EMAIL PROTECTED] pisze:

 Does Haskell's support of Unicode mean UTF-32, or full UCS-4?

It's not decided officially. GHC uses UTF-32. It's expected that
UCS-4 will vanish and ISO-10646 will be reduced to the same range
U+..10 as Unicode.

-- 
 __(  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/
  ^^  SYGNATURA ZASTÊPCZA
QRCZAK


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: hdirect and ghc 5.02

2001-10-05 Thread Sigbjorn Finne

Try http://www.galconn.com/~sof/hdirect-0.18-src.tar.gz 

(src dist built about a month ago).

--sigbjorn

- Original Message - 
From: Sven Eric Panitz [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 04, 2001 06:14
Subject: hdirect and ghc 5.02


 
 Just a short question:
 
 is there a ghc 5.02 compatible distribution of hdirect available?
 
 Sven Eric
 
 
 -- 
 __
 Sven Eric Panitz Uhlandstr. 12   D-64297 Darmstadt
 Software AG   [EMAIL PROTECTED] (+49)6151-92-1426 
 ---  when I cannot sing my heart, I can only speak my mind ---
 
 
 ___
 Glasgow-haskell-users mailing list
 [EMAIL PROTECTED]
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



How to read heap Profile?

2001-10-05 Thread Saswat Anand


Hi,
  Ghc doc does not say much about how to read the heap profile (.hp
file). Could somebody explain. And how can one tell from the graph
generated by hp2ps if the program has space leak.

Thanks,
Saswat 


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: How to read heap Profile?

2001-10-05 Thread Ken Shan

On 2001-10-06T12:46:38+0800, Saswat Anand wrote:
   Ghc doc does not say much about how to read the heap profile (.hp
 file). Could somebody explain. And how can one tell from the graph
 generated by hp2ps if the program has space leak.

Check out Colin Runciman's papers at
http://www.dcs.gla.ac.uk/jfp/bibliography/Authors/runcimancolin.html ,
in particular Heap profiling of lazy functional programs.

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
oko za oko, pasta za zube
876



msg02726/pgp0.pgp
Description: PGP signature