> 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 might be able to
help.  I can't see why you want to allow Strings, which have
far too wide a range of values, as arguments to something
that takes a port designator as an argument.

data Port = Tcpmux | Nbp | Echo_ddp | Rje | Zip | Echo_tcp | ...
             deriving Enum, ...

instance Num Port where ...

would seem like a better way to me.

  Jón

-- 
Jón Fairbairn                                 [EMAIL PROTECTED]
31 Chalmers Road                                         [EMAIL PROTECTED]
Cambridge CB1 3SZ            +44 1223 570179 (after 14:00 only, please!)


_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to