Hi,
I am trying to create an overloaded function à la Java to be able to
call it either with a string or a number.
Ex :
definePort http
definePort 80
but I have problem with restrictions in Haskell's type system
Is there a better solution ?
If we knew /why/ you wanted to do this we
Jon Fairbairn [EMAIL PROTECTED] 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
Jon Fairbairn wrote :
Hi,
I am trying to create an overloaded function à la Java to be able to
call it either with a string or a number.
Ex :
definePort http
definePort 80
but I have problem with restrictions in Haskell's type system
Is there a better solution ?
If we knew /why/ you
Alain Cremieux wrote:
I am trying to build a functional firewall generator. The first part
describes the available protections (kernel, anti-address spoofing, etc.).
The second desribes every protocol, and the necessary rules if the
corresponding service is enabled (e.g. open the http
The problem is that you might have:
instance Poly Double where ...
and then when you say:
po 5
it doesn't know whether this is an Int or a Double.
writing
po (5::Int)
should be sufficient.
--
Hal Daume III
Computer science is no more about computers| [EMAIL PROTECTED]
than