Overloading and Literal Numerics

Ketil Z. Malde ketil@ii.uib.no
27 Jun 2002 11:44:31 +0200


Jon Fairbairn <Jon.Fairbairn@cl.cam.ac.uk> writes:

> data Port = Tcpmux | Nbp | Echo_ddp | Rje | Zip | Echo_tcp | ...
>              deriving Enum, ...
> instance Num Port where ...

Or, alternatively, just use Strings, and have a portFromString first
check /etc/services for a match, then try to parse the string as a
positive integer, and finally generate an error if no valid port can
be determined?

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