[GHC5] Creating Socket.PortNumber from Int?

2001-06-06 Thread Volker Stolz

Until 5.00 I could use mkPortNumber to get what I want, i.e.
  PortNumber (mkPortNumber port)
Now in 5.01, this function now longer exists.
(PortNumber 5) works, but (PortNumber (5::Int)) does not, so I
have to use "fromIntegral" to get it to work again:
  PortNumber (fromIntegral (5::Int))

I suppose I'm missing something essential here, as there must be a 
better way of doing it when passing a variable of type Int.
-- 
Abstrakte Syntaxträume.
Volker Stolz * [EMAIL PROTECTED] * PGP + S/MIME

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



RE: [GHC5] Creating Socket.PortNumber from Int?

2001-06-06 Thread Simon Marlow

> Until 5.00 I could use mkPortNumber to get what I want, i.e.
>   PortNumber (mkPortNumber port)
> Now in 5.01, this function now longer exists.
> (PortNumber 5) works, but (PortNumber (5::Int)) does not, so I
> have to use "fromIntegral" to get it to work again:
>   PortNumber (fromIntegral (5::Int))
> 
> I suppose I'm missing something essential here, as there must be a 
> better way of doing it when passing a variable of type Int.

Think of it this way: mkPortNumber has been renamed to fromIntegral, and
now supports making port numbers from any integral type, not just Int.
I didin't see the need for a special purpose convesion from Int, when
fromIntegral does the job in a much more general way.  

Besides, using fromIntegral as a general-purpose integral converter is
becoming standard practice now that we can optimise it well.

Cheers,
Simon


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



ghc5 --make question

2001-06-06 Thread Volker Stolz

Hi, I'm trying to generate automatic makefiles for my project using --make.
Unluckily it seems ghc prefers .hs over .hi. The programs require a fair
amount of separate libraries (Tcl/Tk, a Concurrent Haskell Debugger, a
network wrapper,...) which I currently don't have to care much about:
I just have to provide the corresponding top-level .hi and some .a-files to
the ghc command line for compiling.

Is there any way to use ghc --make without having to provide access to all
of the *source* files and make it use the pre-compiled stuff?
-- 
Abstrakte Syntaxträume.
Volker Stolz * [EMAIL PROTECTED] * PGP + S/MIME

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



Re: [GHC5] Creating Socket.PortNumber from Int?

2001-06-06 Thread Volker Stolz

In local.glasgow-haskell-users, you wrote:
>Think of it this way: mkPortNumber has been renamed to fromIntegral, and
>now supports making port numbers from any integral type, not just Int.
>I didin't see the need for a special purpose convesion from Int, when
>fromIntegral does the job in a much more general way.  

Okay, here a nice way to handle this:

#if __GLASGOW_HASKELL__ >= 501
 mkPortNumber = fromIntegral
#endif
-- 
Abstrakte Syntaxträume.
Volker Stolz * [EMAIL PROTECTED] * PGP + S/MIME

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



RE: ghc5 --make question

2001-06-06 Thread Simon Marlow

> Hi, I'm trying to generate automatic makefiles for my project 
> using --make.
> Unluckily it seems ghc prefers .hs over .hi. The programs 
> require a fair
> amount of separate libraries (Tcl/Tk, a Concurrent Haskell Debugger, a
> network wrapper,...) which I currently don't have to care much about:
> I just have to provide the corresponding top-level .hi and 
> some .a-files to
> the ghc command line for compiling.
> 
> Is there any way to use ghc --make without having to provide 
> access to all
> of the *source* files and make it use the pre-compiled stuff?

Yup, you have to put your pre-compiled stuff in a package.

It's a bug in 5.00.1 that it requires the source file; I've fixed it
properly in the HEAD as part of the library story, but it almost
certainly won't be backported.

Cheers,
Simon

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



size of interpreted code

2001-06-06 Thread S.D.Mechveliani

Dear  ghc-5.00.1,

I wonder: is the interpreted code generally expected to be 
larger than compiled to  .o ?
I have certain Foo project which under  ghc-4.08  had:

  compiled Foo + compiled demo examples make  Foo-Demo.a  of 10Mb,
  and this all load and run on 32Mb RAM computer inside RAM
  (probably, 15Mb will remain for heap).

With  ghc-5.00.1, 
  the compiled   Foo.a, Foo.o  are each of  7Mb,
  ghci -package foo ...
  Prelude> :l T_
  loads the interpreted demo examples (importing Foo.o),
  and this needs more than 45Mb heap.

Recalling that  ghci  does not like strict polymorphic data fields, 
I add that the compiled part has the strict polymorphic fields like   

D !a !(a -> a),

but the interpreted demo programs do not have strict fields.


-
Serge Mechveliani
[EMAIL PROTECTED]

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



RE: size of interpreted code

2001-06-06 Thread Simon Marlow

> With  ghc-5.00.1, 
>   the compiled   Foo.a, Foo.o  are each of  7Mb,
>   ghci -package foo ...
>   Prelude> :l T_
>   loads the interpreted demo examples (importing Foo.o),
>   and this needs more than 45Mb heap.

As we've mentioned before, GHCi has some memory leaks.  This is on the
list of things to investigate, but we haven't got around to it yet.

Cheers,
Simon

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



Re: [GHC5] Creating Socket.PortNumber from Int?

2001-06-06 Thread Marcin 'Qrczak' Kowalczyk

Wed, 6 Jun 2001 10:17:34 +0100, Simon Marlow <[EMAIL PROTECTED]> pisze:

> Think of it this way: mkPortNumber has been renamed to fromIntegral, and
> now supports making port numbers from any integral type, not just Int.

BTW, why PortNumber is not just Int?

-- 
 __("<  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



Ambiguos Types

2001-06-06 Thread Saswat Anand

Hi,
  I have 2 questions:

1- When I load the following module:

module Foo() where
default (Float)

into ghci. 2+3 gives (5::Integer). Should it not give (5.0::Float). Hugs
does.

2. class Op a where
  (%+) :: a -> a -> a

   instance Op Integer where
 (%+) = (+)

   with the above code:  (2 %+ 3) should be resolved to Integer type. Could
anybody explain why it should not.

Thanks,
S

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