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

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

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 * stolz@i2.informatik.rwth-aachen.de * PGP + S/MIME
participants (2)
-
Simon Marlow
-
Volker Stolz