Re: [Haskell-cafe] A thought on the LinkedIn spam and an upstream spam filter
Hi, Thanks for the heads-up. I have just checked my email addresses registered on linkedin: I had three of them, my regular email address (this one), me previous work address, which I never added myself, and haskell-cafe, which I did not add myself either. My regular address was labeled as primary, the haskell-cafe not, and a link to confirm my work address was visible next to it, but not for haskell-cafe. Looking up in my emails, I have indeed received twice on invitation from the same person, once to my regular address, and once via haskell-cafe. The fact it was via haskell-cafe was not visible in gmail interface. I have removed the hasell-cafe and my previous work addresses. I don't think I have done something wrong (and I guess LinkedIn did), but anyway, sorry for the inconvenience. Thanks, Thu 2013/9/23 damodar kulkarni kdamodar2...@gmail.com Hello, Sorry for dwelling on a spammy topic. If you are NOT interested in this then please accept my regret and let me assure you that this is NOT to add to the existing spam. If you still are unconvinced, then the only thing I can tell you is sorry, accept my apologies for wasting your time and please stop reading further. Okay, here is what I thought of it. Yesterday I sent a mail as a response to a spam from LinkedIn to the cafe. I don't know how, but part of my mail text was missing. (I must have pressed Ctrl-C instead of Ctrl-V to paste the text from another file.) I had thought of an idea which I call upstream spam filter. Anyway here is the text: I thought, some people here on the list, who might have links with the higher-ups at linked-in might bring the issue to their notice and would make them *register* the Haskell-Cafe list on their server so that they never send a spam to the entire list. They should install such an upstream spam filter. This upstream spam filter based solution would be more effective in culling spam as compared to solutions based on requesting/heckling individual linked-in subscribers to take some action at his/her end. Note that here the individual may or may not be doing intentional spamming BUT the linkedin is *hiding* behind the subscribers' ignorance. I propose that more *influential* people on the list demand that the linked-in company should provide a way to register some emails (e.g. mailing lists) which they SHOULD spare from their spamming machines. I have already tried communicating with them but was unsuccessful. Is there any DND like service, at least, to force these big companies (like linked-in), who are happily spamming the world, behave properly?[1] Please send such protest mails to the personal email ids of the linked-in (and other such companies) top brass or other linkedin top level technical staff, if you know them. If anybody on this list is working for linkedin, then this mail is for you too. [1] http://en.wikipedia.org/wiki/Do_Not_Disturb_%28telecommunications%29 Thanks and regards, -Damodar Kulkarni On Mon, Sep 23, 2013 at 12:43 AM, MigMit miguelim...@yandex.ru wrote: So, instead of emailing this guy and asking him to change the address in his LinkedIn profile (which is simple, since he did write a lot to café), you decided to continue spamming the mailing list. Nice Отправлено с iPad 22 сент. 2013 г., в 21:31, damodar kulkarni kdamodar2...@gmail.com написал(а): What a surprise, I didn't know the real name of Haskell Cafe till date, BUT today I came to know it: it is Minh Thu V. linked in sucks ... Thanks and regards, -Damodar Kulkarni On Sun, Sep 22, 2013 at 2:53 PM, Kyle Hanson via LinkedIn mem...@linkedin.com wrote: [image: LinkedIn] http://www.linkedin.com/e/uc6lxc-hlw276p4-5e/hom/?hs=falsetok=1F1OVFpS1PWlU1 Hi Minh Thu, I'd like to connect with you on LinkedIn. Accepthttp://www.linkedin.com/e/uc6lxc-hlw276p4-5e/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/blk/I943132921_20/1Bt6BSrCBTpmUJt71BoSdxbm8JrnpKqlZJrmZzbmNJpjRQnOpBtn9QfmhBt71BoSd1p65Lr6lOfP0OnP4Oej8PcjcQekALpQcJlDxQrDwLc3wRcP4Qc3gTdz4LrCBxbOYWrSlI/eml-comm_invm-b-accept-newinvite/?hs=falsetok=3WsXkZaBdPWlU1 View Profilehttp://www.linkedin.com/e/uc6lxc-hlw276p4-5e/rso/60831967/_LLG/name/22724543_I943132921_20/eml-comm_invm-b-profile-newinvite/?hs=falsetok=041BVcm2lPWlU1 http://www.linkedin.com/e/uc6lxc-hlw276p4-5e/rso/60831967/_LLG/name/22724543_I943132921_20/eml-comm_invm-b-photo-newinvite/?hs=falsetok=0kvDW_y0FPWlU1 Kyle Hansonhttp://www.linkedin.com/e/uc6lxc-hlw276p4-5e/rso/60831967/_LLG/name/22724543_I943132921_20/eml-comm_invm-b-name-newinvite/?hs=falsetok=2JMZQUFRhPWlU1 Engineer at eShares, Inc. Greater Chicago Area You are receiving Invitation emails. Unsubscribehttps://www.linkedin.com/e/uc6lxc-hlw276p4-5e/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/uns/20008/22724543/anmdibt9ekfs9vo/haskell-cafe%40haskell%2Eorg/uc6lxc-hlw276p4-5e/eml-comm_invm-f-unsub-inv28/?hs=falsetok=2n8GqjQ2lPWlU1. This email was intended for
Re: [Haskell-cafe] Proposal: New syntax for Haskell
The syntax is actually used by non-technical people to write tests. Using it to write Haskell code is a joke. (Using it for business specification is not, even if for technical people this seems overkill.) Thu 2013/9/10 Ian Ross i...@skybluetrades.net: Me too, but I wasn't brave enough to say so after people seemed to be taking it seriously... On 10 September 2013 13:33, Roman Cheplyaka r...@ro-che.info wrote: * John Wiegley jo...@fpcomplete.com [2013-09-10 04:48:36-0500] Niklas Hambüchen m...@nh2.me writes: Code written in cucumber syntax is concise and easy to read concise |kənˈsīs|, adj. giving a lot of information clearly and in a few words; brief but comprehensive. Compare: Scenario: Defining the function foldl Given I want do define foldl Which has the type (in brackets) a to b to a (end of brackets), to a, to list of b, to a And my arguments are called f, acc, and l When l is empty Then the result better be acc Otherwise l is x cons xs Then the result should be foldl f (in brackets) f acc x (end of brackets) xs To: foldl :: (a - b - a) - a - [b] - a foldl f z [] = z foldl f z (x:xs) = foldl f (f z x) xs How is that more concise or preferable? I thought it was a joke. Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ian Ross Tel: +43(0)6804451378 i...@skybluetrades.net www.skybluetrades.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dual-licensing the package on Hackage
2013/7/30 David Sorokin david.soro...@gmail.com: Hi, Cafe! Probably, it was asked before but I could not find an answer with help of Google. I have a library which is hosted on Hackage. The library is licensed under BSD3. It is a very specialized library for a small target group. Now I'm going to relicense it and release a new version already under the dual-license: GPLv3 and commercial. In most cases GPL will be sufficient as this is not a library in common sense. Can I specify the GPL license in the .cabal file, or should I write OtherLicense? I'm going to add the information about dual-licensing in the description section of the .cabal file, though. Although you can indeed license your software under different licences, in the case of your question it doesn't seem to be a concern with Hackage: The license displayed on Hackage is the one for the corresponding .cabal file (or at least I think it is). So you issue your new version with the changed license, the new version is available with the new license, the old versions are still available with the old license. Everything is fine. Now about the dual licensing. It seems it is again not a problem with Hackage: you are not granting through Hackage such a commercial license. I guess you provide it upon request (for some money). I.e. when I download your library from Hackage, I receive it under the terms of the BSD (or GPL) license you have chosen, not under a commercial license that I would have to receive through other means. Otherwise the semantic of the license field on Hackage would mean the library is available under such and such licenses, which are not granted to you when you download the library on Hackage. Only when you download the package you can actually find the licensing terms (e.g. in the LICENSE file). But this seems unlikely to me. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dual-licensing the package on Hackage
Well, if you are willing to grant me a GPL license when I download your package through Hackage, GPL is accurate. Again you are not providing me with another license. Obtaining a commercial license should be seeked through other means, perhaps by sending you an email. I don't think Hackage should be used for making adverts, but I think it would be ok to state in the description of the package something along the lines of commercial licenses are available through example.com. 2013/7/30 David Sorokin david.soro...@gmail.com: Thanks Thu, I agree with you. Just I don't know what to write in the license field of the .cabal file: GPL or OtherLicense. The both choices seem correct to me and misleading at the same time. Cheers, David 30.07.2013, в 12:53, Vo Minh Thu написал(а): 2013/7/30 David Sorokin david.soro...@gmail.com: Hi, Cafe! Probably, it was asked before but I could not find an answer with help of Google. I have a library which is hosted on Hackage. The library is licensed under BSD3. It is a very specialized library for a small target group. Now I'm going to relicense it and release a new version already under the dual-license: GPLv3 and commercial. In most cases GPL will be sufficient as this is not a library in common sense. Can I specify the GPL license in the .cabal file, or should I write OtherLicense? I'm going to add the information about dual-licensing in the description section of the .cabal file, though. Although you can indeed license your software under different licences, in the case of your question it doesn't seem to be a concern with Hackage: The license displayed on Hackage is the one for the corresponding .cabal file (or at least I think it is). So you issue your new version with the changed license, the new version is available with the new license, the old versions are still available with the old license. Everything is fine. Now about the dual licensing. It seems it is again not a problem with Hackage: you are not granting through Hackage such a commercial license. I guess you provide it upon request (for some money). I.e. when I download your library from Hackage, I receive it under the terms of the BSD (or GPL) license you have chosen, not under a commercial license that I would have to receive through other means. Otherwise the semantic of the license field on Hackage would mean the library is available under such and such licenses, which are not granted to you when you download the library on Hackage. Only when you download the package you can actually find the licensing terms (e.g. in the LICENSE file). But this seems unlikely to me. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dual-licensing the package on Hackage
Unless you want to provide multiple open source licenses, I don't see the point: Anybody that needs a commercial license (and has some money) will simply ask for such a commercial license when seeing that the code is available under GPL. Another reason it is pointless is that you will certainly not want to list all the commercial licenses you have used/will use with different clients (there are virtually infinite commercial licenses that you can invent as needs arise: per seat, per core, per year, and so on depending on the clients/projects). I.e. you don't need to state upfront that commercial licences exist (although I understand that you think it is better to advertise your willingness to provide such commercial license, but a comment is enough, the fact is that license is not provided through Hackage). 2013/7/30 Krzysztof Skrzętnicki gte...@gmail.com: Perhaps it would be best if .cabal allowed to have more than one license listed. Another solution would be to use custom field, for example: License: GPL x-Other-License: Commercial, see License-Commercial.txt All best, Krzysztof Skrzętnicki On Tue, Jul 30, 2013 at 11:44 AM, David Sorokin david.soro...@gmail.com wrote: Thanks Thu, I agree with you. Just I don't know what to write in the license field of the .cabal file: GPL or OtherLicense. The both choices seem correct to me and misleading at the same time. Cheers, David 30.07.2013, в 12:53, Vo Minh Thu написал(а): 2013/7/30 David Sorokin david.soro...@gmail.com: Hi, Cafe! Probably, it was asked before but I could not find an answer with help of Google. I have a library which is hosted on Hackage. The library is licensed under BSD3. It is a very specialized library for a small target group. Now I'm going to relicense it and release a new version already under the dual-license: GPLv3 and commercial. In most cases GPL will be sufficient as this is not a library in common sense. Can I specify the GPL license in the .cabal file, or should I write OtherLicense? I'm going to add the information about dual-licensing in the description section of the .cabal file, though. Although you can indeed license your software under different licences, in the case of your question it doesn't seem to be a concern with Hackage: The license displayed on Hackage is the one for the corresponding .cabal file (or at least I think it is). So you issue your new version with the changed license, the new version is available with the new license, the old versions are still available with the old license. Everything is fine. Now about the dual licensing. It seems it is again not a problem with Hackage: you are not granting through Hackage such a commercial license. I guess you provide it upon request (for some money). I.e. when I download your library from Hackage, I receive it under the terms of the BSD (or GPL) license you have chosen, not under a commercial license that I would have to receive through other means. Otherwise the semantic of the license field on Hackage would mean the library is available under such and such licenses, which are not granted to you when you download the library on Hackage. Only when you download the package you can actually find the licensing terms (e.g. in the LICENSE file). But this seems unlikely to me. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dual-licensing the package on Hackage
Again I haven't seen a reason to do what you propose: virtually every single GPL library author would gladly accept money for their work to be used in a closed source setting, no need to use OtherLicense to reach that effect. On the other hand, you will stop people interested in open source to look further into your project if they see OtherLicense instead of a well-known open-source license. 2013/7/30 David Sorokin david.soro...@gmail.com: I am inclined to use value OtherLicense but state in the description that the package is available either under GPL or a commercial license. The latter must be requested to me. Then there would be no required additional steps to use the package under GPL. Only the LICENSE file must be appropriate. Probably, I will need two files LICENSE and LICENSE-GPLv3. In the former I will have add my copyright and write in a simple form that the license is dual and everyone is free to use the library under GPLv3 (which is the main use case) according the terms provided in the corresponded second file. Thanks, David On 30.07.2013 13:57, Vo Minh Thu wrote: Unless you want to provide multiple open source licenses, I don't see the point: Anybody that needs a commercial license (and has some money) will simply ask for such a commercial license when seeing that the code is available under GPL. Another reason it is pointless is that you will certainly not want to list all the commercial licenses you have used/will use with different clients (there are virtually infinite commercial licenses that you can invent as needs arise: per seat, per core, per year, and so on depending on the clients/projects). I.e. you don't need to state upfront that commercial licences exist (although I understand that you think it is better to advertise your willingness to provide such commercial license, but a comment is enough, the fact is that license is not provided through Hackage). 2013/7/30 Krzysztof Skrzętnicki gte...@gmail.com: Perhaps it would be best if .cabal allowed to have more than one license listed. Another solution would be to use custom field, for example: License: GPL x-Other-License: Commercial, see License-Commercial.txt All best, Krzysztof Skrzętnicki On Tue, Jul 30, 2013 at 11:44 AM, David Sorokin david.soro...@gmail.com wrote: Thanks Thu, I agree with you. Just I don't know what to write in the license field of the .cabal file: GPL or OtherLicense. The both choices seem correct to me and misleading at the same time. Cheers, David 30.07.2013, в 12:53, Vo Minh Thu написал(а): 2013/7/30 David Sorokin david.soro...@gmail.com: Hi, Cafe! Probably, it was asked before but I could not find an answer with help of Google. I have a library which is hosted on Hackage. The library is licensed under BSD3. It is a very specialized library for a small target group. Now I'm going to relicense it and release a new version already under the dual-license: GPLv3 and commercial. In most cases GPL will be sufficient as this is not a library in common sense. Can I specify the GPL license in the .cabal file, or should I write OtherLicense? I'm going to add the information about dual-licensing in the description section of the .cabal file, though. Although you can indeed license your software under different licences, in the case of your question it doesn't seem to be a concern with Hackage: The license displayed on Hackage is the one for the corresponding .cabal file (or at least I think it is). So you issue your new version with the changed license, the new version is available with the new license, the old versions are still available with the old license. Everything is fine. Now about the dual licensing. It seems it is again not a problem with Hackage: you are not granting through Hackage such a commercial license. I guess you provide it upon request (for some money). I.e. when I download your library from Hackage, I receive it under the terms of the BSD (or GPL) license you have chosen, not under a commercial license that I would have to receive through other means. Otherwise the semantic of the license field on Hackage would mean the library is available under such and such licenses, which are not granted to you when you download the library on Hackage. Only when you download the package you can actually find the licensing terms (e.g. in the LICENSE file). But this seems unlikely to me. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Dual-licensing the package on Hackage
No. If I provide a library to you stating you can use it under the term of the GPL3, this does not prevent me from providing it to someone else under a different license (provided I have the rights to do so, for instance because I am the copyright owner). So as far as you're concerned (and this is the case with Hackage in this dicussion), the library is provided under the terms of the GPL. There is no point saying but if you pay me I can provide it under some other terms. 2013/7/30 Jan Stolarek jan.stola...@p.lodz.pl: I'd say OtherLicense because: data License = GPL3 is different from data License = Commercial | GPL3 I hope this analogy to Haskell data types is convincing :) Janek - Oryginalna wiadomość - Od: David Sorokin david.soro...@gmail.com Do: Vo Minh Thu not...@gmail.com DW: Haskell Cafe haskell-cafe@haskell.org Wysłane: wtorek, 30 lipiec 2013 11:46:00 Temat: Re: [Haskell-cafe] Dual-licensing the package on Hackage I am inclined to use value OtherLicense but state in the description that the package is available either under GPL or a commercial license. The latter must be requested to me. Then there would be no required additional steps to use the package under GPL. Only the LICENSE file must be appropriate. Probably, I will need two files LICENSE and LICENSE-GPLv3. In the former I will have add my copyright and write in a simple form that the license is dual and everyone is free to use the library under GPLv3 (which is the main use case) according the terms provided in the corresponded second file. Thanks, David On 30.07.2013 13:57, Vo Minh Thu wrote: Unless you want to provide multiple open source licenses, I don't see the point: Anybody that needs a commercial license (and has some money) will simply ask for such a commercial license when seeing that the code is available under GPL. Another reason it is pointless is that you will certainly not want to list all the commercial licenses you have used/will use with different clients (there are virtually infinite commercial licenses that you can invent as needs arise: per seat, per core, per year, and so on depending on the clients/projects). I.e. you don't need to state upfront that commercial licences exist (although I understand that you think it is better to advertise your willingness to provide such commercial license, but a comment is enough, the fact is that license is not provided through Hackage). 2013/7/30 Krzysztof Skrzętnicki gte...@gmail.com: Perhaps it would be best if .cabal allowed to have more than one license listed. Another solution would be to use custom field, for example: License: GPL x-Other-License: Commercial, see License-Commercial.txt All best, Krzysztof Skrzętnicki On Tue, Jul 30, 2013 at 11:44 AM, David Sorokin david.soro...@gmail.com wrote: Thanks Thu, I agree with you. Just I don't know what to write in the license field of the .cabal file: GPL or OtherLicense. The both choices seem correct to me and misleading at the same time. Cheers, David 30.07.2013, в 12:53, Vo Minh Thu написал(а): 2013/7/30 David Sorokin david.soro...@gmail.com: Hi, Cafe! Probably, it was asked before but I could not find an answer with help of Google. I have a library which is hosted on Hackage. The library is licensed under BSD3. It is a very specialized library for a small target group. Now I'm going to relicense it and release a new version already under the dual-license: GPLv3 and commercial. In most cases GPL will be sufficient as this is not a library in common sense. Can I specify the GPL license in the .cabal file, or should I write OtherLicense? I'm going to add the information about dual-licensing in the description section of the .cabal file, though. Although you can indeed license your software under different licences, in the case of your question it doesn't seem to be a concern with Hackage: The license displayed on Hackage is the one for the corresponding .cabal file (or at least I think it is). So you issue your new version with the changed license, the new version is available with the new license, the old versions are still available with the old license. Everything is fine. Now about the dual licensing. It seems it is again not a problem with Hackage: you are not granting through Hackage such a commercial license. I guess you provide it upon request (for some money). I.e. when I download your library from Hackage, I receive it under the terms of the BSD (or GPL) license you have chosen, not under a commercial license that I would have to receive through other means. Otherwise the semantic of the license field on Hackage would mean the library is available under such and such licenses, which are not granted to you when you download the library on Hackage. Only when you download the package you can actually find the licensing terms (e.g. in the LICENSE file). But this seems unlikely to me
Re: [Haskell-cafe] Dual-licensing the package on Hackage
Sorry but I was not discussing which license to use. It seems I cannot get my point across... 2013/7/30 David Sorokin david.soro...@gmail.com: This is already another question what license to use :) On 30.07.2013 14:56, Vo Minh Thu wrote: Again I haven't seen a reason to do what you propose: virtually every single GPL library author would gladly accept money for their work to be used in a closed source setting, no need to use OtherLicense to reach that effect. On the other hand, you will stop people interested in open source to look further into your project if they see OtherLicense instead of a well-known open-source license. 2013/7/30 David Sorokin david.soro...@gmail.com: I am inclined to use value OtherLicense but state in the description that the package is available either under GPL or a commercial license. The latter must be requested to me. Then there would be no required additional steps to use the package under GPL. Only the LICENSE file must be appropriate. Probably, I will need two files LICENSE and LICENSE-GPLv3. In the former I will have add my copyright and write in a simple form that the license is dual and everyone is free to use the library under GPLv3 (which is the main use case) according the terms provided in the corresponded second file. Thanks, David On 30.07.2013 13:57, Vo Minh Thu wrote: Unless you want to provide multiple open source licenses, I don't see the point: Anybody that needs a commercial license (and has some money) will simply ask for such a commercial license when seeing that the code is available under GPL. Another reason it is pointless is that you will certainly not want to list all the commercial licenses you have used/will use with different clients (there are virtually infinite commercial licenses that you can invent as needs arise: per seat, per core, per year, and so on depending on the clients/projects). I.e. you don't need to state upfront that commercial licences exist (although I understand that you think it is better to advertise your willingness to provide such commercial license, but a comment is enough, the fact is that license is not provided through Hackage). 2013/7/30 Krzysztof Skrzętnicki gte...@gmail.com: Perhaps it would be best if .cabal allowed to have more than one license listed. Another solution would be to use custom field, for example: License: GPL x-Other-License: Commercial, see License-Commercial.txt All best, Krzysztof Skrzętnicki On Tue, Jul 30, 2013 at 11:44 AM, David Sorokin david.soro...@gmail.com wrote: Thanks Thu, I agree with you. Just I don't know what to write in the license field of the .cabal file: GPL or OtherLicense. The both choices seem correct to me and misleading at the same time. Cheers, David 30.07.2013, в 12:53, Vo Minh Thu написал(а): 2013/7/30 David Sorokin david.soro...@gmail.com: Hi, Cafe! Probably, it was asked before but I could not find an answer with help of Google. I have a library which is hosted on Hackage. The library is licensed under BSD3. It is a very specialized library for a small target group. Now I'm going to relicense it and release a new version already under the dual-license: GPLv3 and commercial. In most cases GPL will be sufficient as this is not a library in common sense. Can I specify the GPL license in the .cabal file, or should I write OtherLicense? I'm going to add the information about dual-licensing in the description section of the .cabal file, though. Although you can indeed license your software under different licences, in the case of your question it doesn't seem to be a concern with Hackage: The license displayed on Hackage is the one for the corresponding .cabal file (or at least I think it is). So you issue your new version with the changed license, the new version is available with the new license, the old versions are still available with the old license. Everything is fine. Now about the dual licensing. It seems it is again not a problem with Hackage: you are not granting through Hackage such a commercial license. I guess you provide it upon request (for some money). I.e. when I download your library from Hackage, I receive it under the terms of the BSD (or GPL) license you have chosen, not under a commercial license that I would have to receive through other means. Otherwise the semantic of the license field on Hackage would mean the library is available under such and such licenses, which are not granted to you when you download the library on Hackage. Only when you download the package you can actually find the licensing terms (e.g. in the LICENSE file). But this seems unlikely to me. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell
Re: [Haskell-cafe] Promoting Haskell via Youtube movies
Certainly less entertaining but depending on your public, this one with FP Complete's Aaron Contorer can be valuable: http://www.youtube.com/watch?v=Fqi0Xu2Enaw 2013/6/17 Mihai Maruseac mihai.marus...@gmail.com Hi, I was wondering if we have similar movies for Haskell as https://www.youtube.com/watch?v=kLO1djacsfg and https://www.youtube.com/watch?v=E3418SeWZfQ exist for Java. I indend to give them to some people to make them intrigued by the language and start learning it / looking for it. -- MM All we have to decide is what we do with the time that is given to us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Testing invasive proposals with Hackager
2013/6/13 Joachim Breitner m...@joachim-breitner.de Hi, Am Donnerstag, den 13.06.2013, 09:59 +0800 schrieb Niklas Hambüchen: In many discussions we make guesses about how much code proposals like Functor = Monad would break. You can use https://github.com/dterei/Hackager to build all of Hackage (preferably in a VM). Of course many packages have external dependencies, so I'd like to share the following list of packages to save you some time. Great tool. Does someone have the resources to run it regularly (i.e. daily), dump the results and the diff-to-previous run somewhere and link the status (currently building/not building) on the hackage package? More CI-like data and testing is always good! I will give it a try in a few days, see if it is possible for me to do it daily. Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Testing invasive proposals with Hackager
2013/6/13 Vo Minh Thu not...@gmail.com 2013/6/13 Joachim Breitner m...@joachim-breitner.de Hi, Am Donnerstag, den 13.06.2013, 09:59 +0800 schrieb Niklas Hambüchen: In many discussions we make guesses about how much code proposals like Functor = Monad would break. You can use https://github.com/dterei/Hackager to build all of Hackage (preferably in a VM). Of course many packages have external dependencies, so I'd like to share the following list of packages to save you some time. Great tool. Does someone have the resources to run it regularly (i.e. daily), dump the results and the diff-to-previous run somewhere and link the status (currently building/not building) on the hackage package? More CI-like data and testing is always good! I will give it a try in a few days, see if it is possible for me to do it daily. Thu I just read this note on Hackager's README: For example, here is a run with GHC, no special options and using 4 threads (note that this generally takes a long time, i.e. a few days): ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Open-source projects for beginning Haskell students?
2013/3/11 Brent Yorgey byor...@seas.upenn.edu: Hi everyone, I am currently teaching a half-credit introductory Haskell class for undergraduates. This is the third time I've taught it. Both of the previous times, for their final project I gave them the option of contributing to an open-source project; a couple groups/individuals took me up on it and I think it ended up being a modest success. So I'd like to do it again this time around, and am looking for particular projects I can suggest to them. Do you have an open-source project with a few well-specified tasks that a relative beginner (see below) could reasonably make a contribution towards in the space of about four weeks? I'm aware that most tasks don't fit that profile, but even complex projects usually have a few simple-ish tasks that haven't yet been done just because no one has gotten around to it yet. If you have any such projects, I'd love to hear about it! Just send me a paragraph or so describing your project and explaining what task(s) you could use help with --- something that I could put on the course website for students to look at. Here are a few more details: * The students will be working on the projects from approximately the end of this month through the end of April. During the next two weeks they would be contacting you to discuss the possibility of working on your project. * By relative beginner I mean someone familiar with the material listed here: http://www.cis.upenn.edu/~cis194/lectures.html and just trying to come to terms with Applicative and Monad. They definitely do not know much if anything about optimization/profiling, GADTs, the mtl, or Haskell-programming-in-the-large. (Although part of the point of the project is to teach them a bit about programming-in-the-(medium/large)). * What I would hope from you is a willingness to exchange email and/or chat with the student(s) over the course of the project, to give them a bit of guidance/mentoring. I am certainly willing to help on that front, but of course I probably don't know much about your particular project. Maybe it is a too small project (and not a contribution to an existing project), but a Haskell wrapper around PostgreSQL setproctitle code would be nice (something similar exists in the Python world). Otherwise I have began some infrastructure projects on GitHub that are all pretty simple but could be damn useful: curved is meant to be a drop-in-replacement for graphite (it is almost the case), sentry is a process-monitoring tool, humming is a job queue on top of PostgreSQL, hlinode is a binding to the Linode API, ... They all have in common that they are small, self-contained, and quite often just massaging around rawSystem calls, database execute calls, or GET/POST calls. Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] layers: A prototypical 2d platform game
2013/2/19 Daniel Trstenjak daniel.trsten...@gmail.com: Hi Henk-Jan, It seems to me that there is something missing from this e-mail. What are you missing? Screenshots obviously ;) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] resources for learning Hindley-Milner type inference for undergraduate students
2013/1/18 Petr P petr@gmail.com: Dear Haskellers, could somebody recommend me study materials for learning Hindley-Milner type inference algorithm I could recommend to undergraduate students? The original paper is harder to understand, I'm looking for something more didactic. The students are familiar with the lambda calculus, natural deduction and System F. I think I really liked Cardelli's paper Basic Polymorphic Typechecking, 1987 HTH, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] DIY vs as-a-Service with MemCachier
2013/1/17 Jason Dusek jason.du...@gmail.com: 2013/1/17 Kazu Yamamoto k...@iij.ad.jp: The following blog post by Joyent is worth reading: http://joyent.com/blog/diy-vs-as-a-service-with-memcachier We don't really believe in Node.js (Go Haskell are our choices), so that is a small concern to us, but everyone has their failings. The post is on the Joyent blog; but was written by someone from MemCachier, a new partner with Joyent. MemCachier seems to have partnered with a few other cloud platforms -- Heroku, for example. It's nice to see a Bay Area cloud company speak up for Haskell. The person is David Terei, he's quite famous in the Haskell community for having written the LLVM backend for GHC. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] containers license issue
2012/12/12 Dmitry Kulagin dmitry.kula...@gmail.com: Hi Cafe, I am faced with unpleasant problem. The lawyer of my company checked sources of containers package and found out that it refers to some GPL-library. Here is quote: The algorithm is derived from Jorg Arndt's FXT library in file Data/IntMap/Base.hs The problem is that FXT library is GPL and thus containers package can not be considered as BSD3. And it means that it can not be used in my case (closed source software). Is this logic actually correct and containers should be considered as GPL? The package is widely used by other packages and the only way I see right now is to fix sources to reimplement this functionality, which is not good option. GPL covers code, not algorithms. Beside, you can use GPL in closed-source code. GPL forces you to make the source available when you distribute the software, but if you don't distribute the software, there is nothing wrong to use GPL and not make your code available. HTH, IANAL, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] containers license issue
I'm not sure what your point is. Re-implementing an algorithm is not a copyright infringement (nor is a propagation of the original work). Algorithms are not covered by copyright. 2012/12/12 Clark Gaebel cgae...@uwaterloo.ca: I think this is a potential problem, but, obviously, IANAL. [1] According to the GPL: To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. and You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. and of course You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). I believe that this counts as propagation of the original work, since it would be considered infringement under applicable copyright law. Now, the wording in the GPL is a bit confusing on this point. I'm not sure if propagation requires that the BSD3 that containers is licensed under must remain in force, or the GPL on which the which is derived must remain in force. Does anyone else have better luck interpreting this? - Clark [1] Aside: Can we stop saying IANAL? Let's just all assume that, until proven otherwise, no one here is a lawyer. [2] Required Reading: http://www.gnu.org/licenses/gpl.html On Wed, Dec 12, 2012 at 11:00 AM, David Thomas davidleotho...@gmail.com wrote: Right. If either of the following hold, you should be able to carry on as you were (but double check with your lawyer): 1) The algorithm is borrowed but the code was not copied. In this case, copyright doesn't cover it, and the GPL is inapplicable. (Patents could conceivably be an issue, but no more so than if it was BSD code). 2) If you are not going to be distributing the code - either it is used for internal tools or in the backend of a networked service (which the GPL does not treat as distribution, as distinct from the AGPL). If a sizable chunk of actual code was copied, then the containers package would have to be GPL, and if you are using the library and distribute programs built with it then those programs must be GPL as well. On Wed, Dec 12, 2012 at 7:47 AM, Vo Minh Thu not...@gmail.com wrote: 2012/12/12 Dmitry Kulagin dmitry.kula...@gmail.com: Hi Cafe, I am faced with unpleasant problem. The lawyer of my company checked sources of containers package and found out that it refers to some GPL-library. Here is quote: The algorithm is derived from Jorg Arndt's FXT library in file Data/IntMap/Base.hs The problem is that FXT library is GPL and thus containers package can not be considered as BSD3. And it means that it can not be used in my case (closed source software). Is this logic actually correct and containers should be considered as GPL? The package is widely used by other packages and the only way I see right now is to fix sources to reimplement this functionality, which is not good option. GPL covers code, not algorithms. Beside, you can use GPL in closed-source code. GPL forces you to make the source available when you distribute the software, but if you don't distribute the software, there is nothing wrong to use GPL and not make your code available. HTH, IANAL, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] containers license issue
2012/12/12 Johan Tibell johan.tib...@gmail.com: On Wed, Dec 12, 2012 at 10:40 AM, Clark Gaebel cgae...@uwaterloo.ca wrote: I just did a quick derivation from http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 to get the highest bit mask, and did not reference FXT nor the containers implementation. Here is my code: highestBitMask :: Word64 - Word64 highestBitMask x1 = let x2 = x1 .|. x1 `shiftR` 1 x3 = x2 .|. x2 `shiftR` 2 x4 = x3 .|. x3 `shiftR` 4 x5 = x4 .|. x4 `shiftR` 8 x6 = x5 .|. x5 `shiftR` 16 x7 = x6 .|. x6 `shiftR` 32 in x7 `xor` (x7 `shiftR` 1) This code is hereby released into the public domain. Problem solved. I will integrate this into containers later today. Note that I think the current implementation use a series of case expression instead of a let binding, possibly to force the evaluation. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Which advanced Haskell topics interest you
2012/10/4 Stephen Tetley stephen.tet...@gmail.com: On 4 October 2012 18:04, Kim-Ee Yeoh k...@atamo.com wrote: Something to consider is that it's not so much whether the material is basic, advanced, or intermediate; it's that the way it's being presented is boring and ineffective. I'd suggest there is enough range in the Haskell books now available, that for most tastes, there's a beginners to intermediate book already a given learner wouldn't consider boring. Of course different learners will like different ones... As for an advanced book, maybe limiting the subject to one domain (concurrency / DSLs for graphics / pick a favourite ...) might make a better book than one targeting a mix of advanced topics. PBRT (http://pbrt.org/) in Haskell would be awesome :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] 'let' keyword optional in do notation?
2012/8/8 Martijn Schrage mart...@oblomov.com: Hi cafe, For a while now, I've been wondering why the 'let' keyword in a do block isn't optional. So instead of do ... let x = exp1 y = exp2 z - exp3 ... you could simply write do ... x = exp1 y = exp2 z - exp3 ... Where each sequence of let-less bindings is put in a separate binding group. I'm no parsing wizard, but I couldn't come up with any situations in which this would cause ambiguity. To me, the let-less version is easier on the eyes, more consistent with - bindings, and also makes it less of a hassle to move stuff around. The above probably also holds for list/monad comprehensions, but the explicit let has never really bothered me there. Hi, This is not a parsing problem, but a scoping one: try to run this program: main = do let x = y y = 5 let a = b let b = 6 print (x, y, a, b) Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] A riddle...
Oh the mailing list was haskell@ instead of café. Sorry. (Now cc'ing café.) Andreas, please post this kind of mail to the haskell-cafe instead of the haskell mailing list. 2012/7/16 Vo Minh Thu not...@gmail.com: It seems like the infered type (and thus bounds) is different when you force the result to be a Color or not. Just give explicit type signatures and conversion functions. Cheers, Thu 2012/7/16 Andreas Abel andreas.a...@ifi.lmu.de: Today a student came to me with a piece of code that worked it executed by itself, but produced different result in the context of his larger problem. We cut down the example to the following: import Graphics.UI.Gtk -- should produce [(26471,0,65535),... rgbliste = (map (\ i - let rb = 5 * (mod (mod 181935629 (4534+i)) 100)-250+128 in let gb = 5 * (mod (mod 128872693 (5148+i)) 100)-250+128 in let bb = 5 * (mod (mod 140302469 (7578+i)) 100)-250+128 in let r = min 255 $ max 0 rb in let g = min 255 $ max 0 gb in let b = min 255 $ max 0 bb in (r*257,g*257,b*257)) [0..]) --farbliste = map (\ (r,g,b) - Color r g b) rgbliste main :: IO () main = do print $ head rgbliste If you run it, it prints (26471,0,65535). If you uncomment the def. of farbliste, it prints (44461,65535,65535). I was surprised. What is going on? Cheers, Andreas -- Andreas AbelDu bist der geliebte Mensch. Theoretical Computer Science, University of Munich Oettingenstr. 67, D-80538 Munich, GERMANY andreas.a...@ifi.lmu.de http://www2.tcs.ifi.lmu.de/~abel/ ___ Haskell mailing list hask...@haskell.org http://www.haskell.org/mailman/listinfo/haskell ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Tests by properties: origin?
See the Further Reading section on the wikipedia page you provided (http://en.wikipedia.org/wiki/Quickcheck), not all links are dead. 2012/6/1 Yves Parès yves.pa...@gmail.com: Yes ^^ but I can't find this paper, Koen Claessen website doesn't mention it and the link on the page http://www.haskell.org/haskellwiki/Introduction_to_QuickCheck is dead. 2012/6/1 Janis Voigtländer j...@informatik.uni-bonn.de Am 01.06.2012 12:00, schrieb Yves: Out of curiosity, does someone know if QuickCheck was the first test framework working through test by properties associated with random generation or if it drew the idea from something else? Because the idea has be retaken by a lot of frameworks in several languages (seehttp://en.wikipedia.org/wiki/Quickcheck), but I can't find what was QuickCheck inspiration. How about reading the original paper introducing QuickCheck? If the authors drew inspiration from elsewhere, the paper is for sure where they would tell you, first hand. :-) Best, Janis. -- Jun.-Prof. Dr. Janis Voigtländer http://www.iai.uni-bonn.de/~jv/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is protocol-buffers package maintainer reachable?
For what it's worth, I think he is active on stackoverflow. Thu Le 23 avril 2012 17:13, Johan Tibell johan.tib...@gmail.com a écrit : On Mon, Apr 23, 2012 at 7:53 AM, Max Rabkin max.rab...@gmail.com wrote: On Mon, Apr 23, 2012 at 15:01, Paul Graphov grap...@gmail.com wrote: And what should I do if he is unreachable? My feeling is that if you are willing to take it on, you should ask this list if anybody objects to your taking over the maintainership, and if they do not, take it over (on Hackage, this just means uploading a new version of the package). If Chris is indeed out of the loop we should find a new maintainer. Mark and I are also interested in the future of protocol buffers in Haskell. -- Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I Need a Better Functional Language!
Le 5 avril 2012 16:14, Grigory Sarnitskiy sargrig...@ya.ru a écrit : Hello! I've just realized that Haskell is no good for working with functions! First, what are 'functions' we are interested at? It can't be the usual set-theoretic definition, since it is not constructive. The constructive definition should imply functions that can be constructed, computed. Thus these are computable functions that should be of our concern. But computable functions in essence are just a synonym for programs. One could expect from a language that bears 'functional' as its characteristic to be able to do everything imaginable with functions. However, the only thing Haskell can do with functions is to apply them to arguments and to feed them as arguments, run in parallel (run and concatenate programs). Obviously, that's not all of the imaginable possibilities. One also can rewrite programs. And write programs that rewrite programs. And write programs that rewrite programs that rewrite the first programs and so on. But there is no such possibility in Haskell, except for introducing a DSL. So now I wonder, what are the languages that are functional in the sense above? With a reasonable syntax and semantics, thus no assembler. I guess Lisp might be of this kind, but I'm not sure. In addition, I'm not a fan of parentheses. What else? Pure? Mathematica? Maxima? Hello, You might be interested in https://github.com/MikeHaskel/Constructiva/wiki Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] good lightweight web-framework like sinatra?
Le 21 mars 2012 03:45, serialhex serial...@gmail.com a écrit : i'm looking for something lightweight, that dosnt need it's own server, can easily run on cgi on an apache with minimal work, and dosn't have many dependancies. i was looking at yesod, but it is bigger than i need for my site (at this point) and would take too much work to get running on my webhost. though i am looking forward to learning it and using it in the future, i just need something that will play nicely with apache cgi... justin p.s. if anyone is interested to know i'm using nearlyfreespeach.net as my host... haskell is one of the many languages they support via cgi, but, at the moment, it is kind of difficult to get yesod or rails or the like to work on it... :-/ Hi, It is unclear what you are looking for. You want a lightweight framework but what kind of features do you want? You can go straight CGI (an example is given here http://www.haskell.org/haskellwiki/Practical_web_programming_in_Haskell#Hello_World.21). But this is obviously not a framework. By the way, this is the way I got some CGI program to run on nearlyfreespeach: http://www.hyperedsoftware.com/blog/entries/ghc-freebsd-virtualbox.html Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Mitigating state-threading through an application loop
2011/12/20 Michael Serra mk.se...@gmail.com: Hello Haskellers, I'm implementing a simple tree-manipulating (for sports tournaments) application prototype, with SDL for graphics and simple user interaction. For reference, I've posted the code on hpaste. My question is about code organization: everything was simple and elegant until I started writing the program's display/event loop. Every function in this section has to be passed the same parameters - the application window to draw on, the font to display text with, the tree representing the current application state, etc. The font is an especially egregious example of the problem, because it's only used by one function but to get there it must be threaded through all of them (looking at the hpaste, you will see I don't want to call openFont on every invocation of drawTexts; what's needed is to call it once in main and have the resulting value available to drawTxt. So my question: how can I mitigate the ugliness of this state-threading? I understand this is one purpose for monads; am I supposed to implement a monad transformer for this? I think it would be great if I could define a type AppState as a tuple of the various things I need to thread, and specify some kind of automatic as-pattern, so that every function taking this AppState parameter would implicitly have its components bound to certain preset names. I've never seen anyone do this however. What is the right solution? You can use the -XRecordWildcards extension[0] with a Reader or a State monad. data AppState = AppState { appStateSomething :: String } f AppState{..} = print appStateSomething Cheers, Thu [0] http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#record-wildcards ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] minor refactoring problem
2011/11/29 Stefan Holdermans ste...@vectorfabrics.com: Martin, (The trick with `flip` is tempting, but again at the cost of having to peer rather too closely at the implementation of processFile when reading the code). That trick is of course completely orthogonal. One could just as well write: processFile :: (String - [a]) - (a - (String, String)) - Editor - String - IO () processFile f g ed path = do s - readFile path ps - mapM (makePair . g) (f s) es - return $ V.fromList ps writeIORef ed es importFile = processFile lines (\x - (x, )) loadFile = processFile parseFile id With the TupleSections extension, you can write (,) Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What is the etiquette for posting to multiple forums?
2011/10/21 Michael Litchard mich...@schmong.org: I know it's bad form to post the same question to multiple mailing lists. But what about say, the beginner's mailing list and stackoverflow.com? Hi, Nothing is carved in stone, use your judgment. It shouldn't be done systematically but from time to time, it is interesting to point people to existing discussion (e.g. blog post, reddit thread, or SO answers). I believe currently SO and beginners' mailing list have not exactly the same audience so if you don't get the answer you're after in one place, trying later in the other is fine. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] library on common sub-expression elimination?
I guess you refer to data-reify: http://hackage.haskell.org/package/data-reify 2011/8/11 Stephen Tetley stephen.tet...@gmail.com: Strafunski and its successors (Uniplate, SYB, KURE) are really for working on trees. If you want to work on graphs you would probably be better of with something else. I think I overlooked that you want common sub-expression _elimination_, rather than expression simplification. There are libraries for observable sharing (Andy Gill's recent one is the state-of-the-art, its on Hackage but I've forgotten its name) - that are pertinent where you have built the expressions as an embedded DSL in Haskell and you want sharing in code you generate from the Haskell DSL. On 11 August 2011 08:57, Anton Kholomiov anton.kholom...@gmail.com wrote: Thank you for the reference to Strafunski libraries, I read HaskellWiki, but I don't have a permission to visit their site. All links are forbidden. Can it be a function: fun :: Eq a = Tree a - [(Int, (a, [Int]))] where tuple codes nodes, and Int's code edges. 2011/8/11 Stephen Tetley stephen.tet...@gmail.com Wouldn't this be dependent upon your AST and thus not readily package-able as a library? Expression simplification has been a prime example for Strafunski style traversal libraries. You might be able to find examples that you can adapt to your own AST written with Uniplate or similar library. On 11 August 2011 05:00, Anton Kholomiov anton.kholom...@gmail.com wrote: Is there a library on common sub-expression elimination? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Retaining functions in memory
2011/7/26 Siddhartha Gadgil siddhartha.gad...@gmail.com: I have been making programs for mathematical applications (low-dimensional topology) in Haskell, which I find a delight to code in. However, the execution is slow, and this seems to be because recursively defined functions seem to be recomputed. For example f(100) needs f(15) which needs f(7) ... The dependencies are not obvious to the compiler. I was looking for a way to retain the values of a specific function in memory. Is there some way to do this. It seems you are looking for memoization. Have a look at the comparison between slow/memoized_fib at this page http://www.haskell.org/haskellwiki/Memoization#Memoization_with_recursion Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc on arm status
2011/7/20 Sergey Mironov ier...@gmail.com: Hi. I was searching for info about building ghc on ARM arch. I already know about [1] approach, and also saw debian binaries [2], but I am afraid I have to compile ghc by myself this time, since our system uses incompatible libc, so my question is addressed to gentoo users and sympathetic :) Did anybody see any working (currently or in the past) dev-lang/ghc arm ebuild? Do you happen to know about this initiative: http://ghcarm.wordpress.com/ Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Trying to make a calculator
2011/7/18 Emanuil Boyanov emanuilboya...@gmail.com: Hi guys, I'm new to Haskell, I learn it for couple of months now and we've learned only simple functions like map, zip etc. But now my assignment is a lot tougher than I thought so I'll need some guidelines. I've googled my assignment and I saw a person with the exact assignment so I am gonna copy the task then I'm gonna show you what I've done so far. Here it is: Make calculator function. The function argument is a list of strings and also form such list, as each string of the argument made definite action. - If the string has the form of an arithmetic expression - calculate this expression. The string result becomes part of the list- result. If the expression contains a variable which is not assigned value, the result is displayed undefined. - If the string has the form Name = value calculated from the last expression is assigned to the variable with the corresponding name in the list, and in the result list is formed a string with type name = ... where the site stands blank corresponding value. If there is not a calculated expression to be assigned to form a string no value. - If the string is non-blank, but there is a species different from the above two case, form the string error. - If the string is empty, incl. when it contains only spaces, in the result there is not form a string. Expressions consist of integers without sign variables, operations + (Addition), - (subtraction), * (multiplication) and / (divide) In the beginning, end or between the elements of each row can have spaces - they are irrelevant to its correctness. Example: the list-argument [3 +7 / 2, 2 + x, = s, 2 * s +4, , 2 + +4 / 5] function should provide a result-list [6, undefined, s = 6, 16, error]. = So what I've done so far is: calculator [] = [] calculator [ ] = [] calculator [c] = [c] calculator (c: :cs) = c:calculator cs calculator ( :cs) = calculator cs calculator (c: : :cs) = calculator (c: :cs) calculator (c:cs) | (head c `elem` ['a'..'z']) (head(tail c) `elem` ['+','-','*','/']) (last(take (length c-2)c) `elem` ['1','2','3','4','5','6','7','8','9']) = calculator cs | otherwise = error:calculator cs I try at first to use pattern matching for the blank strings in the first list, so that I can get rid off them in the second list. Am I even on the right way here? I found the elem function and I'm trying to check if the first char of the string is a letter or a number, then if the second char is one of the operations and so on. Problem is that I have no idea how can I check if the variable is defined already or how to save a variable and then give that variable the new value - is that even possible? :] And another thing `elem` [1..9] isn't working - how can I make a single char of a string to hold an integer.. Could you give me some guidelines or at least tell me if I'm on the right way here so I can move forward and improve my program. Thanks a lot! Hello, You should work by smaller steps. For instance, you can begin by abstracting the syntax. At the very beginning, you get some strings (a list of statements) and you transform them in something much simpler to use. Here, there is also an intermediary step to make things easier. Let's say you have 1 + 2 . You can make things simpler by working on [1, +, 2]. Here, the problem with blancs is already dealt with. You just have a list of tokens. Then, to make it simple later on to differentiate between a number and an operator (and a variable), you can define your own representation, for instance: data Token = TNum Int | TOp Op | ... data Op = Add | Sub | ... Now the list [1, +, 2] becomes [TNum 1, TOp Add, TNum 2]. Now you can use pattern matching on the Token and easily know what you have. For your variable assignment problem, you have to provide an environment, i.e. a mapping between variable name and their value. If you use a recursive function to evaluate your little language, you can provide that environement as a supplementary argument. Try to proceed that way, one step at a time, and come back if you have any problem. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Seeking Don Stewart
Don isn't working at Galois anymore. I guess his new email address is simple to find but I gave it to Wren privately. But I guess the sloth signal works fine too. Cheers, Thu 2011/7/13 Yves Parès limestr...@gmail.com: It's mine too! Who!? Who said that? Links! I want links! (And names) 2011/7/13 Michael Snoyman mich...@snoyman.com Just post something on Stack Overflow, throw in a line about how inefficient Haskell is compared with Java. It's like his bat signal. Michael On Wed, Jul 13, 2011 at 12:09 PM, wren ng thornton w...@freegeek.org wrote: Hello all, Sorry for the spam. I'm trying to get ahold of Don Stewart, but it looks like there's some hiccup at Galois. When I mail him I get: d...@galois.com: host mail.galois.com[69.30.63.196] said: 550 5.1.1 d...@galois.com... User unknown (in reply to RCPT TO command) Does anyone know what's up, or if there's another (non-emergency) way to get in touch with him? -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Graph diagram tools?
2011/6/22 Dmitri O.Kondratiev doko...@gmail.com: Hi, I am looking for Haskell library to create graph diagrams in png or similar formats. See the graphviz package: http://hackage.haskell.org/package/graphviz Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Homework help - calculator function
2011/6/22 Gregory Collins g...@gregorycollins.net: On Wed, Jun 22, 2011 at 4:39 PM, SM Design social_me...@abv.bg wrote: I have a homework which is very important to be done but I can't complete the task at all. The program i should write is: Nobody on this list is going to do your homework for you, or at least I hope not. Before you expect to get help, you should a) demonstrate that you've made an effort to solve the problem on your own, b) explain where you've gotten stuck and what it is you don't understand about how to move forward. In addition to what Gregory said, please have a look to this page: http://www.haskell.org/haskellwiki/Homework_help Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: mecha-0.0.5
2011/6/5 Tom Hawkins tomahawk...@gmail.com: On Sun, Jun 5, 2011 at 10:41 AM, Andrew Coppin andrewcop...@btinternet.com wrote: On 04/06/2011 08:25 PM, Tom Hawkins wrote: What is the easiest way to generate polygon meshes from constructive solid geometry? Marching cubes [4] seems pretty involved. As I understand it, this is a Very Hard Problem. This is (one of the reasons) why there are so few converters from POV-Ray to mesh-based formats; it's highly non-trivial to tesselate CSG. POV-Ray is pretty fast. I had contemplated just rendering a bunch of POV-Ray images to emulate a realtime 3D view. Images could be buffered up based on the current camera position. Another goal of the project is to generate 2D prints from 3D models. Any idea how hard is this going to be? Basically it needs to identify features (holes, edges, etc), then project these features to an orthographic plane, alone with associated dimensions. Once the conversion to triangles (or polygons) is handled, you should be able to import the model into some rendering engine. Orthographic projection isn't more difficult to achieve than perspective projection. You would have to chose the renderer so it comes with the kind of effect you want. (The feature detection you mean such that they are for instance rendered as strokes is a rendering effect, so no need I believe to first detect them then render them. I also believe there are such rendering that are done as a post-effect, on the 2d data (possibly with dept or normal information available)). Don't povray provides such a rendering mode? Otherwise, given a mesh model, idetifying the edges (with no respect to the screen) is quite easy in the principle: make any edge that separates two faces whose normals make an angle above some thresold a hard edge. To take the screen into account, you would have probably to compare the surface normal at the edge and the camera direction. One thing that would be neat for you, but I have no idea if it exists, would be to turn directly the CSG models to 2d vector graphics. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Subcategories on Hackage
2011/6/4 Tillmann Vogt tillmann.v...@rwth-aachen.de: Hi, There are some categories on Hackage that have become so large that it is hard to find something, i.e. Data(414 packages) and Graphics (191). Thats why I suggest to use subcategories separated from the category with a dot. To show that this makes sense I made subcategories for graphics libraries at the end of this email. Whatever happens to hackage2 this would be an immediate improvement. How -- I would volunteer for the manual categorization and let the community look over it. I could upload the changes with a script but the version number has to increase even if only the category has changed. I also don't want to be responsible for a massive spike in the upload statistics. Shouldn't the cabal file be excluded from the versioning policy? = It is allowed to upload a library with the same version number if only the cabal file has changed. One should write a notifiaction mail to all owners to reply if they don't agree. Then after a week executing the script that applies the changes. [snip] Hi, I would simply prefer tags. Actually, there is a problem that becomes even worse in your proposal: packages appearing in multiple categories, and packages not appearing in some expected category. A simple example in your proposed categories: HDRUtils library: should it be in 2d, RasterFormats, or maybe in 2dFormats, ... with tags, 2d, raster, format, can be used, but also hdr, image, etc. I don't remember what was proposed for hackage 2. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] License of hslogger, HDBC, etc.
2011/6/2 John Goerzen jgoer...@complete.org: Hi Jon all, I've decided that I'm OK with re-licensing hslogger, HDBC, and well all of my Haskell libraries (not end programs) under 3-clause BSD. My schedule is extremely tight right now but if someone wants to send me patches for these things I will try to apply them within the week. Thanks! What was your line of reasoning to make the switch? Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The Lisp Curse
2011/5/19 Andrew Coppin andrewcop...@btinternet.com: http://www.winestockwebdesign.com/Essays/Lisp_Curse.html Some of you might have seen this. Here's the short version: Lisp is so powerful that it discourages reuse. Why search for and reuse an existing implementation, when it's so trivially easy to reimplement exactly what you want yourself? The net result is a maze of incompatible libraries which each solve a different 80% of the same problem. To all the people who look at Hackage, see that there are 6 different libraries for processing Unicode text files, and claim that this is somehow a *good* thing, I offer the above essay as a counter-example. Hi Andrew, So what exactly is the problem on hackage and what do you propose as a solution? Surely you don't want people to upload a library on hackage only once it is perfect (nor do you think such a perfect, one-size-fits-all library might exist)? I haven't read the provided link but I also guess you don't _really_ mean that the referred packages on hackage were 'so trivially easy to reimplement', nor that it is not possible to use them together... Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Newt - command-line template instantiation tool library
2011/5/9 bri...@aracnet.com: On Sun, 8 May 2011 16:23:59 -0700 Rogan Creswick cresw...@gmail.com wrote: Newt scans the input (either a file, directory or stdin) for tags marked with tagName [1], then replaces those entries with values specified on the command line, producing either a new file, modifying the input template in place (--inplace), writing to stdout, or writing to a directory. This is a useful tool ! I would like to suggest allowing customization of the syntax to indicate a tag, e.g. {# #} instead of (You just knew someone was going to say that, right ? :-) Hello, Did you see his [1] footnote in his mail? Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: cereal-0.3.3.0
2011/4/26 Trevor Elliott tre...@galois.com: Hot on the heels of the last release, cereal-0.3.3.0 [1] adds support for parsing and rendering lazy ByteStrings. Most running functions in Data.Serialize.Get and Data.Serialize.Put now have lazy analogues, and Data.Serialize has gained encodeLazy and decodeLazy. This new functionality was made possible by the incremental parsing support added in cereal-0.3.1.0 by Lemmih. Hi, For lazy ByteStrings, what would be the reason to prefer cereal or binary now? Thanks, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Python is lazier than Haskell
2011/4/27 Henning Thielemann lemm...@henning-thielemann.de: I like to apply for the quote of the week. :-) If Haskell is great because of its laziness, then Python must be even greater, since it is lazy at the type level. Dynamically typed languages only check types if they have to, that is if expressions are actually computed. Does this prove that laziness at type level as in Python is a great thing or does this prove that laziness at the value level as in Haskell is a bad thing or does this prove nothing? Hope for controversial discussion ... I like the sloth to be eager to eat my bugs. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deciding equality of functions.
2011/4/9 Grigory Sarnitskiy sargrig...@ya.ru: I guess that deciding whether two functions are equal in most cases is algorithmically impossible. However maybe there exists quite a large domain of decidable cases? If so, how can I employ that in Haskell? It is a common situation when one has two implementations of the same function, one being straightforward but slow, and the other being fast but complex. It would be nice to be able to check if these two versions are equal to catch bugs in the more complex implementation. Hi, Instead a trying to decide if they are equal, I would simply go through a well-known route: Pick the simple implementation and test toroughly, to see if it is 'correct' w.r.t. some specification. This involves things like unit tests and QuickCheck. Then apply those those tests to the second implementation once you're satified with the results of the first one. This transforms your problem of deciding if two functions are equal into trusting enough your two functions given some tests. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Local copy of hackageDB
2011/4/7 José Pedro Magalhães j...@cs.uu.nl: Hi all, I want to use cabal-install on a machine without internet access. I tried downloading http://hackage.haskell.org/cgi-bin/hackage-scripts/archive.tar, unpacking it and setting the local-repo field in the config file to this location but that doesn't work, as cabal-install says that it is missing the package list for the local repo. What should I do? Hello, In addition of the (unpacked) archive, you also need to provide a 00-index.tar.gz file. It is an archive with all the .cabal that are available in the repo. You can find info about its layout at the following page http://hackage.haskell.org/trac/hackage/wiki/HackageDB I don't know if such a index file is available for the archive.tar you have, but it should be straightforward to create it. HTH, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Google Summer of Code student application period opens today
2011/4/5 Christopher Done chrisd...@googlemail.com: On 5 April 2011 15:17, Marco Túlio Gontijo e Silva mar...@marcot.eti.br wrote: I plan to apply to the Google Summer of Code, to work on the parallelization of Cabal Install. As stated in some comments, this project may be too small for three months, so I included some other things in my proposal. The first is to work on making GHC parallel while building different modules. I'm sure everyone is eager to have a parallel GHC and parallel Cabal. I am. Waiting for 67 modules to build in order every time I change my types file is not fun. You should parallelize yourself instead; while one thread is stuck waiting for GHC or Cabal, the other ones can have fun. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GSoC Proposal: A 3d visualization of code (packages)
2011/4/4 Tillmann Vogt tillmann.v...@rwth-aachen.de: Dear Haskell Programmers, To get some feedback on my proposal here is posting that explains it more detailed: http://tillmannvogt.wordpress.com/2011/03/30/gsoc/ If this succeeds it could become the poster child application for WebGL and there will be an immediate value to all Haskell programmers: Get an overview what is happening. In the long term there is the possibility to have a very powerful UI-library and to be able to combine visualizations with Code. The milestone plan is just to show that it should be doable. The part that is not so clear how to do is the integration with hackage2. It could even be a separate site like haskellers.com that links to various resources. Should a WebGL engine be used (then it should be easy to load a collada file) or can WebGL be integrated in a haskell web framework? Hi, I'm happy to see someone interested in hacking 3D projects in Haskell. But I'm failing at imagining your package visualization. Would it be possible for you to craft some image with some real data from hackage, and show how it would be more useful than, say, a normal web page? Let me quote the three points from your blog: 1. The visualization will let programmers quicker find a library they need (see changes, etc. ), because the visualization algorithm is like reversed pattern recognition to produce most recognizable shapes. 2. The code size, popularity, dependencies, whatever the community demands can be integrated or left away 3. A general way to extend or change the visualization I really think a more concrete (manually crafted) image would help a lot seeing what you mean by 1. I'm wondering how, in 1., it makes it quicker to find what I need if it is not clear what kind of information it will provide. I say it is not clear as point 2 is asking the question of what data is available in the visualization. Point 3 doesn't seem realistic to me. It sounds like a 3d visualization framework is on the way, which is a big undertaking. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] WANTED: Compensated Haskell Hacker for Language Project
2011/3/29 Bryan Edds bryane...@yahoo.com: Hi Jake! My only question is this: what does your language offer that others do not with respect to soft real time systems? The language you describe in the linked forum thread looks neat, but I think I'm missing the reasoning behind its design. Why is this design beneficial for soft real time compared to other high level languages? The main thrust of the design is to provide nearly the power of Lisp and ML's semantics in a form that is syntactically palatable to the mass of intelligent industry programmers. While industry programmers typically prefer C-style languages, it's just not possible to build a C-style language with a reasonable macro development (language orientation) experience due to C's inherent syntactic complexities. Further, it seems to have been historically demonstrated that C-family programmers are not willing to make the a syntactic leap as far as say, Lisp or Ocaml. Barring the provision of yet another C-style language, there's another set of languages many C-family programmers do rather like: Ruby and Python. So by finding a direct mapping from s-expressions to a language with an feel and visual appeal similar to Python that ALSO approaches the machine efficiency of C++, I hope to create a lisp- and ML-derived language that is accessible to an audience wider than existing functional languages seem to have reached. As you can see, the design does admit some semantic compromises in the name of syntax and efficiency, but the compromise is surprisingly (at least to me) minimal. One compromise made in the name of C++ efficiency is the use of a machine word-sized default number type rather than the default number type used in lisp or Haskell. Of course, arbitrary number types can be made available naturally via a library using simple binary operation overrides, but they are not the default when you type the literal 5. I've discovered, at least to my own current satisfaction, that bringing lisp- and ML-style semantics to the masses is possible with less semantic compromises than previously seemed possible. By providing a language that industry programmers feel comfortable with, I hope to move as many of them as possible into the functional / language-oriented world. But more than that, I'm just designing the language I wish I could use everyday instead of C++ and C# :) Hi, First of all, I wish you good luck in your project. Your mail made me think of my little syntactical[0] library. It needs some love but is in principle very flexible. It makes a clear mapping between distfix expressions and s-expressions. Distfix expressions are flexible enough to accomodate for a lot of the usual constructs one can find in programming languages. Maybe you'll find it useful. Cheers, Thu [0] http://hackage.haskell.org/package/syntactical ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCEMENT: nehe-tuts 0.2.0, new release
2011/3/28 Jason Dagit dag...@gmail.com: ... The tutorials are still written using OpenGL's immediate mode, but that was deprecated in OpenGL 3.x so it's possible that in the future these examples won't be supported by your graphics card. ... Hi, I wouldn't worry about the older API to be unsupported in the foreseeable future. This is precisely the reason OpenGL is a bit slow to evolve its API. At least nVidia made it clear they won't remove support for older versions, I guess AMD is in the same boat. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How large is the Haskell community ?
2011/3/17 wren ng thornton w...@freegeek.org: On 3/17/11 9:18 AM, Andy Stewart wrote: On Sat, Feb 12, 2011 at 6:57 PM, Jan Christiansenj...@informatik.uni-kiel.de wrote: if you have written at least 1 lines of code in Haskell, Goodness. It looks like my current project is over 17,275 lines including documentation but excluding testing code (of which 2,557 are Java client code and 2,686 were prior work). I knew it was getting big, but not that big... Mm. Do 12000 lines of auto-generated code[0] count? [0] https://github.com/noteed/hblend/blob/master/Data/Blend/B245.hs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANN: craftwerk-0.1, craftwerk-cairo-0.1, craftwerk-gtk-0.1
2011/3/14 Malte Harder malte.har...@googlemail.com: Dear all, I just released the first version of the Craftwerk graphics library for 2d vector graphics. Craftwerk is intended to act as an abstract interface to different backend drivers. The library itself has a TikZ (http://sourceforge.net/projects/pgf) driver builtin to output vector graphics for use in LaTeX documents. The craftwerk-cairo library supplies a Cairo output function to the library. The aim is to support these two backends in a seamless manner such that graphics created with either backend are not or nearly not distinguishable. The third package (craftwerk-gtk) contains convenience functions to display graphics created with craftwerk directly in a Gtk window, including the basic zooming, PDF TikZ export via a file chooser dialog. It also allows to create a simple user interface that passes options to the rendering function. The feature support is rather rudimentary at the moment, but for current Cairo users most features should be already available from within the craftwerk API. The aim is to support more high level functions like TikZ offers. The project started when I realized that I need to prepare a lot of visualizations at university twice, once for display and once for print. I hope that this library proves to be useful for people with similar tasks. A great thing would be if the Chart library allows to plug another backend in. I haven't really looked into that, but this would allow me to leave Gnuplot and R behind for most purposes and at the same time get higher quality output that is better integrable. I started learning Haskell only half a year ago and this is my first real project. So far I have to say that I enjoy it very much. Therefore, if you find some weird constructions or have any comments about the design of the library, I'm looking forward for any feedback! The source repository can be found under: https://github.com/mahrz/Craftwerk and packages here: http://hackage.haskell.org/package/craftwerk-0.1 http://hackage.haskell.org/package/craftwerk-cairo-0.1 http://hackage.haskell.org/package/craftwerk-gtk-0.1 Hi Malte, Your project sounds very good (I will unfortunately not have time to look at it carefully before some time). I guess you know about reddit, anyway there is a thread about your library there: http://www.reddit.com/r/haskell/comments/g3xp1/craftwerk_a_highlevel_and_easy_to_use_graphics/ Could you please as suggest one comment include some screenshots (even better with some code next to them) on the homepage? Thanks for making the code available on both github and hackage! Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Light and fast http server
2011/3/11 Victor Oliveira rhapso...@gmail.com: Hi cafe, There are a lot of http servers in hackage. I didn't have used none. I would like to know if one of them is something closer of the nginx. I need some light and fast. It don't need support all http, just the basics is fine. Suggestions? Snap and Warp come to mind. Have a look at this reddit thread: http://www.reddit.com/r/programming/comments/flpao/the_haskell_high_performance_server_shootout/ Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] http://www.cs.cornell.edu/icfp/task.htm
Hello, From what I see here, you can use a well-known technique call descent recursive parser. The idee is to do exactly what you did but involving a call to some other function which should do some kind of sub-work. Actually, you can see the pattern already in the code you provided; for instance tokenize' (('/' : binder) : words) tokens = tokenize' words ((BinderToken binder) : tokens) would become something like parse' ('/' : words) tokens = parse' rest (t : tokens) where (t, rest) = parseBinder words -- parseBinder should parse the input that follows '/' so for an array: parse' ('[' : words) tokens = parse' rest (t : tokens) where (t, rest) = parseArray words -- parseArray should parse the input that follows '[', until and including ']' Remarks: - You see that the parseX that parses some X returns t, the 'token' we are interested in, and also the rest of the input, i.e. the part not consumed by parseX. - tokenize is named parse: parseArray for instance doesn't return a list of tokens, but a single thing that represent a complete array, including its elements. - because of the first point, you should define 'parse' as returning ([GmlToken], String). The return type has the same shape as your sub-parser: (return-type, unconsumed-input). So do not pass the 'tokens' argument in the recursive call, but let the caller make the (:) append. This way, instead of doing an append, you can make something more useful before returning the return-type, like building a nice representation of an array. After you have managed to digest my no-so-well explained prose, have a read at monadic parsing. I believe Philip Wadler has a nice introductory paper about that. This is exactly what you need. Then, once you understood that, have a look at Parsec, a standard monadic parsing library for Haskell. (You don't need to read about monadic parsing to do your project, but it happens to be exactly what my answer is all about). HTH, Thu 2011/2/28 Hauschild, Klaus (EXT) klaus.hauschild@siemens.com: Hi Thu, You read my mind. Ok, for the details. Here are my data structur for the differen tokens (currently not complete): data GmlToken = IntToken Int | RealToken Double | BoolToken Bool | StringToken String | FunctionToken TokenSequence | ArrayToken TokenSequence | BinderToken String | IdentifierToken String | AddiToken type TokenSequence = [GmlToken] type TokenStack = [GmlToken] Now I'm working on the tokenize method. There a public and a private version (indicated by ') tokenize :: String → TokenSequence -- foreward to intern method tokenize program = tokenize' (words program) [] tokenize' :: [String] → TokenSequence → TokenSequence -- last recursion step tokenize' [] tokens = tokens -- addi is a reserved keyword for the AddiToken tokenize' (addi : words) tokens = tokenize' words (AddiToken : tokens) -- binder tokens start with '/' tokenize' (('/' : binder) : words) tokens = tokenize' words ((BinderToken binder) : tokens) -- if nothing matches it is an identifier tokenize' (name : words) tokens = tokenize' words ((IdentifierToken name) : tokens) With this code I'm able to tokenize the different reserved keywords of the GML language, binder and identifier (these two handle variable access). Now the problem: How to write the code to tokenize numbers (integer and double) and arrays and functions. I hope it is clear what is meant with numbers. Arrays and functions are embedded token sequences enclosed by [ and ] or { and }. Some examples: tokenize' [2, 2, addi] [] results in [IntToken 2, IntToken 2, AddiToken] tokenize' [2.0, 2.0, addi] [] results in [RealToken 2.0, RealToken 2.0, AddiToken] tokenize' [[, foo, /bar, ]] results in [ArrayToken [IdentifierToken foo, BinderToken bar]] tokenize' [{, foo, /bar, }] results in [FunctionToken [IdentifierToken foo, BinderToken bar]] -Ursprüngliche Nachricht- Von: Vo Minh Thu [mailto:not...@gmail.com] Gesendet: Freitag, 25. Februar 2011 17:44 An: Hauschild, Klaus (EXT) Cc: haskell-cafe@haskell.org Betreff: Re: [Haskell-cafe] http://www.cs.cornell.edu/icfp/task.htm 2011/2/25 Hauschild, Klaus (EXT) klaus.hauschild@siemens.com: Hi, Currently I'm trying to lern Haskell by doing. After doing some examples I plan to solve an ICFP task (see subject). In short: build an interpreter for a stack based language thata describes a 3D scene. Ray trace this scene in an image. My current source state can be found here: http://code.google.com/p/hgmltracer/source/browse/ My first goal is to develop the interpreter of the GML language. My source contains a data GmlToken with various constructors for the different operators, sequences, int, real, string an so on. Some code for the evaluation is also there und working. But the parser converting a string (contained in the program file provided as command line argument) is hard
Re: [Haskell-cafe] http://www.cs.cornell.edu/icfp/task.htm
2011/2/25 Hauschild, Klaus (EXT) klaus.hauschild@siemens.com: Hi, Currently I'm trying to lern Haskell by doing. After doing some examples I plan to solve an ICFP task (see subject). In short: build an interpreter for a stack based language thata describes a 3D scene. Ray trace this scene in an image. My current source state can be found here: http://code.google.com/p/hgmltracer/source/browse/ My first goal is to develop the interpreter of the GML language. My source contains a data GmlToken with various constructors for the different operators, sequences, int, real, string an so on. Some code for the evaluation is also there und working. But the parser converting a string (contained in the program file provided as command line argument) is hard stuff and I'm stuck. Can any one help me with ideas or concepts for this parser? Hi, You have chosen to develop a very interesting program and I'm sure a lot of people could help you if you face any problem. But it would be easier for those people to help you if you could be a bit more specific about what works (or what you understand) and where you have some problem. In this case, maybe you could copy in the mail some code (possibly cutting it down to what really matter). For instance, I think central to your mail is this data structure: data GmlToken = IntToken Int | RealToken Double | BoolToken Bool | StringToken String | FunctionToken [GmlSequence] | ArrayTokenToken [GmlSequence] | BinderToken String | IdentifierToken String | AddiToken and the function parse :: [String] - TokenSequence - TokenSequence parse = ... At first view I would say that parse should be (and I call it tokenize) tokenize :: String - [GmlToken] Now, maybe you can provide some sample inputs *with* their expected output and tell us what is really a problem for you. Alternatively I can assume too much (or not enough) things from your mail and you can enlighten me :) Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Status update on {code, trac, projects, planet, community}.haskell.org
2011/2/17 Henning Thielemann lemm...@henning-thielemann.de: Duncan Coutts schrieb: Several people have asked about the new host key. Yes, there is a new RSA host key for the community server, the fingerprint of which is: 21:b8:59:ff:39:69:58:7a:51:ef:c1:d8:c6:24:6e:f7 ssh will likely give you a scary warning and you'll need to delete the old entry in your ~/.ssh/known_hosts file. You don't need to enter a new one, just delete the old one. When you next log into the server, ssh will ask you if you're happy with the new key. If you're paranoid, you can double check that it matches the key fingerprint above. Do you think it is paranoid? Unfortunately it has become quite common to ignore SSH warnings because admins often do not care about restoring keys when updating the operating system or moving the machine, even not telling users that the host key has changed. But if I had ignored the SSH warning on code.haskell.org recently I might have logged in and from there maybe to other servers, thus giving my passwords to the attackers. I think generally that just deleting a host from known_hosts in response to an SSH warning and blindly accepting a new host key is not a fix. Am I too afraid? Hi, Regarding you giving passwords when logging in other marchines, I think it would not be the case if you only use key authentication from machines to machines. Your private key can be only on your local machine and you can use an ssh agent to do log from machines to machines. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Looking for criticism and comments on web-mongrel2.
2011/1/21 Clint Moore cmo...@wamboli.com: After sufficient hand-wringing I finally uploaded web-mongrel2 up to hackage and I'm interested in criticism of my approach. The module itself is terribly simple as it's meant to provide a lightweight layer between an application or framework and Mongrel2, but if nothing else, it's a start. Anyway, the hackage page is at http://hackage.haskell.org/package/web-mongrel2-0.0.2.2 with a link to the github repo. Hi, The link given on hackage to git is broken, it seems to be web-mongrel2 instead of haskell-mongrel2. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Happstack events and web page refreshing
Hi, I've not really followed the thread, but on the client side, for long-polling, you issue an XMLHttpRequest that will receive an answer from the server only when the server has something to push to the client (maybe done with a thread waiting on an MVar). XHR is asynchronous as you have to supply a callback to process the server's response. Usually an XHR request is done from an already loaded page and will update part of that page with the content of the server's response. So no blank page. (So no timer needed either, this is done asynchronously with callbacks.) HTH, Thu 2011/1/19 Corentin Dupont corentin.dup...@gmail.com: Thanks. There seems to be several technologies to realize this push or polling. Is what you explained feasible on the user's side of happstack-server (I mean, if I can do it myself)? If I take an empty MVar in my ServerPartTs, which are read over client's request, I think that nothing will be sent back to the browser and it will remain blank! Is that to be combined with an HTTP refresh timer on the client side? By sessions, you mean sessions that I create myself for every client connected? Regards, Corentin On Wed, Jan 19, 2011 at 2:21 PM, Bas van Dijk v.dijk@gmail.com wrote: On 17 January 2011 21:50, Jeremy Shaw jer...@n-heptane.com wrote: On Jan 17, 2011, at 2:19 PM, Corentin Dupont wrote: Indeed, I tried with META HTTP-EQUIV=Refresh CONTENT=n ? and it's unusable. It make blink the page, ungrey the stop button for a second and make the fields loose the focus so it's impossible to type in. I'll try with XMLHTTPRequest. Right. Using the jQuery library should make it easier to do ajax requests and modify the DOM on the fly, http://jquery.com/ - jeremy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe A nice variation of polling is long polling: http://en.wikipedia.org/wiki/Push_technology#Long_polling This can easily be accomplished in Haskell by having an MVar per session. Initially an empty MVar is created per new session. When a client makes a request, the server thread that handles the request takes the MVar belonging to the session. This thread will block until the MVar is filled. When the server has an update it will fill all the MVars. This causes all the blocked threads to continue with sending a response to the client notifying it about the update. Like Jeremy said it's a good idea to make these update requests asynchronous. Regards, Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-Cafe] Parsing bytestream
2010/11/9 C K Kashyap ckkash...@gmail.com: Thanks Stephen, On Tue, Nov 9, 2010 at 2:53 PM, Stephen Tetley stephen.tet...@gmail.com wrote: I'd use a parser combinator library that has word8 word16, word32 combinators. The latter should really have big and little endian versions word16be, word16le, word32be, word32le. Data.Binary should provide this and Attoparsec I think. Usually I roll my own, but only because I had my own libraries before these two existed. The idiom of a tag byte telling you what comes next is very common in binary formats. It means parsers can avoid backtracking altogether. I'll take a look at attoparsec I was also trying to understand how I could do it myself also - Basically I've been using the Get Monad for getting out the word/8/16 etc out of a ByteStream - but I dont want to write a separate parsing routine for each command. So instead of doing something like this - parseCommand1 byteStream = runGet $ do b1 - getWord8 b2 - getWord16be return (b1,b2) parseCommand2 byteStream = runGet $ do b1 - getWord16be b2 - getWord16be return (b1,b2) I'd like to do this parse byteStream command = runGet $ do map (commandFormat command) --- or something like this - not exactly sure about this. Hi, This doesn't seem a good idea to me. In the first case, when you have parsed your data, you end up with very specific data structures that can be processed later as-is. In the second case, you end up with a list for every kind of data, so you're bound to parse that list again to know what you're dealing with. In the first case, parsing wrong data is the only way to fail and you produce solid data you can work with. In the second case, you have a very weak representation that will need more work afterward, and that work is very similar to the parsing you do in the first place. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-Cafe] Parsing bytestream
2010/11/9 C K Kashyap ckkash...@gmail.com: I think I can restate my problem like this --- If I have a list of actions as follows - import Data.Word import Data.Binary.Get data MyAction = A1 (Get Word8) | A2 (Get Word16) a = A1 getWord8 b = A2 getWord16be listOfActions = [a,b,a] How can I execute the listOfActions inside of a Get Monad and get the output as a list? Since you want the result as a list, by somehow mapping over a list of action, and since lists are homogeneous in Haskell, you need each action to have the same result type. Something like: performAction :: MyAction - Get Int performAction A1 = getWord8 = return . someHypotheticalWordToIntYouWouldLike Notice that I have rewritten your data MyAction = A1 (Get Word8) as simply data MyAction = A1 because it seems your A1 action will always be getWord8. Now, you don't need specifically a list of MyAction and map performAction on it: you can achieve the same thing with: sequence [getWord8 = return . someHypotheticalWordToIntYouWouldLike, ...] Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-Cafe] Parsing bytestream
2010/11/9 Ozgur Akgun ozgurak...@gmail.com: If we change the code a bit, data MyAction = A1 Word8 | A2 Word16 a,b :: Get MyAction a = A1 $ getWord8 b = A2 $ getWord16be listOfActions :: [Get MyAction] listOfActions = [a,b,a] Now, we know how to execute the list of actions, and get the output as list. Using the following guys: sequence :: Monad m = [m a] - m [a] runGet :: Get a - ByteString - a The original question was (I believe) how to drive the parsing with a list of Actions, not the result be a list of Actions. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] internship opportunities in France
Hi, There is for instance http://gamr7.com/ They are listed in http://www.haskell.org/haskellwiki/Haskell_in_industry Cheers, Thu 2010/11/6 Corentin Dupont corentin.dup...@gmail.com: Hello, as well as I know, there is very few, if no, jobs in Haskell in France. They are much more on CAML. Corentin On Sat, Nov 6, 2010 at 9:00 PM, Lorenzo Fundaró lfund...@etu.utc.fr wrote: Hello folks ! I am a Computer Science student looking for an internship of 6 months here in France. Does anybody know of any company working with Haskell ? Thanks in advance :D, Lorenzo Fundaró García ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsing workflow
2010/10/31 Nils Schweinsberg m...@n-sch.de: Hi! I'm having a really hard time to write a correct parser for a small language I've developed. I have been trying to write a parser using parsec, but always get a lot of error messages like unexpected \n, expected ..., new-line or... when trying to run the parser. [snip] Hi, I can't really tell from your description, but maybe this is because of the way Parsec works when it deals with alternatives. When you combine several parsers with e.g. '|' or 'choice', an alternative that can consume some input but fails will make the whole combined parser fail too. So you have to either factorize you parsers or use the 'try'. See the documentation for 'try' at http://hackage.haskell.org/packages/archive/parsec/3.1.0/doc/html/Text-Parsec-Prim.html . HTH, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Regression test utility suggestions?
2010/10/21 Peter Schmitz ps.hask...@gmail.com: I am seeking suggestions for a regression test utility or framework to use while developing in Haskell (in a MS Windows environment). [snip] Hi, Have a look at HUnit and, e.g. test-framework. http://hackage.haskell.org/package/HUnit http://hackage.haskell.org/package/test-framework You would have to write some code to read the input and expected output from files. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] profiling cabal libraries
2010/10/19 Tom Hawkins tomahawk...@gmail.com: How do I profile cabal libraries? I cabal install -p a local package I am testing, and I compile a test of the library using -prof -auto-all. But the profiling report only lists a CAF entry for the library, but does not detail any of the library's top level functions. What am I doing wrong? Maybe use -auto-all for compiling the library itself too? Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: A rant against the blurb on the Haskell front page
2010/10/18 DavidA polyom...@f2s.com: Ketil Malde ketil at malde.org writes: Don Stewart dons at galois.com writes: Good start, if only the advanced were replaced with something more characteristic, like lazy, or statically typed. Which, BTW, both do not lazy and statically typed don't mean much to other people. They are buzz words that mean nothing to many people. But they /are/ defining characteristics of the language, still. I think they should be mentioned, ideally as links to separate pages (or pop-ups or a live sidebar?) that explain what they mean, and why you'd want them. -k I agree that it is important to highlight the features that are characteristic of the language. However, I would add that statically typed is a turn-off for some people, so I think it is important to add with type inference. Every once in a while, a discussion about the top-level text on Haskell.org pops in this list. Without paying much attention to this thread, and without digging the older threads, it occurs to me that different people have very different opinion on this subject. I think this is not a problem at all, because of the following thought: When someone is interested enough in a programming language to land on its homepage (i.e. haskell.org here), that someone has enough resources at her disposal to make a somewhat informed choice, and those resources can't be only a top-level text on the homepage. This means if there are a few obscure words, they can digg their meaning on their own (which is quite simple: there is a search bar on the haskell.org site, some of those words are links, they are probably viewing the site through a browser that makes it easy to search through google or another search engine). I have learned a few language and I simply can't remember a single occurence where I had some interest in a language and simply decided to learn it or not based on the top level text of its community homepage. All this means a great things: if you find Haskell or learning it valuable, you can blog about it, give your personal spin to it. People interested in Haskell will find your opinion and make a more richly informed choice. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskellers.com recent changes (and I need some volunteers)
2010/10/11 Roman Cheplyaka r...@ro-che.info: On Mon, 11 Oct 2010 11:54:12 +0100, Magnus Therning mag...@therning.org wrote: On Mon, Oct 11, 2010 at 08:37, Michael Snoyman mich...@snoyman.com wrote: [...] Also, now 10 random profiles will be displayed on the homepage. Only verified users will be displayed here. I'm also considering adding a new status as well: real picture, so that only people with real images (not cartoons, not identicons) can show up on the homepage. I think this might give a more professional feel. Thoughts? I'd be weary of making that a requirement, there are good reasons for not putting your picture on the web, just like there are good reasons to not use your real name :-) ... just like there are good reasons not to publish yourself in a public catalogue (such as haskellers.com) at all. I have nothing against anonymity. I voted against requirement of real names on hackage. But in this particular case, the whole point to be in the listing is to present yourself. So I find the above proposal very reasonable. Hi, In the belgian law, an employer can (of course) request a faithful resume, but cannot request the resume to contain a picture of you. This is a clear example where you wish to advertise yourself, but not necessarily with a picture. Anyway, I don't think it is difficult to imagine situations where one doesn't wish to show a picture of his/her face. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskellers.com profiles: advice requested
2010/10/7 Michael Snoyman mich...@snoyman.com: On Wed, Oct 6, 2010 at 8:14 PM, Brent Yorgey byor...@seas.upenn.edu wrote: One (slightly off-topic) question: at the top of the site it says the meeting place for professional Haskell programmers. Is this supposed to be geared towards Haskell programmers who get paid (or want to get paid) to write Haskell? If so, fine; if not, in my opinion the word professional ought to be dropped. The fact is that the site has two functions: on the one hand, it's simply a social network for anyone connected to the Haskell world. In that sense, the word professional is inaccurate. However, the second function is to encourage Haskell usage in industry, by showing a large number of highly qualified Haskell programmers. In this sense, the word professional is very apt. I hope the word professional isn't scaring off the hobbyists; I would definitely want them to be signing up on the site as well. But as far as the marketing of the site goes, I think our main goal should be impressing industry. Hi, Does this mean it is possible to accurately distinct a hobbyist and a highly qualified professional within the site? Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Template Haskell: hiding declarations
2010/10/4 Jonas Almström Duregård jonas.dureg...@chalmers.se: Hi Café, I'm doing some code generation with Template Haskell that results in few hundred top level declaration, of which only 10 or so should actually be exposed to the user (the rest are only used by generated code). Since I cant splice stuff into the module header (i.e. into the export list), I cant think of a good way to hide the internal declarations. One way would be to put all the declarations into one or several where-clauses, but this doesn't work very well when several functions share the hidden declarations. Also I might want to hide a few data types. Does anyone have a clever solution? Has anyone had a similar problem (maybe TH needs to be extended with support for hidden declarations)? Maybe this, although I guess this is what you mean by doesn't work very well: (a,b,c,d,...) = (a,b,c,d,...) -- those areyour top-level declarations where a = ... b = ... c = ... d = ... ... all you other code Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Platform, Hackage and Cabal : The 2nd Year : Status Report
2010/10/3 Ketil Malde ke...@malde.org: Matthias Kilian k...@outback.escape.de writes: http://www.vimeo.com/15462768 And is there any way to just *download* the video? For people not using adobe flash? +1. I'd like to watch video offline on my phone, so Flash isn't really a good option. It doesn't work on my computer either, at least not without requiring me to download Flash 10 from Adobe. http://ossguy.com/?p=172 Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: I still cannot seem to get a GUI working under Windows.
2010/10/2 Luke Palmer lrpal...@gmail.com: On Sat, Oct 2, 2010 at 4:32 AM, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello Heinrich, Saturday, October 2, 2010, 1:36:48 PM, you wrote: Would you put a flattr button [1] on the wxHaskell page? This way, people like me would be able to show their appreciation by donating a this page doesn't describe how to pay and how to got the money received. if Jeremy lives in right country, i suggest to use PayPal donations system. it allows to pay by credit card and then receive money to author's credit card Because of the way flattr distributes my money (i.e. donating has 0 marginal cost to me), I am much more likely to donate using flattr than paypal. Is it right that by using flattr, you end up donating the same amount of money to every flattred person in a month? So you can donate more the previous month to some project you value less than another project the next month. This seems weird to me. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell list on Twitter?
2010/10/1 Magnus Therning mag...@therning.org: Now that there are lists/groups on Twitter (http://mashable.com/2009/11/02/twitter-lists-guide/) maybe one should be created one for Haskellers? I would do it, but it seems I can't be on my own list :-) So unless I've missed something I'd have to create a dummy user just for this purpose. Hence I'm asking first :-) Hi, Is this what you're talking about? https://twitter.com/#!/donsbot/haskellers Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Retargeting Haskell compiler to embedded/hardware
2010/9/29 Tom Hawkins tomahawk...@gmail.com: On Tue, Sep 28, 2010 at 9:20 PM, Shakthi Kannan shakthim...@gmail.com wrote: If you are still at it, you can have a look at Chalmers Lava [1], or Kansas Lava [2]. Feldspar [3] project targets DSP though. These are examples light embedded DSLs, i.e. sophisticated libraries where you compile, then run the program to generate code. This is not what I want. Rather, I am looking for advice on how to splice GHC -- or another implementation -- where I can build a compiler starting from a type checked, simplified Haskell AST; or better yet, an unevaluated call graph. Hi Tom, How much of GHC's Haskell do you want? If you are happy with something *similar* to Haskell, did you consider to implement (or reuse if something exists) your own concrete syntax and type checker? I would think those problems are quite lightweight in regard to writing a new backend. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] capture of idioms and patterns
2010/9/24 Albert Y. C. Lai tre...@vex.net: On 10-09-23 04:57 PM, Andrew Coppin wrote: If you think that sounds silly, ask some random person (not a computer programmer, just some random human) how find the sum of a list of numbers. My reply: to sum 10 numbers, sum 9 numbers, then account for the 10th. More at: http://groups.google.com/group/comp.lang.functional/msg/51df24fbf33b7059 Ask some random person how to find page 314 in a book. No one replies check the 1st page, check the 2nd page, check the 3rd page In fact, no one replies in words. Almost everyone shows you how to cut to the middle or the estimated weighted middle (if the book seems to have 1000 pages, they cut near the one-third point), then say oh, before this or oh, after this, repeat. Almost everyone divides and conquers. Almost everyone recurses. I am not a computer programmer. (I know that someone is bound to think, when confronted with the problem of summing numbers, some people think, 'I know, I will divide and conquer'. Now they have two problems of summing numbers.) A computer scientist knows how to count the stars in the sky: simply count half of them then multiply by two. -- or something like that. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Uniting graphics libraries
2010/9/18 Tillmann Vogt tillmann.v...@rwth-aachen.de: Hi, I have nearly finished writing a Collada-output library to make 3d animation files. Before doing this I have looked at two libraries on hackage that parse Collada to display it. For my library I have copied the types from gpipe-collada and extended them. Now I am thinking that it would be nice if all 3d libraries would use the same data type. Currently gpipe-collada, graphics-formats-collada, obj, ... parse 3d-formats. FieldTrip, lambdacube-engine, ... (to mention examples) can generate and/or display 3d-objects. But they all cannot be combined without tedious type conversions. The obvious argument is that every application has its own needs. This is of course true but I think that the Collada format shows how to deal with this (you can do quite a lot with profile_common). I would be willing to write patches for some libraries and make a discussable 3d-types library based on Collada. Hi, This is a great goal! I've also been thinking in solidifying all things 3D on hackage lately and forming a game and graphics strike team. (The idea is that even if you're not interested in games, there are still a lot of common things.) Now it seems you see Collada as a good common starting point. I don't know much about Collada and I can't really say if it is a good idea or not. But by following the blender development mailing list, it seems people don't really 'trust' it, in the sense that in practice, it is still difficult to move things around between different programs through Collada... Also Collada is (I am not sure) just an interchange format and you talk about data types. Can you be a bit more specific about what you envision? Are they a direct representation of Collada? You talk about combining the different libraries on Hackage, would you like to do it through Collada? When I said I thought about solidifying things lately, I was thinking to the problem you describe but at a lower level: for instance there are many different representations for 3D vectors and transforms. Is it also a concern for you? Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Uniting graphics libraries
2010/9/18 Tillmann Vogt tillmann.v...@rwth-aachen.de: Am 18.09.2010 15:14, schrieb Vo Minh Thu: Hi, This is a great goal! I've also been thinking in solidifying all things 3D on hackage lately and forming a game and graphics strike team. (The idea is that even if you're not interested in games, there are still a lot of common things.) Now it seems you see Collada as a good common starting point. I don't know much about Collada and I can't really say if it is a good idea or not. But by following the blender development mailing list, it seems people don't really 'trust' it, in the sense that in practice, it is still difficult to move things around between different programs through Collada... Maybe the format isn't properly implemented in some programs. I have also experienced examples-files that didn't load. But it think that collada is currently the best format and it's quite powerful (shaders, physics, ...). Also Collada is (I am not sure) just an interchange format and you talk about data types. Can you be a bit more specific about what you envision? Are they a direct representation of Collada? Yes, pretty much a direct representation. But some things can be made simpler. I.e. I replace the instance_ tags with their value and have a type garantee instead of trusting that a url referenced object exists. The Collada people stress the point that its only an interchange format. But Google is using it also for delivery (Google Earth). If one can live with some seconds longer loading it is no problem. By the way wonder why Collada isn't advocating binary XML? That would make things faster. You talk about combining the different libraries on Hackage, would you like to do it through Collada? Yes, the types . I currently don't see a better way. Ok. I'll learn more about Collada then. Is your code already available somewhere? Still, Collada seems to be on a far end of the spectrum of what could be unified. I mean, say your animation has to be rendered by some Haskell code, do you wish to go through Collada or that your animation code and the rendering code share some other data structures than Collada (Or maybe Collada is just a first step?) ? If the later, it would be useful to share what those other data structures should be. When I said I thought about solidifying things lately, I was thinking to the problem you describe but at a lower level: for instance there are many different representations for 3D vectors and transforms. Is it also a concern for you? This is a problem. But I would accept a majority vote. At the moment I would use the same vector library as gpipe. Why a majority vote? Maybe we can do better: state some desired properties, benchmark the existing libraries and see if something fits? Are there other people interested in unifying the efforts here? Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] IO-oriented cache library for interacting with GUI
2010/9/16 Evan Laforge qdun...@gmail.com: 2010/9/16 Alexey Karakulov ankaraku...@gmail.com: Hi. I'm writing GUI (gtk) program which purpose is take some data as user input, perform some evaluations, and produce some plots and coefficients. Since some evaluations take significant time (about 10 seconds), I try to cache results. The problem is that dependency structure is quite complicated, something like this: You might do a search for monads for incremental computing. I skimmed the paper, but it didn't really fit my problem so I never implemented it. It sounds like your problem might be a bit closer? It seems the code from the paper is on hackage: http://hackage.haskell.org/package/Adaptive Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] benchmarking c/c++ and haskell
Thanks all for your answsers. I still wonder why some people get very different results between gcc and ghc, and some others don't. A difference in processor? I guess I will crank up a little package using criterion and producing two executables to make sure anyone who run the benchmark use the same options, and ease the whole process. Thanks, Thu 2010/9/15 Daniel Fischer daniel.is.fisc...@web.de: On Wednesday 15 September 2010 02:50:15, David Terei wrote: On 13 September 2010 20:41, Vo Minh Thu not...@gmail.com wrote: ... the post is from 2008. No LLVM goodness. So I thought GHC 6.12.1 (not the latest and greatest HEAD) would be enough. I compiled the two programs myself out of curiosity and got the following times. Linux, 64bit, Ubuntu 10.10: 1e8 clang: 0.180s gcc: 0.179s ghc 6.12.1 (viac): 0.187s ghc 6.12.1 (fasm): 0.218s ghc HEAD (viac): 0.186s ghc HEAD (fasm): 0.179s ghc HEAD (llvm): 0.174s 1e9 clang: 1.657s gcc: 1.647s ghc 6.12.1 (viac): 1.653s ghc 6.12.1 (fasm): 1.975s ghc HEAD (viac): 1.648s ghc HEAD (fasm): 1.658s ghc HEAD (llvm): 1.646s So basically all have the same time except ghc 6.12.1 where fasm is a little slow. On windows xp 32bit I get quite different results which I trust less as the times are jumping around much more then they were on linux: 1e8 gcc: 0.365s ghc 6.12.1 (viac): 5.287s ghc 6.12.1 (fasm): 1.332s ghc HEAD (viac): 5.292s ghc HEAD (fasm): 0.875s ghc HEAD (llvm): 0.359s Not sure why the results on windows are so different. I have no idea why, but I remember that on several occasions timings for via-C compiled programmes on Windows have been abysmal. Whether it's a general Windows/gcc mismatch or something GHC-specific, I've no idea (and can't find out, not having Windows). For what it's worth, the approximate timings on my 32-bit linux (openSUSE 11.1) box have been 1e8 gcc: ~0.4s 6.12.3 (viac): ~1.2s 6.12.3 (fasm): ~2.7s HEAD the same as 6.12.3 (I have deleted the programmes and I don't remember the exact timings, if you're interested, I could reconstruct them). If anyone else wants to run the two programs on Windows and check that would be great. Cheers, David ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] benchmarking c/c++ and haskell
2010/9/13 David Virebayre dav.vire+hask...@gmail.com: Does it help to compile with ghc --make -O2 -funbox-strict-fields ?? No, it doesn't. Can I assume you don't have the problem I described? Thanks, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] benchmarking c/c++ and haskell
2010/9/13 Daniel Fischer daniel.is.fisc...@web.de: On Monday 13 September 2010 11:50:14, Vo Minh Thu wrote: 2010/9/13 David Virebayre dav.vire+hask...@gmail.com: Does it help to compile with ghc --make -O2 -funbox-strict-fields ?? No, it doesn't. Can I assume you don't have the problem I described? Currently, GHC's native code generator is not too good at optimising loops. It might help if you compile via C, ghc -O2 -fexcess-precision -fvia-C -optc-O3 On my box, that gives a 2× speedup (unfortunately, that means it takes almost three times as long as the C version instead of 6×). With your options, the Haskell code is only 1.5x slower. But still... If you have the llvm backend for GHC, that is supposedly better for such code. ... the post is from 2008. No LLVM goodness. So I thought GHC 6.12.1 (not the latest and greatest HEAD) would be enough. Thanks, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] benchmarking c/c++ and haskell
Hi, I would like to benchmark C/C++ and Haskell code. The goal is to improve the Haskell port[0] of smallpt[1]. To make sure my approach was reliable, I got the code of two programs (one in C, the other in Haskell) from a post[2] by Don. The code is reproduced below. When timing the execution of both program, I have a 4x difference. It is said on the blog the programs should have similar performance. I simply don't get the reason of such a difference. I've tried the code on my Atom netbook and also on an older centrino machine. The timing are similar (i.e. the C and Haskell program show 4x difference). Both machines have GHC 6.12.1 on Linux. Would you have an idea? [0] http://hackage.haskell.org/package/smallpt-hs [1] http://www.kevinbeason.com/smallpt/ [2] http://donsbot.wordpress.com/2008/06/04/haskell-as-fast-as-c-working-at-a-high-altitude-for-low-level-performance/ $ gcc -O2 mean.c -omean-c $ ghc --make -O2 mean.hs -o mean-hs $ time ./mean-c 1e8 5000.50 real0m1.575s user0m1.513s sys 0m0.000s $ time ./mean-hs 1e8 5000.5 real0m6.997s user0m6.856s sys 0m0.013s -- file mean.hs module Main where import System.Environment import Text.Printf mean :: Double - Double - Double mean n m = go 0 0 n where go :: Double - Int - Double - Double go s l x | x m = s / fromIntegral l | otherwise = go (s+x) (l+1) (x+1) main = do [d] - map read `fmap` getArgs printf %f\n (mean 1 d) /* file mean.c */ #include stdio.h #include stdlib.h int main (int argc, char **argv) { double d = atof(argv[1]); double n; long a; double b; for (n = 1, a = 0, b = 0; n = d; b+=n, n++, a++) ; printf(%f\n, b / a); return 0; } ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] benchmarking c/c++ and haskell
2010/9/12 Andrew Coppin andrewcop...@btinternet.com: Vo Minh Thu wrote: Hi, I would like to benchmark C/C++ and Haskell code. The goal is to improve the Haskell port[0] of smallpt[1]. To make sure my approach was reliable, I got the code of two programs (one in C, the other in Haskell) from a post[2] by Don. The code is reproduced below. When timing the execution of both program, I have a 4x difference. It is said on the blog the programs should have similar performance. I simply don't get the reason of such a difference. I've tried the code on my Atom netbook and also on an older centrino machine. The timing are similar (i.e. the C and Haskell program show 4x difference). Both machines have GHC 6.12.1 on Linux. Would you have an idea? The function floor :: Double - Int is surprisingly slow under GHC. (IIRC, it's implemented by converting Double - (Int, Integer) - Int, or something equally absurd.) Poking around GHC.Prim directly allows you to do the same operation much, much faster. I couldn't say exactly how much of a difference it makes, but I've had programs go from seconds to microseconds just by switching this. http://hackage.haskell.org/trac/ghc/ticket/2271 http://hackage.haskell.org/trac/ghc/ticket/1434 My solution was to do this: http://hackage.haskell.org/packages/archive/AC-Colour/1.1.3/doc/html/src/Data-Colour-FastFloor.html Uh... good luck! o_O Thanks for the tip. But I would really get the two little programs from Don's blog to have the same performance as advertised so that I can build from there. I have to make sure things are different for a good reason, not because of a flaw in my setup (which I assume it is since I can't even get those two to run in the same time). Thanks, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Paralelism and Distribution in Haskell
2010/9/7 David Virebayre dav.vire+hask...@gmail.com: 2010/9/7 Ben Lippmeier b...@ouroborus.net: Though be warned you must use a recent GHC head build to get good performance. After GHC 7.0 is out (in a few weeks) we'll be able to release a properly stable version. Pardon a probably stupid question, but did I miss something ? http://hackage.haskell.org/trac/ghc/roadmap This is not stupid, but yes you missed something :) http://www.reddit.com/r/haskell/comments/dad6j/unless_theres_a_major_hiccup_itll_be_in_ghc_70/ Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] generating foreign Code (Java, C++, PHP)?
2010/9/7 Günther Schmidt gue.schm...@web.de: Hi list, I noticed that there are some libs / packages like atom and HJscript which allow you to write a program in a haskell EDSL and that then actually generates valid source code in another language. In the above example that would be JavaScript and C. I sure would love to be able to write PHP for instance like that but I cannot even fathom how a EDSL would have to be designed for it. Hi, Probably, the very first thing is to know what purpose the EDSL would serve. For instance, Atom is not meant as a general purpose replacement for C. Do you have something specific in mind? Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] Proposal: Form a haskell.org committee
2010/9/6 Manuel M T Chakravarty c...@cse.unsw.edu.au: Ian Lynagh: To fix this problem, we propose that we create a haskell.org committee, which is responsible for answering these sorts of questions, although for some questions they may choose to poll the community at large if they think appropriate. [..] Unfortunately, this gives us a bootstrapping problem, so we suggest that the initial committee be chosen from open nominations by some of the people who currently de-facto end up making the decisions currently: Duncan Coutts, Isaac Jones, Ian Lynagh, Don Stewart and Malcolm Wallace. These 5 would still be elligible to nominate themselves. Two of the initial members will stand down after one year, and two after two years, in order to bootstrap rolling membership turnover. Good plan! Manuel Seems very good, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] running ghci simply
2010/9/6 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com: On 6 September 2010 17:42, Johann Bach johann.bach1...@gmail.com wrote: Is there a way to run a Haskell module via ghci with a single command on the command-line? Note: I'm on Windows XP. If I have the module test.hs, I can type test.hs and that will load it into ghci. However, I need to then type main to run it, and then manually exit ghci. I would like to do all this in one step. Not sure if this will work in Windows, but you might be able to use runhaskell/runghc to run the script. Or ghc -e main test.hs Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] running ghci simply
2010/9/6 Johann Bach johann.bach1...@gmail.com: On Mon, Sep 6, 2010 at 12:51 AM, Vo Minh Thu not...@gmail.com wrote: 2010/9/6 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com: On 6 September 2010 17:42, Johann Bach johann.bach1...@gmail.com wrote: Is there a way to run a Haskell module via ghci with a single command on the command-line? Note: I'm on Windows XP. If I have the module test.hs, I can type test.hs and that will load it into ghci. However, I need to then type main to run it, and then manually exit ghci. I would like to do all this in one step. Not sure if this will work in Windows, but you might be able to use runhaskell/runghc to run the script. Or ghc -e main test.hs Cheers, Thu This seems to work. Regarding runhaskell: the last time I tried it, it compiled the program, but I want to use the interpreter. I have a script-like application in which the code will be changing frequently and I want to run it and see the results quickly. In this case, you might want to open it once in ghci and use the :r (for reload) each time you want to try a modification. This way, ghci will be quite quick to tell you any parse or type error. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] help me evangelize haskell.
2010/9/4 Michael Litchard mich...@schmong.org: I'll be starting a new job soon as systems tool guy. The shop is a perl shop as far as internal automation tasks go. But I am fortunate to not be working with bigots. If they see a better way, they'll take to it. So please give me your best arguments in favor of using haskell for task automation instead of perl, or awk or any of those scripting lanugages. Hi, At a talk presented during a Ghent FPG meeting, someone explained how they brought Ocaml to the work place. Basically, they made a drop-in replacement for a C++ (or maybe was it C) library. Less code, same or above performance. Maybe they had also a good reason to rewrite the library (because it was too big, or too difficult to maintain), not just as a proof that Ocaml was better suited. I guess that in your case, Perl for internal automation task, you should find some little tool for which it would be acceptable to dedicate some time rewriting it in Haskell. Tell us how all this unfolds. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] On to applicative
2010/8/31 michael rice nowg...@yahoo.com Learn You a Haskell ... says that (-) is a type just like Either. Where can I find its type definition? You can't define it *in* Haskell as user code. It is a built-in infix type constructor (Either or Maybe are type constructors too, not just types). In fact, if you want to implement a simple, typed functional language, you'll find it is the only built-in type constructor you have to implement (as the implementor of the language). Also, Show a = a is a type too, but you won't find a definition for 'a' or for '='. All those things are defined by the language. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] On to applicative
2010/8/31 michael rice nowg...@yahoo.com So it's a type constructor, not a type? Could you please provide a simple example of its usage? Sure, although I'm sure you've come by some already. -- the identity function id :: a - a -- often, we write it like this: -- id x = x -- but here we see the relationship between the ananymous function syntax and the function type: id = \x - x In fact, if you write in prefix form, it is quite familiar: f :: (-) Int Bool e = Either String Float Cheers, Thu Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 1:17 PM 2010/8/31 michael rice nowg...@yahoo.com Learn You a Haskell ... says that (-) is a type just like Either. Where can I find its type definition? You can't define it *in* Haskell as user code. It is a built-in infix type constructor (Either or Maybe are type constructors too, not just types). In fact, if you want to implement a simple, typed functional language, you'll find it is the only built-in type constructor you have to implement (as the implementor of the language). Also, Show a = a is a type too, but you won't find a definition for 'a' or for '='. All those things are defined by the language. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Statically tracking validity - suggestions?
2010/8/31 Andrew Coppin andrewcop...@btinternet.com: Luke Palmer wrote: I have a description of the design pattern you need, appropriately named: http://lukepalmer.wordpress.com/2009/03/24/certificate-design-pattern/ Mmm, I like that. There are two small problems: * In my web browser, some of the code snippets get the right-hand edge chopped off. * Double-precision floating-point arithmetic is inexact, so half your code won't actually work in the real world. (But obviously, it's only supposed to be an example for illustration purposes.) With regard to the second, does anybody know of anything on Hackage for testing whether two values are approximately equal? It must be a common programming problem, and it's more tricky than you think to solve it well. I think something has been added to Hackage recently about that. There is this one, but I don't know if it is the one I was thinking about. http://hackage.haskell.org/package/ieee Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] On to applicative
2010/8/31 michael rice nowg...@yahoo.com I'm not sure if my terminology is correct or even if my question makes sense, but I can create instances of Maybe, List, IO, and Either. Prelude Data.Either let m = Just 7 Prelude Data.Either :t m m :: Maybe Integer We say that m has type Maybe Integer, so :: is pronounced 'has type'. We also say that m is a value. Just is a type constructor, Maybe Int is a type, and Just 7, like m, is a value. So we don't talk about instance here. Informally you could say that 7 is an instance of Int, but in Haskell we use 'instance' to mean something (precisely) else. This pharse is correct w.r.t to the use of 'instance' in Haskell: Maybe is an instance of the Functor class. Prelude Data.Either let l = 2:[] Prelude Data.Either :t l l :: [Integer] Prelude Data.Either let g = getLine Prelude Data.Either :t g g :: IO String Prelude Data.Either let e = Right abc Prelude Data.Either :t e e :: Either a [Char] All these instances are functors, each with its own version of fmap that can be applied to it. How can I similarly create an instance of (-) so I can apply (-)'s version of fmap instance Functor ((-) r) where fmap f g = (\x - f (g x)) to it? Note that for Maybe, the instance is define with instance Functor Maybe where ... Note how the type argument of Maybe is not given. But above, when you create a value, it has type Maybe Int, not only Maybe. So for the ((-) r) case, you still want to complete it. E.g. m :: Maybe Int -- not just Maybe (+) :: (-) Int Int -- and not only (-) Int Cheers, Thu Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 1:50 PM 2010/8/31 michael rice nowg...@yahoo.com So it's a type constructor, not a type? Could you please provide a simple example of its usage? Sure, although I'm sure you've come by some already. -- the identity function id :: a - a -- often, we write it like this: -- id x = x -- but here we see the relationship between the ananymous function syntax and the function type: id = \x - x In fact, if you write in prefix form, it is quite familiar: f :: (-) Int Bool e = Either String Float Cheers, Thu Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 1:17 PM 2010/8/31 michael rice nowg...@yahoo.com Learn You a Haskell ... says that (-) is a type just like Either. Where can I find its type definition? You can't define it *in* Haskell as user code. It is a built-in infix type constructor (Either or Maybe are type constructors too, not just types). In fact, if you want to implement a simple, typed functional language, you'll find it is the only built-in type constructor you have to implement (as the implementor of the language). Also, Show a = a is a type too, but you won't find a definition for 'a' or for '='. All those things are defined by the language. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] On to applicative
2010/8/31 michael rice nowg...@yahoo.com Hi, Ryan and all, Bingo! I guess my question was all right after all. I tried creating an instance earlier but *Main :t (-) Int Char interactive:1:1: parse error on input `-' :t Int does not make sense but :t undefined :: Int is ok, just like :t undefined :: (-) Int Int What got loaded with FmapFunc? I Hoogled it and got back nothing. Michael --- On Tue, 8/31/10, Ryan Ingram ryani.s...@gmail.com wrote: From: Ryan Ingram ryani.s...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: Vo Minh Thu not...@gmail.com, haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 2:36 PM Prelude FmapFunc let s = show :: ((-) Int) String Prelude FmapFunc :t s s :: Int - String Prelude FmapFunc let v = fmap (hello ++) s Prelude FmapFunc :t v v :: Int - String Prelude FmapFunc v 1 hello 1 -- ryan On Tue, Aug 31, 2010 at 11:28 AM, michael rice nowg...@yahoo.com wrote: I'm not sure if my terminology is correct or even if my question makes sense, but I can create instances of Maybe, List, IO, and Either. Prelude Data.Either let m = Just 7 Prelude Data.Either :t m m :: Maybe Integer Prelude Data.Either let l = 2:[] Prelude Data.Either :t l l :: [Integer] Prelude Data.Either let g = getLine Prelude Data.Either :t g g :: IO String Prelude Data.Either let e = Right abc Prelude Data.Either :t e e :: Either a [Char] All these instances are functors, each with its own version of fmap that can be applied to it. How can I similarly create an instance of (-) so I can apply (-)'s version of fmap instance Functor ((-) r) where fmap f g = (\x - f (g x)) to it? Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 1:50 PM 2010/8/31 michael rice nowg...@yahoo.com So it's a type constructor, not a type? Could you please provide a simple example of its usage? Sure, although I'm sure you've come by some already. -- the identity function id :: a - a -- often, we write it like this: -- id x = x -- but here we see the relationship between the ananymous function syntax and the function type: id = \x - x In fact, if you write in prefix form, it is quite familiar: f :: (-) Int Bool e = Either String Float Cheers, Thu Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 1:17 PM 2010/8/31 michael rice nowg...@yahoo.com Learn You a Haskell ... says that (-) is a type just like Either. Where can I find its type definition? You can't define it *in* Haskell as user code. It is a built-in infix type constructor (Either or Maybe are type constructors too, not just types). In fact, if you want to implement a simple, typed functional language, you'll find it is the only built-in type constructor you have to implement (as the implementor of the language). Also, Show a = a is a type too, but you won't find a definition for 'a' or for '='. All those things are defined by the language. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] On to applicative
2010/8/31 michael rice nowg...@yahoo.com Hi Vo, Pardon, I grabbed the wrong lines. *Main :t (-) 3 abc interactive:1:1: parse error on input `-' Try *Main :t undefined :: (-) 3 abc You can't write :t some type You have to write :t some value Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: Ryan Ingram ryani.s...@gmail.com, haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 3:07 PM 2010/8/31 michael rice nowg...@yahoo.com Hi, Ryan and all, Bingo! I guess my question was all right after all. I tried creating an instance earlier but *Main :t (-) Int Char interactive:1:1: parse error on input `-' :t Int does not make sense but :t undefined :: Int is ok, just like :t undefined :: (-) Int Int What got loaded with FmapFunc? I Hoogled it and got back nothing. Michael --- On Tue, 8/31/10, Ryan Ingram ryani.s...@gmail.com wrote: From: Ryan Ingram ryani.s...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: Vo Minh Thu not...@gmail.com, haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 2:36 PM Prelude FmapFunc let s = show :: ((-) Int) String Prelude FmapFunc :t s s :: Int - String Prelude FmapFunc let v = fmap (hello ++) s Prelude FmapFunc :t v v :: Int - String Prelude FmapFunc v 1 hello 1 -- ryan On Tue, Aug 31, 2010 at 11:28 AM, michael rice nowg...@yahoo.com wrote: I'm not sure if my terminology is correct or even if my question makes sense, but I can create instances of Maybe, List, IO, and Either. Prelude Data.Either let m = Just 7 Prelude Data.Either :t m m :: Maybe Integer Prelude Data.Either let l = 2:[] Prelude Data.Either :t l l :: [Integer] Prelude Data.Either let g = getLine Prelude Data.Either :t g g :: IO String Prelude Data.Either let e = Right abc Prelude Data.Either :t e e :: Either a [Char] All these instances are functors, each with its own version of fmap that can be applied to it. How can I similarly create an instance of (-) so I can apply (-)'s version of fmap instance Functor ((-) r) where fmap f g = (\x - f (g x)) to it? Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 1:50 PM 2010/8/31 michael rice nowg...@yahoo.com So it's a type constructor, not a type? Could you please provide a simple example of its usage? Sure, although I'm sure you've come by some already. -- the identity function id :: a - a -- often, we write it like this: -- id x = x -- but here we see the relationship between the ananymous function syntax and the function type: id = \x - x In fact, if you write in prefix form, it is quite familiar: f :: (-) Int Bool e = Either String Float Cheers, Thu Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 1:17 PM 2010/8/31 michael rice nowg...@yahoo.com Learn You a Haskell ... says that (-) is a type just like Either. Where can I find its type definition? You can't define it *in* Haskell as user code. It is a built-in infix type constructor (Either or Maybe are type constructors too, not just types). In fact, if you want to implement a simple, typed functional language, you'll find it is the only built-in type constructor you have to implement (as the implementor of the language). Also, Show a = a is a type too, but you won't find a definition for 'a' or for '='. All those things are defined by the language. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] On to applicative
2010/8/31 michael rice nowg...@yahoo.com You most certainly meant Prelude Data.Either :t undefined :: (-) Int String undefined :: (-) Int String :: Int - String though it is confusing. Constructors usually take values, but here the values (-) takes are types. Either and (-) are *type* constructors. Just is a (value) constructor. This makes sense: Just 7 is a value, so Just surely constructs a value. Nothing doesn't take an argument but is called a constructor too. Maybe Int is a type, so Maybe surely constructs a type. Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: Ryan Ingram ryani.s...@gmail.com, haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 3:23 PM 2010/8/31 michael rice nowg...@yahoo.com Hi Vo, Pardon, I grabbed the wrong lines. *Main :t (-) 3 abc interactive:1:1: parse error on input `-' Try *Main :t undefined :: (-) 3 abc You can't write :t some type You have to write :t some value Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: Ryan Ingram ryani.s...@gmail.com, haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 3:07 PM 2010/8/31 michael rice nowg...@yahoo.com Hi, Ryan and all, Bingo! I guess my question was all right after all. I tried creating an instance earlier but *Main :t (-) Int Char interactive:1:1: parse error on input `-' :t Int does not make sense but :t undefined :: Int is ok, just like :t undefined :: (-) Int Int What got loaded with FmapFunc? I Hoogled it and got back nothing. Michael --- On Tue, 8/31/10, Ryan Ingram ryani.s...@gmail.com wrote: From: Ryan Ingram ryani.s...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: Vo Minh Thu not...@gmail.com, haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 2:36 PM Prelude FmapFunc let s = show :: ((-) Int) String Prelude FmapFunc :t s s :: Int - String Prelude FmapFunc let v = fmap (hello ++) s Prelude FmapFunc :t v v :: Int - String Prelude FmapFunc v 1 hello 1 -- ryan On Tue, Aug 31, 2010 at 11:28 AM, michael rice nowg...@yahoo.com wrote: I'm not sure if my terminology is correct or even if my question makes sense, but I can create instances of Maybe, List, IO, and Either. Prelude Data.Either let m = Just 7 Prelude Data.Either :t m m :: Maybe Integer Prelude Data.Either let l = 2:[] Prelude Data.Either :t l l :: [Integer] Prelude Data.Either let g = getLine Prelude Data.Either :t g g :: IO String Prelude Data.Either let e = Right abc Prelude Data.Either :t e e :: Either a [Char] All these instances are functors, each with its own version of fmap that can be applied to it. How can I similarly create an instance of (-) so I can apply (-)'s version of fmap instance Functor ((-) r) where fmap f g = (\x - f (g x)) to it? Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 1:50 PM 2010/8/31 michael rice nowg...@yahoo.com So it's a type constructor, not a type? Could you please provide a simple example of its usage? Sure, although I'm sure you've come by some already. -- the identity function id :: a - a -- often, we write it like this: -- id x = x -- but here we see the relationship between the ananymous function syntax and the function type: id = \x - x In fact, if you write in prefix form, it is quite familiar: f :: (-) Int Bool e = Either String Float Cheers, Thu Michael --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote: From: Vo Minh Thu not...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Tuesday, August 31, 2010, 1:17 PM 2010/8/31 michael rice nowg...@yahoo.com Learn You a Haskell ... says that (-) is a type just like Either. Where can I find its type definition? You can't define it *in* Haskell as user code. It is a built-in infix type constructor (Either or Maybe are type constructors too, not just types). In fact, if you want to implement a simple, typed functional language, you'll find it is the only built-in type constructor you have to implement (as the implementor of the language). Also, Show a = a is a type too, but you won't
Re: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany)
2010/8/28 Sean Leather leat...@cs.uu.nl: On Sat, Aug 28, 2010 at 01:29, Vo Minh Thu wrote: It would be interesting to know some other sources: [...] number of attendees to e.g. Utrecht summer school on FP, ... Just a bit over 30, I think. And it was interesting to see a significant number of non-student participants. Perhaps around 20%. As an aside, we had some interesting projects, too. Sokoban in curses, DSP/sound DSL, regex visualization, Bash code escaping, etc. I hope to see some of them appear on Hackage soon. That's the kind of aside that are so interesting. Please (fell free to) share some more insight of it in your blog if you've some time :) Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany)
2010/8/27 sylvain sylvain.na...@googlemail.com: Hi, the results given by the same research at the world level is worrisome: the interest in Haskell is steadily declining since 2004. Why was Haskell not successful conquering the hearts? Is it doomed to fail or is there still a chance? http://www.google.com/insights/search/#q=haskellcmpt=q BTW, who would have thought that there is so much Haskellers in Jamaica? Hi, I'm not sure if you're serious or not ... But you do realise Haskell is not a word only used to name some programming language used by fanatic hipsters [0]? Other sources show growing interest in Haskell (much to the dismay of our favorite motto). Cheers, Thu [0] http://www.sdtimes.com/blog/post/2010/07/30/Like-Ruby-n-Rails.aspx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany)
2010/8/28 sylvain sylvain.na...@googlemail.com: Hello, I'm not sure if you're serious or not ... Well, I wasn't, actually. My previous email was an eruption of second degré (I guess the closest English term would be irony). But you do realise Haskell is not a word only used to name some programming language used by fanatic hipsters [0]? Apart the programming language, I have encountered this term only as a family name. I would find interesting to know if there is a language in which this word exists and has yet another meaning. Other sources show growing interest in Haskell (much to the dismay of our favorite motto). Would you accept to refer to these other sources? I was mainly thinking to the number of people on the #haskell IRC channel, the growing number of packages on Hackage, and the growing number of Haskell-related job announcement. It would be interesting to know some other sources: number of people with Haskell-related repos on Github and other hostings, number of Haskell-related blog owners, number of attendees to e.g. Utrecht summer school on FP, ... Probably blog owners see a rise in the amount of visits they receive on their Haskell-related posts, but that would be also because their particular blog just become more well-known from people already interested in Haskell. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] On to applicative
2010/8/26 michael rice nowg...@yahoo.com From: http://en.wikibooks.org/wiki/Haskell/Applicative_Functors = import Control.Applicative f :: (a - b - c) fmap :: Functor f = (d - e) - f d - f e fmap f :: Functor f = f a - f (b - c) -- Identify d with a, and e with (b - c) sumsqr :: Int - Int - Int -- my f sumsqr i j = i*i+j*j = I'm trying to understand how the above works but... [mich...@localhost ~]$ ghci GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude :l bozo.hs [1 of 1] Compiling Main ( bozo.hs, interpreted ) bozo.hs:5:0: Invalid type signature Failed, modules loaded: none. Prelude Hi, The fifth line has the form x y :: ... instead of x :: ... This is not a legal type signature. Furthermore, you can't give fmap two signatures in the same source file. The reason this is given on the page you linked is for demonstration purpose (well, I guess, I haven't read it). Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] On to applicative
I think it works well :) But sumsqr has type Int - Int - Int, not Int - Int - Int - Int. I.e. it does take only two arguments while fmap3 takes a function of three arguments. 2010/8/26 michael rice nowg...@yahoo.com OK, fmap2 works, but not fmap3. What am I not understanding? Michael import Control.Applicative -- f :: (a - b - c) -- fmap :: Functor f = (d - e) - f d - f e sumsqr :: Int - Int - Int sumsqr i j = i*i+j*j -- fmap :: Functor f = f a - f (b - c) -- Identify d with a, and e with (b - c) fmap2 f a b = f `fmap` a * b fmap3 f a b c = f `fmap` a * b * c fmap4 f a b c d = f `fmap` a * b * c * d -- fmap2 f a b = f $ a * b -- fmap3 f a b c = f $ a * b * c -- fmap4 f a b c d = f $ a * b * c * d *Main fmap2 sumsqr (Just 3) (Just 4) Just 25 *Main fmap3 sumsqr (Just 3) (Just 4) (Just 5) interactive:1:6: Couldn't match expected type `a2 - b' against inferred type `Int' In the first argument of `fmap3', namely `sumsqr' In the expression: fmap3 sumsqr (Just 3) (Just 4) (Just 5) In the definition of `it': it = fmap3 sumsqr (Just 3) (Just 4) (Just 5) *Main --- On Thu, 8/26/10, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: From: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Thursday, August 26, 2010, 2:33 AM On 26 August 2010 16:29, michael rice nowg...@yahoo.com wrote: Can you recommend an example that works? An example of what? The definitions of fmap2, etc. on that page look like they're correct. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] On to applicative
This is indeed the case: if you want to apply your sumsqr function or Ivan's (\ x y z - z * y + z), to some Functor (Maybe in this case), you don't have to redefine them, or even to use fmap2 or fmap3: you just have to use $ and *. E.g.: (\ a b c - a + b + c) $ Just 1 * Just 2 * Just 3 2010/8/26 michael rice nowg...@yahoo.com Hmm... it was my understanding that the example was showing how to *avoid* having to create a lot of functions that do the same thing but have different numbers of arguments. From the Wiki page: Anytime you feel the need to define different higher order functions to accommodate for function-arguments with a different number of arguments, think about how defining a proper instance of Applicative can make your life easier. Not so? Michael --- On Thu, 8/26/10, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: From: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Thursday, August 26, 2010, 2:50 AM On 26 August 2010 16:47, michael rice nowg...@yahoo.com wrote: OK, fmap2 works, but not fmap3. What am I not understanding? Michael import Control.Applicative -- f :: (a - b - c) -- fmap :: Functor f = (d - e) - f d - f e sumsqr :: Int - Int - Int sumsqr i j = i*i+j*j -- fmap :: Functor f = f a - f (b - c) -- Identify d with a, and e with (b - c) fmap2 f a b = f `fmap` a * b fmap3 f a b c = f `fmap` a * b * c fmap4 f a b c d = f `fmap` a * b * c * d -- fmap2 f a b = f $ a * b -- fmap3 f a b c = f $ a * b * c -- fmap4 f a b c d = f $ a * b * c * d *Main fmap2 sumsqr (Just 3) (Just 4) Just 25 *Main fmap3 sumsqr (Just 3) (Just 4) (Just 5) interactive:1:6: Couldn't match expected type `a2 - b' against inferred type `Int' In the first argument of `fmap3', namely `sumsqr' In the expression: fmap3 sumsqr (Just 3) (Just 4) (Just 5) In the definition of `it': it = fmap3 sumsqr (Just 3) (Just 4) (Just 5) *Main sumsqr takes three arguments; fmap3 has type: fmap3 :: (a - b - c - d) - Maybe a - Maybe b - Maybe c - Maybe d i.e. the function you pass it needs to take 3 arguments. fmap3 (\ x y z - z * y + z) (Just 1) (Just 2) (Just 3) --- On Thu, 8/26/10, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: From: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com Subject: Re: [Haskell-cafe] On to applicative To: michael rice nowg...@yahoo.com Cc: haskell-cafe@haskell.org Date: Thursday, August 26, 2010, 2:33 AM On 26 August 2010 16:29, michael rice nowg...@yahoo.com wrote: Can you recommend an example that works? An example of what? The definitions of fmap2, etc. on that page look like they're correct. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] non-blocking recv from UDP socket
Hi, Is is possible to get Network.Socket.ByteString.recv to be non-blocking (i.e. return directly even if no data is available) ? I have tried ti use setSocketOption sock NoDelay 1 but then I get the following error: setSocketOption: unsupported operation (Protocol not available) Here is the code if it may help (I'm on linux btw). sock - socket AF_INET Datagram 17 -- 17 is IPPROTO_UDP addr - inet_addr 127.0.0.1 bindSocket sock (SockAddrInet 44004 addr) setSocketOption sock NoDelay 1 -- -- doesn't seem to work addr - inet_addr 127.0.0.1 forever $ do sent - sendTo sock hello (SockAddrInet 44005 addr) dat - recv sock 5 -- -- I'd like it to be non-blocking B.putStrLn dat threadDelay 100 -- 1 second Thanks, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe