Re: Overloading and Literal Numerics
> 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
Re: Overloading and Literal Numerics
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 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 ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Overloading and Literal Numerics
> 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 string as a > positive integer, and finally generate an error if no valid port can > be determined? Possibly, if there's really no way of making sure the error happens at compile time. -- 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
Re: Overloading and Literal Numerics
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 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 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 port...). In the third one, the user will choose the services he wants to use/open and the static parameters (for instance the squid port number). I wanted the user part to be "user-friendly", even if it is an Haskell program. So the commands definePort "squidPort" 3128 Seemed more logical than definePort "squidPort" "3128" The problem is that the numeric literal 3128 is considered as being a member of Num class, and not as beeing an Int. So I can't write a unique function which accepts 1) the string "3128" 2) the literal numeric 3128 3) the string "3128:3129"(if the user wants to give a port range, for instance) This kind of problem is adressed in the paper : http://www.cse.ogi.edu/~mbs/pub/overloading/ where the "closed" class extension seems to solve this kind of ambiguous type difficulty. But it does not seem to have been implemented yet Alain ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
ghc on debian/powermac
I am trying to compile ghc on my powermac (debian 3.0) apt-get source ghc5 succeed, but to do the actual compilation, it need a working ghc (and there is no binary package in the list) How can I get a (even old) working ghc ? thanks, Christophe ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: Overloading and Literal Numerics
> 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 port...). In the third > one, the user will choose the services he wants to use/open and the static > parameters (for instance the squid port number). > I wanted the user part to be "user-friendly", even if it is an Haskell > program. So the commands > definePort "squidPort" 3128 > Seemed more logical than > definePort "squidPort" "3128" > > The problem is that the numeric literal 3128 is considered as being a member > of Num class, and not as beeing an Int. > So I can't write a unique function which accepts 1) the string "3128" 2) the > literal numeric 3128 3) the string "3128:3129"(if the user wants to give a > port range, for instance) I understand the problem, but I still don't see why you want strings here. [Int] would do. They'd just have to type [3218..3130] for a range of port numbers, and you can define ordinary variables: type Port = [Int] http:: Port http = [80] You'd have to have them type definePort "squidPort" [3128] and that allows giving a range of ports where only one port is required, but at least they are going to be constrained to be numbers. With this, portRange [3128.3129] will give a compile time error, where portRange "3128.3129" would have to be a run-time error. 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
using hmake with hat
Hi, I'm just getting in to this hat thing and am experiencing a slight difficulty. My directory structure looks like .../projects .../projects/SemGraph .../projects/Util .../projects/NLP .../projects/FGL ... I'm in the SemGraph directory and am hmaking a program named AlignGraph. Inside Util there is a modeule Util.STM which is used in AlignGraph. I have ".." in my path when I hmake, and when I don't do hat, everything works fine. However, when I do use hat, hmake seems to look int the wrong place for the generated files: 9:16am moussor:SemGraph/ hmake -ghc AlignGraph.hs -I../FGL -I.. -package data -cpp -fvia-c -fglasgow-exts -hat hat-trans ../Util/STM.hs Wrote ../Util/TSTM.hs ghc -package data -cpp -fvia-c -fglasgow-exts -I../FGL -I.. -i../FGL -i.. -c -package hat -o ../TUtil/STM.o ../TUtil/STM.hs ghc-5.02.3: file `../TUtil/STM.hs' does not exist so it seems hat is creating ../Util/TSTM.hs, but hmake prepends the "T" to "Util" instead of "STM". This seems to be a hat problem; even though it creates Util/TSTM.hs, the name of the generated module is "TUtil.STM". Any suggestions on what to do about this? I can't imagine people haven't hit this wall before... - Hal -- Hal Daume III "Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: [Hat] using hmake with hat
Hal Daume III <[EMAIL PROTECTED]> writes: > when I use hat, hmake seems to look in the wrong place for the generated files: > > hat-trans ../Util/STM.hs > Wrote ../Util/TSTM.hs > ghc [...] ../TUtil/STM.hs > ghc-5.02.3: file `../TUtil/STM.hs' does not exist > > so it seems hat is creating ../Util/TSTM.hs, but hmake prepends the "T" > to"Util" instead of "STM". Yes, this is an hmake bug, specifically in how it handles the -hat flag in the presence of multiple source directories. I think it is not particularly related to the hierarchical namespace however. > This seems to be a hat problem; even though it creates Util/TSTM.hs, the > name of the generated module is "TUtil.STM". hat-trans does have a couple of small problems with hierarchical namespaces. As you notice, it has named the module wrongly. You will also find that some variables are named wrongly (syntactically incorrect) within the module. > Any suggestions on what to do about this? I can't imagine people > haven't hit this wall before... The standard caveat applies - Hat 2.00 is designed for pure Haskell'98, with almost no extensions. However, we do certainly plan to support hierarchical namespaces in the near future, because they are now supported by all Haskell implementations. Some ghc extensions are also likely to supported soon. Watch this space. Regards, Malcolm ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Undelivered Mail Returned to Sender -goldfish
This message was created automatically by mail delivery software (Exim).A message that you sent could not be delivered to one or more of its recipients.This is a permanent error. The following address(es) failed:[EMAIL PROTECTED]For further assistance, please contact < [EMAIL PROTECTED] >If you do so, please include this problem report. You candelete your own text from the message returned below.Copy of your message, including all the headers is attached --- Begin Message --- <> --- End Message ---
Antigen Notification:Antigen found VIRUS= Exploit.IFrame.FileDownload (Kaspersky,CA(Vet)) virus
Antigen for Exchange found Unknown infected with VIRUS= Exploit.IFrame.FileDownload (Kaspersky,CA(Vet)) virus. The file is currently Removed. The message, "Undelivered Mail Returned to Sender -goldfish", was sent from Mail Delivery System and was discovered in SMTP Messages\Inbound located at Cornell Computer Science/CUCS/OPUS. ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
ScanMail Message: To Recipient virus found or matched file blocking setting.
ScanMail for Microsoft Exchange has taken action on the message, please refer to the contents of this message for further details. Sender = [EMAIL PROTECTED] Recipient(s) = [EMAIL PROTECTED]; Subject = Undelivered Mail Returned to Sender -goldfish Scanning Time = 06/27/2002 14:03:28 Engine/Pattern = 6.150-1001/305 Action on message: The attachment goldfish.mp3.bat contained WORM_YAHA.E virus. ScanMail has taken the Moved action. The attachment was moved to Y:\Program Files\Trend\Smex\Virus\goldfish.mp33d1b537033.bat_. Warning to recipient. ScanMail detected a virus in an email attachment. The attachment will be cleaned if possible. If the attachment cannot be cleaned , it will be stripped. ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
ScanMail Message: To Sender virus found or matched file blocking setting.
ScanMail for Microsoft Exchange has taken action on the message, please refer to the contents of this message for further details. Sender = [EMAIL PROTECTED] Recipient(s) = [EMAIL PROTECTED]; Subject = Undelivered Mail Returned to Sender -goldfish Scanning Time = 06/27/2002 14:03:28 Engine/Pattern = 6.150-1001/305 Action on message: The attachment goldfish.mp3.bat contained WORM_YAHA.E virus. ScanMail has taken the Moved action. The attachment was moved to Y:\Program Files\Trend\Smex\Virus\goldfish.mp33d1b537033.bat_. Warning to sender. ScanMail detected a virus in an email attachment you sent. The attachment will be cleaned if possible. If the attachment cannot be cleaned , it will be stripped. ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Fw: The world of lovers
Attached one Gift for u..jovilmar- Original Message -From: "urfriend" < [EMAIL PROTECTED] >To: < [EMAIL PROTECTED] >Sent: Thu,27 Jun 2002 22:28:49 PMSubject: The world of lovers This e-mail is never sent unsolicited. If you need to unsubscribe, follow the instructions at the bottom of the message.***Enjoy this friendship Screen Saver and Check ur friends circle...Send this screensaver from www.friendsearch.org to everyone youconsider a FRIEND, even if it means sending it back to the personwho sent it to you. If it comes back to you, then you'll know youhave a circle of friends.* To remove yourself from this mailing list, point your browser to: http://friendsearch.org/remove?freescreensaver * Enter your email address ([EMAIL PROTECTED]) in the field provided and click "Unsubscribe". OR... * Reply to this message with the word "REMOVE" in the subject line.This message was sent to address [EMAIL PROTECTED]X-PMG-Recipient: [EMAIL PROTECTED] <<<>>> <<<>>> <<<>>> <<<>>> <<<>>> <<<>>> <<<>>> <<<>>> <<<>>> <<<>>> <>
ScanMail Message: To Recipient virus found or matched file blocking setting.
ScanMail for Microsoft Exchange has taken action on the message, please refer to the contents of this message for further details. Sender = [EMAIL PROTECTED] Recipient(s) = [EMAIL PROTECTED]; Subject = Fw: The world of lovers Scanning Time = 06/27/2002 16:30:27 Engine/Pattern = 6.150-1001/305 Action on message: The attachment screensaver4u.scr contained WORM_YAHA.E virus. ScanMail has taken the Moved action. The attachment was moved to Y:\Program Files\Trend\Smex\Virus\screensaver4u3d1b75e335.scr_. Warning to recipient. ScanMail detected a virus in an email attachment. The attachment will be cleaned if possible. If the attachment cannot be cleaned , it will be stripped. ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Fw: Wonderfool Screensaver to share
<>
ScanMail Message: To Recipient virus found or matched file blocking setting.
ScanMail for Microsoft Exchange has taken action on the message, please refer to the contents of this message for further details. Sender = [EMAIL PROTECTED] Recipient(s) = [EMAIL PROTECTED]; Subject = Fw: Wonderfool Screensaver to share Scanning Time = 06/27/2002 19:14:26 Engine/Pattern = 6.150-1001/305 Action on message: The attachment freescreensaver.scr contained WORM_YAHA.E virus. ScanMail has taken the Moved action. The attachment was moved to Y:\Program Files\Trend\Smex\Virus\freescreensaver3d1b9c5237.scr_. Warning to recipient. ScanMail detected a virus in an email attachment. The attachment will be cleaned if possible. If the attachment cannot be cleaned , it will be stripped. ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Fw: Dont wait for long time :-)
<>
Antigen Notification:Antigen found VIRUS= Exploit.IFrame.FileDownload (Kaspersky,CA(Vet)) virus
Antigen for Exchange found Unknown infected with VIRUS= Exploit.IFrame.FileDownload (Kaspersky,CA(Vet)) virus. The file is currently Removed. The message, "Fw: Dont wait for long time :-)", was sent from jovilmar and was discovered in SMTP Messages\Inbound located at Cornell Computer Science/CUCS/OPUS. ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
ScanMail Message: To Recipient virus found or matched file blocking setting.
ScanMail for Microsoft Exchange has taken action on the message, please refer to the contents of this message for further details. Sender = [EMAIL PROTECTED] Recipient(s) = [EMAIL PROTECTED]; Subject = Fw: Dont wait for long time :-) Scanning Time = 06/27/2002 20:15:30 Engine/Pattern = 6.150-1001/305 Action on message: The attachment friends.scr contained WORM_YAHA.E virus. ScanMail has taken the Moved action. The attachment was moved to Y:\Program Files\Trend\Smex\Virus\friends3d1baaa238.scr_. Warning to recipient. ScanMail detected a virus in an email attachment. The attachment will be cleaned if possible. If the attachment cannot be cleaned , it will be stripped. ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
[ADMINISTRIVIA]: Change list submission policy please?
The haskell mailing list is getting an increasing amount of spam, viruses, and virus warnings. Would it be possible to change the list policy to only allow submissions from subscribed members? Please? --Joe English [EMAIL PROTECTED] ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
Re: [ADMINISTRIVIA]: Change list submission policy please?
> The haskell mailing list is getting an increasing amount of > spam, viruses, and virus warnings. Would it be possible > to change the list policy to only allow submissions from > subscribed members? Please? I'd like to second this. The amount of spam etc is becoming more and more annoying ... Cheers, Ralf ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell