Networking : PortNumber

Simon Marlow
Tue, 3 Jun 2003 11:22:20 +0100

> Sorry,
> I've just worked it out.
> PortNumber is an instance of the class Enum
> so we can use
>  toEnum :: Int -> a

It's also an instance of the Integral class, which means you can just
write integral constants of type PortNumber.  eg. (80 :: PortNumber) is
valid.  Also, the universal integral conversion function 'fromIntegral'
can be used for converting values of other integral types into
PortNumbers (this is preferable to toEnum).