Re: [Haskell-cafe] GHC 7, Platform 2011.2 vs OS X 10.5, Ubuntu 11.04
On 2011 May 23, at 16:02, Johannes Waldmann wrote: I just did this (in a pristine virtual machine): * install ubuntu-11.04-desktop-amd64.iso * sudo apt-get install libgmp3-dev zlib1g-dev libglut3-dev * install from binary ghc-7.0.3-x86_64-unknown-linux.tar.bz2 * install from source haskell-platform-2011.2.0.1.tar.gz and this definitely works, i.e. 'ghc-pkg list' shows the platform modules, and no errors. If you haven't trashed that VM yet, would you mind checking whether lambdabot cabal-installs cleanly? (Modulo giving it things that it might need such as a readline-dev package.) Thanks ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] code review?
On Mon, May 23, 2011 at 12:02 PM, Neil Mitchell ndmitch...@gmail.com wrote: 'if all == False then return False else return True' is a pretty confusing way to say 'return all'. In fact, any time you see 'x == True' you can just remove the '== True'. The whole postAll thing would be clearer as Before doing a code review I always demand that the author runs over the code with HLint (http://community.haskell.org/~ndm/hlint) - they Very good point. In fact you just inspired me to finally download it and run it on my own code. Thanks for the great tool! While I'm on the topic, I recently wrote a tool that wanted to traverse deep data structures as produced by haskell-src-exts. I wound up with about 50 lines of case expressions and around the time my hands were literally beginning to hurt decided that enough was enough and I should try a generic approach. I heard uniplate was pretty easy to use, and was pretty pleased to turn the entire thing into a single line. It took me a little longer to figure out I needed to use universeBi since all the examples were monotyped, but once I did it Just Worked. Amazing. So thanks again! And maybe you could mention universeBi in the instant introduction? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Imports in complex Setup.hs -- should we encourage/require PackageImports?
On Mon, May 23, 2011 at 3:08 PM, John Millikin jmilli...@gmail.com wrote: Any ideas/comments? Has anyone by chance found a good solution to this? I suggested a SoC project to implement a dependencies section for Setup.hs: http://hackage.haskell.org/trac/summer-of-code/ticket/1602 I wasn't aware of PackageImports -- I personally think that it's better to move the dependencies into a single place to reduce conflicts and to make it easier to identify the dependencies, but I'm open to arguments to the contrary :) In any case, this has frustrated and bitten me numerous times. I frequently want to share code between setup.hs files and I know of no clean way to do so. (apologies if this is delivered twice.. I got a mailer daemon failure the first time, so I'm manually entering the address now...) --Rogan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
Just laugh mate. It's the best possible outcomes sometimes. On 24/05/11 15:10, Gregory Crosswhite wrote: Hey everyone, Okay, this will sound silly, but I ventured into the Scala mailing list recently and asked an ignorant question on it, and I was shocked when people reacted not by enlightening me but by jumping on me and reacting with hostility. I bring this up not to badmouth the Scala community (they are apparently going through growing pains and will hopefully mature with time!) but just because it made me appreciate just how awesome you guys are, so I just feel the need to publicly express my admiration and thank to everyone on this list for having fostered such an incredibly professional, fanatically nonhostile, and generally pleasant place to talk about Haskell!!! *GROUP HUG* Okay, I'm done now. :-) Cheers, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Tony Morris http://tmorris.net/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Cabal: top level dependency base -any
Hi, Could anyone shed light on the meaning of this error message? cabal: cannot configure xmonad-0.9.1 It requires base ==3.* For the dependency on base ==3.* there are these packages: base-3.0.3.1 and base-3.0.3.2. However none of them are available. base-3.0.3.1 was excluded because of the top level dependency base -any base-3.0.3.2 was excluded because of the top level dependency base -any My guess is that -any would mean either that any version is acceptable (in which case should always work, including this time) or that -any means that any version is unacceptable, in which case it would never work, which is daft. So clearly I don't understand what it is trying to say. Any hints? Is this documented anywhere? Thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal: top level dependency base -any
Hi. Could anyone shed light on the meaning of this error message? cabal: cannot configure xmonad-0.9.1 It requires base ==3.* For the dependency on base ==3.* there are these packages: base-3.0.3.1 and base-3.0.3.2. However none of them are available. base-3.0.3.1 was excluded because of the top level dependency base -any base-3.0.3.2 was excluded because of the top level dependency base -any It's not a great error message. Yes, xmonad-0.9.1 requires base ==3.*. So far, so good. Now, base is a special package. It comes with ghc, and cannot be upgraded. That's why Cabal will rule out all base versions but the one you already have installed. If you have a recent ghc, that'll be base-4. So Cabal is correct to fail in this case: you cannot install this version of xmonad with this version of ghc. But yes, the error message could (and hopefully soon will) be improved. Cheers, Andres ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal: top level dependency base -any
On 24 May 2011 16:57, Jacek Generowicz jacek.generow...@cern.ch wrote: Hi, Could anyone shed light on the meaning of this error message? cabal: cannot configure xmonad-0.9.1 It requires base ==3.* For the dependency on base ==3.* there are these packages: base-3.0.3.1 and base-3.0.3.2. However none of them are available. base-3.0.3.1 was excluded because of the top level dependency base -any base-3.0.3.2 was excluded because of the top level dependency base -any My guess is that -any would mean either that any version is acceptable (in which case should always work, including this time) or that -any means that any version is unacceptable, in which case it would never work, which is daft. So clearly I don't understand what it is trying to say. Any hints? Yes: use xmonad-0.9,2 instead! It supports base-4, which is probably what you have (with GHC-7.0.*). -- 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
Re: [Haskell-cafe] Cabal: top level dependency base -any
On 2011 May 24, at 09:28, Andres Loeh wrote: Hi. Could anyone shed light on the meaning of this error message? cabal: cannot configure xmonad-0.9.1 It requires base ==3.* For the dependency on base ==3.* there are these packages: base-3.0.3.1 and base-3.0.3.2. However none of them are available. base-3.0.3.1 was excluded because of the top level dependency base - any base-3.0.3.2 was excluded because of the top level dependency base - any It's not a great error message. Yes, xmonad-0.9.1 requires base ==3.*. So far, so good. Now, base is a special package. It comes with ghc, and cannot be upgraded. That's why Cabal will rule out all base versions but the one you already have installed. If you have a recent ghc, that'll be base-4. So Cabal is correct to fail in this case: you cannot install this version of xmonad with this version of ghc. That makes sense. Thanks your the explanation. So would it be correct to infer that the -any restriction will only (and always) come into play with special packages such as base? Are there any other special packages besides base? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
Every computing culture is different. Being in the habit of asking questions you should be able to answer yourself is not a good idea. Why did you ask a question which you yourself characterize as ignorant? Although Haskell comm. is necessarily welcoming due to the learning curve and lack of popular adoption there are limits here too. On Tue, May 24, 2011 at 5:34 AM, max ulidtko ulid...@gmail.com wrote: 2011-05-23 22:10 -0700, Gregory Crosswhite: Hey everyone, Okay, this will sound silly, but I ventured into the Scala mailing list recently and asked an ignorant question on it, and I was shocked when people reacted not by enlightening me but by jumping on me and reacting with hostility. I bring this up not to badmouth the Scala community (they are apparently going through growing pains and will hopefully mature with time!) but just because it made me appreciate just how awesome you guys are, so I just feel the need to publicly express my admiration and thank to everyone on this list for having fostered such an incredibly professional, fanatically nonhostile, and generally pleasant place to talk about Haskell!!! *GROUP HUG* Okay, I'm done now. :-) Cheers, Greg Wow. I subscribed to the list just an hour ago or so, and already receiving hugs! That's kinda... striking, you know. Yay! Newbie hug to everyone too! - max ulidtko ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- === j...@acm.org | Juan.Daugherty on Skype | 01 716 524 0542 === ---PGP SIGNATURE Attached If Signed---= ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal: top level dependency base -any
On 2011 May 24, at 09:28, Ivan Lazar Miljenovic wrote: On 24 May 2011 16:57, Jacek Generowicz jacek.generow...@cern.ch wrote: Hi, Could anyone shed light on the meaning of this error message? cabal: cannot configure xmonad-0.9.1 It requires base ==3.* For the dependency on base ==3.* there are these packages: base-3.0.3.1 and base-3.0.3.2. However none of them are available. base-3.0.3.1 was excluded because of the top level dependency base - any base-3.0.3.2 was excluded because of the top level dependency base - any [...] Any hints? Yes: use xmonad-0.9,2 instead! It supports base-4, which is probably what you have (with GHC-7.0.*). Indeed, I discovered that to be the solution in the meantime, as I noticed that on my other system xmonad-0.9.2 was being installed by cabal install. Doing a cabal update made everything go through (with xmonad-0.9.2). Which makes me wonder why the two systems had different ideas of what the most recent xmonad version was, as I installed both of them yesterday afternoon. I seem to be discovering a rule of thumb: do a cabal update *every time* you want to cabal install. Anyway, thanks for the hint. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
On 2011 May 24, at 09:37, Juan Daugherty wrote: Every computing culture is different. Being in the habit of asking questions you should be able to answer yourself is not a good idea. Why did you ask a question which you yourself characterize as ignorant? I would guess it is because he was attempting to reduce his ignorance. That, to me, is one of the more noble reasons for asking questions. What would be the point of asking a non-ignorant question, unless it is a rhetorical one? It is tempting to infer from what you wrote above, that you believe all ignorant questions are ones which you should be able to answer yourself. I respectfully disagree. Then there is the whole class of questions which you could answer yourself, but the effort required to do so can be reduced by many orders of magnitude with some external input. Another good reason to ask questions. If you ask questions, and then stubbornly ignore good advice that people give you, then you shouldn't be surprised if they turn hostile. But if they are hostile merely because you asked an ignorant question, then I do find that surprising. Signed, an ignoramus who is constantly trying to chip away at his own ignorance (and that of others). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GOA broken with recent lambdabots
GOA is broken with recent lambdabots, according to http://hackage.haskell.org/package/goa-3.0.2 It certainly fails to compile for me (like this http://hpaste.org/46994/goa_build_failure ) From the fact that it is known to be broken, should I infer that it is a difficult problem that would take an expert a long time to fix? Or is it broken merely because nobody has got around to fixing it, and would somebody (like me) who is not a Haskell expert and has never looked into the source of lambdabot or GOA, stand a chance of fixing it? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Bytestring package: Int and Int64
Hi, cafe, I just feel curiosity. In the bytestring package, Data.ByteString module, functions like length, index, and others with Int in its type signature, have Int64 in the analogous Data.ByteString.Lazy version. What is the reason? -- Daniel Díaz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GOA broken with recent lambdabots
On 24 May 2011 10:05, Jacek Generowicz jacek.generow...@cern.ch wrote: GOA is broken with recent lambdabots, according to http://hackage.haskell.org/package/goa-3.0.2 It certainly fails to compile for me (like this http://hpaste.org/46994/goa_build_failure ) I can fix it tonight. Not a big deal. Curious; do people still use GOA? Ciao. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal: top level dependency base -any
Hi. So would it be correct to infer that the -any restriction will only (and always) come into play with special packages such as base? No. Unfortunately, -any really means any version is allowed, so that's why the error message is really misleading. Are there any other special packages besides base? W.r.t. Cabal's dependency resolution? No. Cheers, Andres ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
Why did you ask a question which you yourself characterize as ignorant? Juan, I think it is the kind of question whose answer is obvious to people with at least a little practice of the language. For instance, one of my friends asked me once why the operation of calculating the length of list has an O(n) complexity, since to his opinion, you could just store the size inside the list and increment it when elements are appended. Once you got the clue about lazy lists, the answer is obvious [1], but to a Java-trained mind, it is right it can at first sight seem like a lack of optimisation. I'm curious Gregory, what was the question you asked and how were you brushed off? And what are those troubles the Scala community is undergoing? It would be a real shame if the Scala community wasn't up to its terrific language... [1] And if it is not, then to find it your homework shall be ;) 2011/5/24 Juan Daugherty j...@acm.org Every computing culture is different. Being in the habit of asking questions you should be able to answer yourself is not a good idea. Why did you ask a question which you yourself characterize as ignorant? Although Haskell comm. is necessarily welcoming due to the learning curve and lack of popular adoption there are limits here too. On Tue, May 24, 2011 at 5:34 AM, max ulidtko ulid...@gmail.com wrote: 2011-05-23 22:10 -0700, Gregory Crosswhite: Hey everyone, Okay, this will sound silly, but I ventured into the Scala mailing list recently and asked an ignorant question on it, and I was shocked when people reacted not by enlightening me but by jumping on me and reacting with hostility. I bring this up not to badmouth the Scala community (they are apparently going through growing pains and will hopefully mature with time!) but just because it made me appreciate just how awesome you guys are, so I just feel the need to publicly express my admiration and thank to everyone on this list for having fostered such an incredibly professional, fanatically nonhostile, and generally pleasant place to talk about Haskell!!! *GROUP HUG* Okay, I'm done now. :-) Cheers, Greg Wow. I subscribed to the list just an hour ago or so, and already receiving hugs! That's kinda... striking, you know. Yay! Newbie hug to everyone too! - max ulidtko ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- === j...@acm.org | Juan.Daugherty on Skype | 01 716 524 0542 === ---PGP SIGNATURE Attached If Signed---= ___ 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] Cabal: top level dependency base -any
On 24 May 2011 18:13, Andres Loeh m...@andres-loeh.de wrote: Hi. So would it be correct to infer that the -any restriction will only (and always) come into play with special packages such as base? No. Unfortunately, -any really means any version is allowed, so that's why the error message is really misleading. Are there any other special packages besides base? W.r.t. Cabal's dependency resolution? No. Well, don't other boot libraries have similar mis-behaviour? -- 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
Re: [Haskell-cafe] GOA broken with recent lambdabots
On 2011 May 24, at 10:13, Christopher Done wrote: On 24 May 2011 10:05, Jacek Generowicz jacek.generow...@cern.ch wrote: GOA is broken with recent lambdabots, according to http://hackage.haskell.org/package/goa-3.0.2 It certainly fails to compile for me (like this http://hpaste.org/46994/goa_build_failure ) I can fix it tonight. Not a big deal. Great. Thanks. Curious; do people still use GOA? It sounds like a very useful tool, but as I have never managed to install it yet, I don't know what it will be like in reality. I do imagine myself using it though. I run GHCi within my Emacs, which allows me to interactively test ideas while I'm writing programs, and GOA promises to put so many more useful tools at my fingertips built in to the same environment. It looks *very* useful. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Status of Haskell + Mac + GUIs graphics
You can use gtkglext to get OpenGL support. With the official release of gtkglext-1.2.0 there's a bit of hacking involved (that was probably me you're referring to), but it looks like the repo head has native Quartz. With any luck, you just need to build gtkglext from the repo, then the gtkglext package. I might have some time to try this later today; I'll report back if I get results. John Lato On Tue, May 24, 2011 at 6:01 AM, Conal Elliott co...@conal.net wrote: Last I tried, there wasn't native support for OpenGL with gtk, and I need OpenGL. Then more recently, I heard of some progress in that area, but requiring lots of hacking to get it all compiling. Any recent news? - Conal On Mon, May 23, 2011 at 2:33 AM, John Lato jwl...@gmail.com wrote: Message: 17 Date: Fri, 20 May 2011 15:59:51 -0700 From: Evan Laforge qdun...@gmail.com Subject: Re: [Haskell-cafe] Status of Haskell + Mac + GUIs graphics To: Erik Hesselink hessel...@gmail.com Cc: haskell-cafe@haskell.org Message-ID: BANLkTi=74mm6ortu2e192jtoot9g49f...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Note that it is supposed to be possible to build gtk2hs with gtk+osx, which will not use X11 but use the native OS X GUI. I've not been able to get this to work, but it's been a while since I tried. The Haskell wiki mentions it doesn't support Glade, but does support Cairo. If this were to work, gtk2hs would be a serious option as well. I've tried this 3 or 4 times, and failed every time. It's crazy complicated. I used to use this combination regularly. IME the difficulties are primarily with getting a working gtk+osx build. Once that was accomplished, gtk2hs was a straightforward install, provided you build from the src repo with the -quartz flag. Recently I've switched to using macports gtk2 with the quartz, no-x11 variant, which also uses native cocoa. This is much more reliable than gtk+osx. I don't know if it supports Glade though. My biggest problem with wx is that there's no support for building 64-bit wx applications on OS X. If that were fixed I might prefer it. John Lato ___ 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] Bytestring package: Int and Int64
Hi Daniel, On Tue, May 24, 2011 at 10:07 AM, Daniel Díaz danield...@asofilak.es wrote: Hi, cafe, I just feel curiosity. In the bytestring package, Data.ByteString module, functions like length, index, and others with Int in its type signature, have Int64 in the analogous Data.ByteString.Lazy version. What is the reason? A strict ByteString is one contiguous chunk of memory so it cannot be longer than an Int (if we assume and Int is either 32 or 64 bits for a second). However, a lazily generated stream can be much bigger than main memory, so it makes sense to use a bigger type to refer to e.g. it length. Now, you might say that lazy ByteString should use Integer instead of Int64. However, Int64 performs much better so I think the loss of generality is worth it. Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
Juan Daugherty j...@acm.org writes: Every computing culture is different. Definitely. I've just given up on several cultures which are just too vitriolic. Scala is on my list of interesting stuff to look at some day, but if I'm going to be flamed for asking questions about the language, I can easily find something else to fill my time with. Being in the habit of asking questions you should be able to answer yourself is not a good idea. Maybe not. Is it a good idea to flame people who do this? If you look at two case studies: the Scala thread where Gregory was involved, and the recent mail here, basically asking for 'catMaybes'. Replying whoosh, or otherwise producing non-informative, arrogant feedback results in a long thread, culminating in a more useful answer, as well as a lot of noise. Replying with a pointer to 'catMaybes' resulted in (most likely) the author going off to finish/improve his program, and some more interesting discussion on alternative ways to do this. The point is that at face value, being rude and arrogant may drive away naive questions, but is much more likely to result in endless threads of discussions of etiquette, usually laced with ample amounts of hostility. This actually decreases signal to noise. Also it not only drives away the naive questions, it drives away the people asking them. People who might at some point become informed, contributing members of the community. I don't know, maybe Scala is big enough that they can afford to behave that way. Some people quit haskell-cafe for other (better policed?) forums, so perhaps we are too liberal? I hope not. Although Haskell comm. is necessarily welcoming due to the learning curve and lack of popular adoption there are limits here too. My theory is that flaming cultures arise around people who are technically brilliant, but somewhat lacking socially, either through arrogance or ineptitude. Members of communities where such people become central respect them for their brilliance, and then emulate, echo or support them. (I guess the implicit rationale is that if the smart people are assholes, being an asshole will make people - or myself - think I'm smart, too). Why have we managed to avoid this? Partly because of the heavy academic slant, usually academia tends to reserved politeness. Also, there's a lot of theory floating around, so although I might get impatient with some people, I can't really grow arrogant, since there's so *much* I'm obviously completely ignorant at. (Sorry about the long off-topic rant.) -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Cabal: disabling -fvia-C
I hope you will pardon another *ignorant* question. 'cabal install lambdabot' fails on Ubuntu Natty. According to the following exchange and bug report http://comments.gmane.org/gmane.comp.lang.haskell.cafe/88735 http://hackage.haskell.org/trac/ghc/ticket/5050 the workaround is not to use -fvia-C. I have found an {-# OPTION -fvia-C #-} deep inside the lambdabot code in Plugin/Pl/Common.hs. How can I tell cabal install to ignore this? Is there some command line option for doing so, or do I have to edit the source code and somehow persuade cabal to use my hacked version ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
I've been lurking around, and yes, I also think the Haskell community is very civilized. I think having people asking all kinds of questions is a good sign that people are interested. And as a member of the community, especially if you are an experienced member (i.e. you have invested time and energy in this because you like this technology), it is probably a good thing for you too if the community is vibrant, and if it attracts new members. Sometimes, you know the question is dumb, and you have a huntch that the answer is very simple, but it just doesn't click. You might stare at it for hours or days, without any solution, and it might probably take someone a fraction of a second to point it out, and just a little hint, and you are set to go. That's why it's very important to be nice to newbies or oldies, even if you think the question is really dumb. I've been writing C/C++ for over 15 years, and Java over 10 years. On a daily basis. But sometimes, I can stare at a f*ing error and have no clue why it is an error. When I learn to program Haskell, I'm just lurking around to see how is the community before committing time and energy on it. So yes, please keep it that way. xp ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal: disabling -fvia-C
On 2011 May 24, at 11:12, Jacek Generowicz wrote: I have found an {-# OPTION -fvia-C #-} deep inside the lambdabot code in Plugin/Pl/Common.hs. How can I tell cabal install to ignore this? Is there some command line option for doing so, or do I have to edit the source code and somehow persuade cabal to use my hacked version ? The edited source code is ignored by cabal install. However, if you tar.gz the edited source code and replace the original tarball (making sure that you do *not* remove the untarred directory (it seems that you can remove its contents, but not the directory itself)), then cabal install works and lambdabot installs. But I can't help feeling that this is not the smartest way to solve this problem. It looks like a random solution achieved by someone who doesn't understand what is going on. Is there a more sensible way to do this? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Cabal upload failure
Hello! I'm trying to upload a new version of syntactic, but Hackage gives the error: 500 Internal Server Error stdin: hWaitForInput: invalid argument (Invalid or incomplete multibyte or wide character) In fact, I get the same error if I use the Check functionality on the earlier version that is already on Hackage. Any idea what causes this? / Emil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal: disabling -fvia-C
On Tue, 24 May 2011, Jacek Generowicz wrote: On 2011 May 24, at 11:12, Jacek Generowicz wrote: I have found an {-# OPTION -fvia-C #-} deep inside the lambdabot code in Plugin/Pl/Common.hs. How can I tell cabal install to ignore this? Is there some command line option for doing so, or do I have to edit the source code and somehow persuade cabal to use my hacked version ? The edited source code is ignored by cabal install. However, if you tar.gz the edited source code and replace the original tarball (making sure that you do *not* remove the untarred directory (it seems that you can remove its contents, but not the directory itself)), then cabal install works and lambdabot installs. You cannot only run $ cabal install lambdabot but you can also switch to lambdabot source directory and call lambdabot$ cabal install ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [GeekUp] Functional Programming Night at GeekUp Liverpool May
Our night of FP-related talks in Liverpool (UK) is next week, on Tuesday 31st! I'll be giving a brief (and fairly high level) overview of solving a real world problem in Haskell, namely how to model and take quizzes with randomly chosen questions and sections. There'll also be a talk on a Clojure (a modern Lisp), and another on implementation (again, of Lisp). Would be great to meet up with some haskell-cafe people there, if anyone can make it! osfameron On 6 May 2011 15:19, Hakim Cassimally hakim.cassima...@gmail.com wrote: If anyone's in Northwest UK on Tuesday 31st May, why not come to Geekup's first ever Functional Programming Night? http://lanyrd.com/2011/geekup-liverpool-may/ It'll mostly consist of 3 short talks on Haskell, Lisp, and Clojure: * Haskell in the Real World (Hakim @osfameron) * Implenting a Lisp interpreter in .Net (Simon Johnson) * Clojure: why you should be interested in a 50 year old language (Tom Mortimer-Jones @morty_uk) There will also be beer! The talks are likely to be more general interest than assuming deep knowledge of FP, but it would be great to meet anyone around UK NW to gauge interest in more in-depth sessions sometime in the future! Hakim -- Forwarded message -- From: John McKerrell mck...@gmail.com Date: 6 May 2011 15:10 Subject: [GeekUp] Functional Programming Night at GeekUp Liverpool May To: gee...@googlegroups.com Just wanted to announce May's GeekUp properly. We'll be having a Functional Programming Extravaganza with three (count em', 3!) talks from Hakim Cassimally, Simon Johnson and Tom Mortimer-Jones. Meeting in 3345 on Parr Street as ever, talks starting at 7pm but turn up from 6:30 and we'll be chatting over beer in the bar. Turn-out has been great for the recent events but we're always happy to welcome more people, there's more information on lanyrd: http://lanyrd.com/2011/geekup-liverpool-may/ Let us know you're coming by signing up on that link but feel free to turn up anyway, attendance is free and open to all comers of course. John -- http://geekup.org/ | http://geekup.org/wiki/ | http://jobboard.geekup.org/ To post e-mail: gee...@googlegroups.com Or go online: http://groups.google.com/group/geekup/ To unsubscribe e-mail: geekup+unsubscr...@googlegroups.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hackage internal server error
nibro@nibro-laptop:~/src/haskell-src-exts$ cabal sdist Building source dist for haskell-src-exts-1.11.1... Preprocessing library haskell-src-exts-1.11.1... Source tarball created: dist/haskell-src-exts-1.11.1.tar.gz nibro@nibro-laptop:~/src/haskell-src-exts$ cabal upload dist/haskell-src-exts-1.11.1.tar.gz Hackage username: NiklasBroberg Hackage password: Uploading dist/haskell-src-exts-1.11.1.tar.gz... Error: dist/haskell-src-exts-1.11.1.tar.gz: 500 Internal Server Error 500 Internal Server Error stdin: hWaitForInput: invalid argument (Invalid or incomplete multibyte or wide character) nibro@nibro-laptop:~/src/haskell-src-exts$ Hackage's fault, cabal's fault, or (*gasp*) mine? Cheers, /Niklas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal: disabling -fvia-C
On 2011 May 24, at 11:49, Henning Thielemann wrote: You cannot only run $ cabal install lambdabot but you can also switch to lambdabot source directory and call lambdabot$ cabal install Ah. That's useful. I tried manually going through the Cabal song and dance in that directory, but it failed to find the dependencies, which presumably will be managed by your suggestion. Thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal upload failure
On 24 May 2011 19:48, Emil Axelsson e...@chalmers.se wrote: Hello! I'm trying to upload a new version of syntactic, but Hackage gives the error: 500 Internal Server Error stdin: hWaitForInput: invalid argument (Invalid or incomplete multibyte or wide character) In fact, I get the same error if I use the Check functionality on the earlier version that is already on Hackage. Any idea what causes this? Do you have any comments or something somewhere that are in a non-UTF8 encoding? -- 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
Re: [Haskell-cafe] Cabal upload failure
On 24 May 2011 19:48, Emil Axelsson e...@chalmers.se wrote: Hello! I'm trying to upload a new version of syntactic, but Hackage gives the error: 500 Internal Server Error stdin: hWaitForInput: invalid argument (Invalid or incomplete multibyte or wide character) In fact, I get the same error if I use the Check functionality on the earlier version that is already on Hackage. Any idea what causes this? I have the exact same issue, I mailed about it some 10 minutes before you. So I believe this is Hackage's fault. Cheers, /Niklas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal upload failure
2011-05-24 12:05, Niklas Broberg skrev: On 24 May 2011 19:48, Emil Axelsson e...@chalmers.se mailto:e...@chalmers.se wrote: Hello! I'm trying to upload a new version of syntactic, but Hackage gives the error: 500 Internal Server Error stdin: hWaitForInput: invalid argument (Invalid or incomplete multibyte or wide character) In fact, I get the same error if I use the Check functionality on the earlier version that is already on Hackage. Any idea what causes this? I have the exact same issue, I mailed about it some 10 minutes before you. Aha, so maybe it's a local problem :) So I believe this is Hackage's fault. Yes, and as I said, it gives the same error for a tarball that was already accepted by Hackage, namely: http://hackage.haskell.org/packages/archive/syntactic/0.2.0.1/syntactic-0.2.0.1.tar.gz 2011-05-24 12:00, Ivan Lazar Miljenovic skrev: Do you have any comments or something somewhere that are in a non-UTF8 encoding? No, not conciously at least... / Emil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Bytestring package: Int and Int64
On Tue, 24 May 2011 10:42:34 +0200, Johan Tibell wrote: Hi Daniel, On Tue, May 24, 2011 at 10:07 AM, Daniel Díaz danield...@asofilak.es wrote: Hi, cafe, I just feel curiosity. In the bytestring package, Data.ByteString module, functions like length, index, and others with Int in its type signature, have Int64 in the analogous Data.ByteString.Lazy version. What is the reason? A strict ByteString is one contiguous chunk of memory so it cannot be longer than an Int (if we assume and Int is either 32 or 64 bits for a second). However, a lazily generated stream can be much bigger than main memory, so it makes sense to use a bigger type to refer to e.g. it length. Now, you might say that lazy ByteString should use Integer instead of Int64. However, Int64 performs much better so I think the loss of generality is worth it. Johan Thanks, it makes sense. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] lambdabot check
I've installed lambdabot, but check within it seems to be broken: the only answer it ever gives is Terminated. For example: lambdabot check True Terminated lambdabot quickCheck works just fine in a GHCi session: Prelude :m + Test.QuickCheck [...] Prelude quickCheck True [...] +++ OK, passed 100 tests. (GHC 7.0.3 on Ubuntu Natty, everything freshly installed with cabal install as far as possible.) Any advice? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
Hi Gregory, I had a similar experience on the scala-user list some time ago. I found most of the responses to my questions to be rather unproductive and superficial. I love the haskell-cafe community for their helpfulness and analytical approach. I left scala-user not long afterward partly because of the aforementioned issues and partly because lurking there and reading threads did not provide any enlightenment on using Scala. With haskell-cafe, I can just read and (attempt to) absorb new knowledge. At least for me, the signal-to-noise ratio is higher on haskell-cafe than scala-user. (YMMV, of course.) I'm not sure that the problem for the Scala community is growing pains. The Haskell community has been this way from the very beginning. In fact, the growing mix of people introduced to Haskell has lead to a great diversity of reactions: academic, hobbyist, getting-things-done, etc. For Scala, I think it's really due to the type of people that are attracted to the community. My impression is that more people are coming from Java programming than from academia. This probably has an effect on the community dynamics. (This is not meant to slight Java programmers. Rather, I think that the common perspective is more that of getting-things-done than deep-insight-into-the-problem.) I also applaud the Haskell community for being very open and helpful. I would like to thank everyone who contributes to this environment. Group hug, indeed! ;) Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] SIGSEGV in yieldCapability ()
On 23/05/2011 09:55, Erik Hesselink wrote: On Sun, May 22, 2011 at 15:03, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote: I think you should file a bug report with a test case on GHC. I am willing to work on this, but I thought I'd go fishing for some advice first. My program uses: forkIO, STM, and FFI. I've seen something like this, using only forkIO, so I'd start looking there. I was trying to create a reduced test case, but haven't reported a bug yet. I think that heap exhausted sometimes gets reported as evacuate: strange closure, (cf. http://hackage.haskell.org/trac/ghc/ticket/5085 ) and yieldCapability() might be another instance. Thank you, we just had this message, and I had no idea what it was. Please report all crashes like this as bugs: http://hackage.haskell.org/trac/ghc/wiki/ReportABug In particular, the RTS should never trigger a crash in a heap exhausted situation - if some documentation somewhere gives the wrong impression about that, please let me know. I will need a reproducible test case to track down the bug, though. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
For Scala, I think it's really due to the type of people that are attracted to the community. My impression is that more people are coming from Java programming than from academia. Java developpers who whould be interested in doing things in a clean, expressive and manageable way? Maybe salvation is on sale today... (Btw, this *is** *meant to slight Java programmers ^^). |--| | Please do not feed the troll* | |-||---**| || || || || || * 2011/5/24 Sean Leather leat...@cs.uu.nl Hi Gregory, I had a similar experience on the scala-user list some time ago. I found most of the responses to my questions to be rather unproductive and superficial. I love the haskell-cafe community for their helpfulness and analytical approach. I left scala-user not long afterward partly because of the aforementioned issues and partly because lurking there and reading threads did not provide any enlightenment on using Scala. With haskell-cafe, I can just read and (attempt to) absorb new knowledge. At least for me, the signal-to-noise ratio is higher on haskell-cafe than scala-user. (YMMV, of course.) I'm not sure that the problem for the Scala community is growing pains. The Haskell community has been this way from the very beginning. In fact, the growing mix of people introduced to Haskell has lead to a great diversity of reactions: academic, hobbyist, getting-things-done, etc. For Scala, I think it's really due to the type of people that are attracted to the community. My impression is that more people are coming from Java programming than from academia. This probably has an effect on the community dynamics. (This is not meant to slight Java programmers. Rather, I think that the common perspective is more that of getting-things-done than deep-insight-into-the-problem.) I also applaud the Haskell community for being very open and helpful. I would like to thank everyone who contributes to this environment. Group hug, indeed! ;) Regards, Sean ___ 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] *GROUP HUG*
Well, Yves, we can't know since the question in question was about Scala not Haskell. I think some respondents are confusing the sensed of ignorant conveyed with the objective condition of a lack of knowledge. In any case, IMHO IRC or some other similar real-time venue and not a mailing list is the proper place for such queries. On Tue, May 24, 2011 at 4:06 AM, Yves Parès limestr...@gmail.com wrote: Why did you ask a question which you yourself characterize as ignorant? Juan, I think it is the kind of question whose answer is obvious to people with at least a little practice of the language. For instance, one of my friends asked me once why the operation of calculating the length of list has an O(n) complexity, since to his opinion, you could just store the size inside the list and increment it when elements are appended. Once you got the clue about lazy lists, the answer is obvious [1], but to a Java-trained mind, it is right it can at first sight seem like a lack of optimisation. I'm curious Gregory, what was the question you asked and how were you brushed off? And what are those troubles the Scala community is undergoing? It would be a real shame if the Scala community wasn't up to its terrific language... [1] And if it is not, then to find it your homework shall be ;) 2011/5/24 Juan Daugherty j...@acm.org Every computing culture is different. Being in the habit of asking questions you should be able to answer yourself is not a good idea. Why did you ask a question which you yourself characterize as ignorant? Although Haskell comm. is necessarily welcoming due to the learning curve and lack of popular adoption there are limits here too. On Tue, May 24, 2011 at 5:34 AM, max ulidtko ulid...@gmail.com wrote: 2011-05-23 22:10 -0700, Gregory Crosswhite: Hey everyone, Okay, this will sound silly, but I ventured into the Scala mailing list recently and asked an ignorant question on it, and I was shocked when people reacted not by enlightening me but by jumping on me and reacting with hostility. I bring this up not to badmouth the Scala community (they are apparently going through growing pains and will hopefully mature with time!) but just because it made me appreciate just how awesome you guys are, so I just feel the need to publicly express my admiration and thank to everyone on this list for having fostered such an incredibly professional, fanatically nonhostile, and generally pleasant place to talk about Haskell!!! *GROUP HUG* Okay, I'm done now. :-) Cheers, Greg Wow. I subscribed to the list just an hour ago or so, and already receiving hugs! That's kinda... striking, you know. Yay! Newbie hug to everyone too! - max ulidtko ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- === j...@acm.org | Juan.Daugherty on Skype | 01 716 524 0542 === ---PGP SIGNATURE Attached If Signed---= ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- === j...@acm.org | Juan.Daugherty on Skype | 01 716 524 0542 === ---PGP SIGNATURE Attached If Signed---= ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC 7, Platform 2011.2 vs OS X 10.5, Ubuntu 11.04
* install ubuntu-11.04-desktop-amd64.iso * sudo apt-get install libgmp3-dev zlib1g-dev libglut3-dev * install from binary ghc-7.0.3-x86_64-unknown-linux.tar.bz2 * install from source haskell-platform-2011.2.0.1.tar.gz If you haven't trashed that VM yet, would you mind checking whether lambdabot cabal-installs cleanly? (Modulo giving it things that it might need such as a readline-dev package.) sudo apt-get install libreadline-dev cabal install lambdabot gives the error (.size expression ... does not evaluate to a constant) that was mentioned in another thread http://hpaste.org/46401/bot_install_error ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
Yves Parès limestrael at gmail.com writes: For instance, one of my friends asked me once why the operation of calculating the length of list has an O(n) complexity, since to his opinion, you could just store the size inside the list and increment it when elements are appended. Then tell me, why does calculating the length of a (Haskell) list has O(n) complexity. I could just store the length of the list - as an additional argument to the Cons constructor that is automatically initialized on construction (and you never need to change it later, since Haskell objects are immutable, in the words of Java programmers) In Haskell, the reason for not doing this (besides simplicity, and inertia) actually is (I think) laziness: you don't want to evaluate the length field of the second argument of the cons prematurely. Well, unless you look at the length field of the constructed object, it won't be evaluated, but a pile of thunks will be constructed instead, and I think that's what you really want to avoid. On the other hand, there are implementations of strict sequences with an O(1) size implemenation. http://hackage.haskell.org/packages/archive/containers/0.4.0.0/doc/html/Data-Sequence.html#v:length J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal upload failure
Version skew problem -- I hope it's fixed now. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal: disabling -fvia-C
Henning Thielemann, Tuesday, May 24, 2011 On Tue, 24 May 2011, Jacek Generowicz wrote: On 2011 May 24, at 11:12, Jacek Generowicz wrote: I have found an {-# OPTION -fvia-C #-} deep inside the lambdabot code in Plugin/Pl/Common.hs. How can I tell cabal install to ignore this? Is there some command line option for doing so, or do I have to edit the source code and somehow persuade cabal to use my hacked version ? The edited source code is ignored by cabal install. However, if you tar.gz the edited source code and replace the original tarball (making sure that you do *not* remove the untarred directory (it seems that you can remove its contents, but not the directory itself)), then cabal install works and lambdabot installs. You cannot only run $ cabal install lambdabot but you can also switch to lambdabot source directory and call lambdabot$ cabal install Those two options cover the building. Putting a .tar.gz in the cabal package directory might be a bit more convenient if you use cabal-dev, or otherwise have to frequently rebuild packages. If you are going to write other code that depends on your fix to the package, you should probably increase the version number in the modified package, so you don't copy your project to another system and take a while to realize it's getting the hackage version of the dependency, rather than your fix. This probably isn't an issue with lambdabot. Brandon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] code review?
Evan Laforge qdunkan at gmail.com writes: [...] a tool that wanted to traverse deep data structures as produced by haskell-src-exts. [...] I heard uniplate was pretty easy to use, and was pretty pleased to turn the entire thing into a single line. Please post that line here - J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal: wrapping namespace of a package into top-level module
- Original Message - From: max ulidtko ulid...@gmail.com To: haskell-cafe@haskell.org Cc: Sent: Monday, May 23, 2011 11:38 PM Subject: [Haskell-cafe] Cabal: wrapping namespace of a package into top-level module Hi haskell-cafe. I have a package which builds with cabal pretty fine, but there is namespace issue which disturbs me. The problem is that the package exports (to the toplevel namespace!) some modules with fairly general names, like Tests, Basics, Applications. This is probably an oversight of the original package author, and the namespace shouldn't be organised like this... but it is. And I'm looking for a way to avoid potential namespace troubles should I install the package, other than going and reforming the namespace tree myself. Whatever you do, you should mail the package author suggesting a better organization (including a patch, if you do reorganize the module yourself). I think there are three options with current tools 1) If you don't actually want to make modules with those names, it might not be a problem for now. Just like you don't get errors from importing multiple modules with conflicting identifiers unless you actually use the identifiers, there shouldn't be errors if you happen to use two packages defining a module with the same name, unless you actually try to import that module. 2) If you do want to reorganize the package, I think a textual replace changing the old fully-qualified names to the new should work. Here are some suggestions for automating it with various little unix tools, but I haven't tried on a nontrivial package. mkdir -p New/Prefix/ mv $SOURCEDIRS New/Prefix/ sed -n '/exposed-modules/,/:/p' $PKG.cabal | grep -v : | tr -d '[[:blank:]]' modules awk '{print ,s/$0/New.Prefix.$0/g} END {print wq}' rename.ed find . -name '*.hs' -exec ed {} rename.ed \; If you decide to write your program against the current names while waiting for the author to change them, the same sort of thing should work for updating module names in your program. 3) There's also package-qualified imports, but I don't think you should use them - if there are actually conflicts on those top-level module names, the package should be fixed sooner rather than later. www.haskell.org/ghc/docs/7.0.3/html/users_guide/syntax-extns.html#package-imports What I was thinking about was some cabal option to wrap package's namespace into a toplevel module, say PackageName, so that module Tests could be imported by usual code with `import PackageName.Tests`. Is that possible with cabal? Things are further complicated by the numerous intra-library imports. While the outside code refers to a module with PackageName.ModuleName, it would be very desirable that inside code used just straight ModuleName. It's been discussed before, but not implemented http://hackage.haskell.org/trac/ghc/wiki/Commentary/Packages/PackageMountingProposal Brandon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage internal server error
On Tue, May 24, 2011 at 2:52 AM, Niklas Broberg niklas.brob...@gmail.com wrote: nibro@nibro-laptop:~/src/haskell-src-exts$ cabal sdist Building source dist for haskell-src-exts-1.11.1... Preprocessing library haskell-src-exts-1.11.1... Source tarball created: dist/haskell-src-exts-1.11.1.tar.gz nibro@nibro-laptop:~/src/haskell-src-exts$ cabal upload dist/haskell-src-exts-1.11.1.tar.gz Hackage username: NiklasBroberg Hackage password: Uploading dist/haskell-src-exts-1.11.1.tar.gz... Error: dist/haskell-src-exts-1.11.1.tar.gz: 500 Internal Server Error 500 Internal Server Error stdin: hWaitForInput: invalid argument (Invalid or incomplete multibyte or wide character) nibro@nibro-laptop:~/src/haskell-src-exts$ Hackage's fault, cabal's fault, or (*gasp*) mine? Here's my guess - there is a character in some non-unicode encoding in one of the names in the cabal file. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
In Haskell, the reason for not doing this (besides simplicity, and inertia) actually is (I think) laziness: you don't want to evaluate the length field of the second argument of the cons prematurely. Yes, this is what I meant. I shouldn't have spoken about complexity, it was irrelevant as you pointed it out. 2011/5/24 Johannes Waldmann waldm...@imn.htwk-leipzig.de Yves Parès limestrael at gmail.com writes: For instance, one of my friends asked me once why the operation of calculating the length of list has an O(n) complexity, since to his opinion, you could just store the size inside the list and increment it when elements are appended. Then tell me, why does calculating the length of a (Haskell) list has O(n) complexity. I could just store the length of the list - as an additional argument to the Cons constructor that is automatically initialized on construction (and you never need to change it later, since Haskell objects are immutable, in the words of Java programmers) In Haskell, the reason for not doing this (besides simplicity, and inertia) actually is (I think) laziness: you don't want to evaluate the length field of the second argument of the cons prematurely. Well, unless you look at the length field of the constructed object, it won't be evaluated, but a pile of thunks will be constructed instead, and I think that's what you really want to avoid. On the other hand, there are implementations of strict sequences with an O(1) size implemenation. http://hackage.haskell.org/packages/archive/containers/0.4.0.0/doc/html/Data-Sequence.html#v:length J.W. ___ 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] *GROUP HUG*
And I thought Hugs was dead. :-) On 24 May 2011 06:10, Gregory Crosswhite gcr...@phys.washington.edu wrote: Hey everyone, Okay, this will sound silly, but I ventured into the Scala mailing list recently and asked an ignorant question on it, and I was shocked when people reacted not by enlightening me but by jumping on me and reacting with hostility. I bring this up not to badmouth the Scala community (they are apparently going through growing pains and will hopefully mature with time!) but just because it made me appreciate just how awesome you guys are, so I just feel the need to publicly express my admiration and thank to everyone on this list for having fostered such an incredibly professional, fanatically nonhostile, and generally pleasant place to talk about Haskell!!! *GROUP HUG* Okay, I'm done now. :-) Cheers, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Colin Adams Preston, Lancashire, ENGLAND () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
On 24 May 2011 13:41, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote: I could just store the length of the list - as an additional argument to the Cons constructor that is automatically initialized on construction (and you never need to change it later, since Haskell objects are immutable, in the words of Java programmers) In Haskell, the reason for not doing this (besides simplicity, and inertia) actually is (I think) laziness: you don't want to evaluate the length field of the second argument of the cons prematurely. Neither OCaml nor PLT Scheme cache the length or they didn't a year of two ago when someone asked this question on the Haskell Beginners list and I checked the respective source trees. As the PLT Scheme list was implemented in C at the time (maybe it still is?) I was a bit surprised by this. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] code review?
On Tue, May 24, 2011 at 6:47 AM, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote: Evan Laforge qdunkan at gmail.com writes: [...] a tool that wanted to traverse deep data structures as produced by haskell-src-exts. [...] I heard uniplate was pretty easy to use, and was pretty pleased to turn the entire thing into a single line. Please post that line here - J.W. Getting a bit off subject, and it's nothing special: moduleQNames :: Types.Module - [Types.Qualification] moduleQNames mod = [Types.qualification m | Haskell.Qual _ m _ - Uniplate.universeBi mod] But just try writing this without a generics library :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] code review?
Before doing a code review I always demand that the author runs over the code with HLint (http://community.haskell.org/~ndm/hlint) - they Very good point. In fact you just inspired me to finally download it and run it on my own code. Thanks for the great tool! Glad you like it. While I'm on the topic, I recently wrote a tool that wanted to traverse deep data structures as produced by haskell-src-exts. I wound up with about 50 lines of case expressions and around the time my hands were literally beginning to hurt decided that enough was enough and I should try a generic approach. I heard uniplate was pretty easy to use, and was pretty pleased to turn the entire thing into a single line. It took me a little longer to figure out I needed to use universeBi since all the examples were monotyped, but once I did it Just Worked. Amazing. So thanks again! And maybe you could mention universeBi in the instant introduction? Yes, I probably should - I'll try and get to that. Of course, I'd also happily accept a patch against http://community.haskell.org/~ndm/darcs/uniplate I use Uniplate inside HLint, and it's invaluable - there are a lot of times when List Comp + universeBi really hits the spot. Thanks, Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
On May 24, 2011, at 4:46 AM, Ketil Malde wrote: Replying with a pointer to 'catMaybes' resulted in (most likely) the author going off to finish/improve his program, and some more interesting discussion on alternative ways to do this. What's more, the thread added many other possible implementations, and a discussion why using filter ((/=) Nothing) is a bad thing (even though it seems like a nice and simple check) because it adds an additional Eq constraint an whatever is inside the Maybe. I think THAT, ie, not only accepting and giving useful answers to simple questions, but even expanding upon them and using them as learning tools for more advanced topics, is what makes the haskell community such a fun place to be. Because while I, a medium level haskell noobie, already knew about the catMaybes function and could have built the filters or searched on Hoogle for it, I had not thought about the advantages to using isNothing instead of (== Nothing), or that there was any difference at all.___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
Firstly, I would definitely like to second the group hug! I'd say best learning community on the net, that I know of. On 5/24/11, Ketil Malde ke...@malde.org wrote: The point is that at face value, being rude and arrogant may drive away naive questions, but is much more likely to result in endless threads of discussions of etiquette, usually laced with ample amounts of hostility. This actually decreases signal to noise. Also it not only drives away the naive questions, it drives away the people asking them. People who might at some point become informed, contributing members of the community. It also drives away people who don't know if their question is naive or not. When you don't want to be yelled at, you have a strong tendency to err on the side of not asking. This slows down learning significantly, and decreases the number of people who can answer others' questions in the future. Some people quit haskell-cafe for other (better policed?) forums, so perhaps we are too liberal? I hope not. Does anybody know how much this has happened? I'm very interested in how we can maintain this amazing resource as Haskell's user base grows. Will the same etiquette work when we start to get lots of questions from Java programmers? :) Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
Will the same etiquette work when we start to get lots of questions from Java programmers? :) If you mean will we have to maintain the same etiquette? then, sadly, yes. (And I said we were done trolling! ;) ) 2011/5/24 Tom Murphy amin...@gmail.com Firstly, I would definitely like to second the group hug! I'd say best learning community on the net, that I know of. On 5/24/11, Ketil Malde ke...@malde.org wrote: The point is that at face value, being rude and arrogant may drive away naive questions, but is much more likely to result in endless threads of discussions of etiquette, usually laced with ample amounts of hostility. This actually decreases signal to noise. Also it not only drives away the naive questions, it drives away the people asking them. People who might at some point become informed, contributing members of the community. It also drives away people who don't know if their question is naive or not. When you don't want to be yelled at, you have a strong tendency to err on the side of not asking. This slows down learning significantly, and decreases the number of people who can answer others' questions in the future. Some people quit haskell-cafe for other (better policed?) forums, so perhaps we are too liberal? I hope not. Does anybody know how much this has happened? I'm very interested in how we can maintain this amazing resource as Haskell's user base grows. Will the same etiquette work when we start to get lots of questions from Java programmers? :) Tom ___ 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] [Maybe Int] sans Nothings
On Mon, May 23, 2011 at 6:21 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On 24/05/2011, at 5:49 AM, Alexander Solla wrote: There's a library function for it, but also: filter ((/=) Nothing) The problem with that in general is that it only applies to [Maybe t] if Eq t, but you don't actually _need_ t to support equality. filter isJust will do the job, where isJust is in Data.Maybe. Indeed, isJust will do the job. Sometimes it is acceptable to just use the tools you know. For example, filtering a list of (Maybe Int)s. This is a balance that is tough to get right. Personally, I find non-functional values without Eq instances to be degenerate. So I really do not mind superfluous Eq constraints. I would not hesitate to use filter ((/=) Nothing) in a function whose type has no free type variables. It's just a bit of plumbing inside of a more complex function. But the point of avoiding unnecessary constraints is a good one, especially for constraints that constrain more strongly, e.g., Ord. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: HaNS-2.1.0.0
Galois, Inc. is pleased to announce the release of HaNS, the Haskell Network Stack. HaNS is a lightweight, pure Haskell network stack that can be used for Haskell networking in the context of the HaLVM, or with a Linux tap device. Currently, HaNS supports 802.3, IPv4, ARP, DHCP (partially), ICMP, UDP, and TCP. On Hackage: http://hackage.haskell.org/package/HaNS Git repo: http://code.galois.com/cgi-bin/gitweb The TCP component is a port of Peng Li and Stephan Zdancewic's Haskell TCP library, which in turn was translated from Norrish et al's HOL4 TCP specification. What might you use HaNS for? Developing new and interesting networking protocols, at any layer of the network stack, or your own variants of existing protocols. HaNS allows HaLVM nodes to support networking, meaning you can run experimental network services directly on top of the HaLVM (without any pesky OS getting in the way). There are probably lots of other cool applications of HaNS we haven't though of yet. HaNS is released under a BSD license, and should be considered experimental at this stage. If you have any questions please contact the HaLVM team at halvm-de...@community.galois.com. -- Trevor Elliott (for the HaLVM team) P.S. If you're building with the HaLVM, make sure to add -fhalvm to your cabal install invocation. = References = HaLVM: http://halvm.org Haskell TCP:http://hackage.haskell.org/package/tcp smime.p7s Description: S/MIME Cryptographic Signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: HaNS-2.1.0.0
Yay! The Hackage URL is: http://hackage.haskell.org/package/hans Cheers, Don On Tue, May 24, 2011 at 11:39 AM, Trevor Elliott tre...@galois.com wrote: Galois, Inc. is pleased to announce the release of HaNS, the Haskell Network Stack. HaNS is a lightweight, pure Haskell network stack that can be used for Haskell networking in the context of the HaLVM, or with a Linux tap device. Currently, HaNS supports 802.3, IPv4, ARP, DHCP (partially), ICMP, UDP, and TCP. On Hackage: http://hackage.haskell.org/package/HaNS Git repo: http://code.galois.com/cgi-bin/gitweb The TCP component is a port of Peng Li and Stephan Zdancewic's Haskell TCP library, which in turn was translated from Norrish et al's HOL4 TCP specification. What might you use HaNS for? Developing new and interesting networking protocols, at any layer of the network stack, or your own variants of existing protocols. HaNS allows HaLVM nodes to support networking, meaning you can run experimental network services directly on top of the HaLVM (without any pesky OS getting in the way). There are probably lots of other cool applications of HaNS we haven't though of yet. HaNS is released under a BSD license, and should be considered experimental at this stage. If you have any questions please contact the HaLVM team at halvm-de...@community.galois.com. -- Trevor Elliott (for the HaLVM team) P.S. If you're building with the HaLVM, make sure to add -fhalvm to your cabal install invocation. = References = HaLVM: http://halvm.org Haskell TCP: http://hackage.haskell.org/package/tcp ___ Libraries mailing list librar...@haskell.org http://www.haskell.org/mailman/listinfo/libraries ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
On Tue, May 24, 2011 at 10:03 AM, Stephen Tetley stephen.tet...@gmail.com wrote: Neither OCaml nor PLT Scheme cache the length or they didn't a year of two ago when someone asked this question on the Haskell Beginners list and I checked the respective source trees. As the PLT Scheme list was implemented in C at the time (maybe it still is?) I was a bit surprised by this. I dunno, I hardly ever use length and when I do it's always lists I know are very short. And it tends to be shortcuts like 'drop (length prefix) word' because I'm too lazy to write a special function. Lists are variable length and homogenous, so the main thing you do is iterate over them, I don't see much call for getting their length. Length is handy for arrays because you iterate with an index, but lists are different. Adding an int to every cons cell would make lists larger by 2/3x and could hurt more than help. That would be a pretty heavy price to speed up a rarely used function. I'm not familiar with java and c++ list implementations, but I imagine they don't share tails, presumably because of mutability. So a cached length is reasonable for them, especially because they're probably expecting it to be used as an array with fast splicing, which implies it's probably large. After all, if you simply wanted to iterate over something small you would have used an array. So, it's a different situation. On the catMaybes thing, I have a function 'mapMaybe = Maybe.catMaybes . map'. I turns out I only ever used catMaybes after mapping a Maybe function, so I hardly ever use catMaybes anymore. I suppose it should have been maybeMap for consistency with concatMap. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] list processing (Was: *GROUP HUG*)
Evan Laforge schrieb: I dunno, I hardly ever use length and when I do it's always lists I know are very short. And it tends to be shortcuts like 'drop (length prefix) word' because I'm too lazy to write a special function. Since it happens so often I have written such functions: http://hackage.haskell.org/packages/archive/utility-ht/0.0.7/doc/html/Data-List-Match.html On the catMaybes thing, I have a function 'mapMaybe = Maybe.catMaybes . map'. I turns out I only ever used catMaybes after mapping a Maybe function, so I hardly ever use catMaybes anymore. I suppose it should have been maybeMap for consistency with concatMap. mapMaybe is part of Data.Maybe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] code review?
Evan Laforge schrieb: I'd keep the line length down to 80 chars, and not use ';'s. You can find more programming tips in http://www.haskell.org/haskellwiki/Haskell_programming_tips and in other articles of the Haskell Wiki, e.g. in Category:Idioms, Category:Style, Category:FAQ. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Maybe Int] sans Nothings
Alexander Solla schrieb: Personally, I find non-functional values without Eq instances to be degenerate. So I really do not mind superfluous Eq constraints. I would not hesitate to use filter ((/=) Nothing) in a function whose type has no free type variables. It's just a bit of plumbing inside of a more complex function. Sometimes it seems to be better to not allow Eq on Float and Double. Since most algebraic laws do not hold for those types, it is more often an error than an intention to compare two Float values. And how to compare (IO a) values? Also, by thinking about function types, you often get interesting use cases. Thus I would not assume too quickly that a type will always be instantiated by types other than a function type. Thus I would stick to (filter isJust) and use this consistently for monomorphic and polymorphic types. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal: wrapping namespace of a package into top-level module
Brandon Moore schrieb: From: max ulidtko ulid...@gmail.com ... 3) There's also package-qualified imports, but I don't think you should use them - if there are actually conflicts on those top-level module names, the package should be fixed sooner rather than later. 4) Write wrapper modules with Hierarchical module names that you want. Such modules might look like module Package.Name.Basic (module Basic) where import Basic GHC allows conflicting module names, and if you import only your wrapper package, then all modules from the original package like Basic are invisible. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GOA broken with recent lambdabots
On Tue, May 24, 2011 at 1:13 AM, Christopher Done chrisd...@googlemail.com wrote: On 24 May 2011 10:05, Jacek Generowicz jacek.generow...@cern.ch wrote: GOA is broken with recent lambdabots, according to http://hackage.haskell.org/package/goa-3.0.2 It certainly fails to compile for me (like this http://hpaste.org/46994/goa_build_failure ) I can fix it tonight. Not a big deal. Curious; do people still use GOA? In the past I've used it when I don't want to login to IRC and talk to lambdabot. Recently I've just been pinging lambdabot instead of using GOA. Six months from now I might use GOA instead of lambdabot. If the fixes are easy then I say it's a win. Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GOA broken with recent lambdabots
On 24 May 2011 10:26, Jacek Generowicz jacek.generow...@cern.ch wrote: I can fix it tonight. Not a big deal. Great. Thanks. Fixed: https://github.com/chrisdone/goa/issues/1 http://hackage.haskell.org/package/goa cabal update cabal install goa ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lambdabot check
On Tue, May 24, 2011 at 7:00 AM, Jacek Generowicz jacek.generow...@cern.ch wrote: I've installed lambdabot, but check within it seems to be broken: the only answer it ever gives is Terminated. For example: lambdabot check True Terminated lambdabot quickCheck works just fine in a GHCi session: Prelude :m + Test.QuickCheck [...] Prelude quickCheck True [...] +++ OK, passed 100 tests. @check these days goes through mueval. Are you sure mueval is installed working? You can try running the tests.sh script which will exercise the QuickCheck functionality among other things. -- gwern http://www.gwern.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Maybe Int] sans Nothings
Personally, I find non-functional values without Eq instances to be degenerate. So I really do not mind superfluous Eq constraints. I would not hesitate to use filter ((/=) Nothing) in a function whose type has no free type variables. It's just a bit of plumbing inside of a more complex function. Sometimes it seems to be better to not allow Eq on Float and Double. Since most algebraic laws do not hold for those types, it is more often an error than an intention to compare two Float values. And how to compare (IO a) values? Floats, Doubles, and IO are all degenerate types, for the reasons you outline. (Admittedly, Float and Double have Eq instances, but invalid Eq semantics) Notice how their value semantics each depend on the machine your runtime runs on, as opposed to merely the runtime. Bottom is another one of these degenerate types, since comparisons on arbitrary values are undecidable. Also, by thinking about function types, you often get interesting use cases. Thus I would not assume too quickly that a type will always be instantiated by types other than a function type. Thus I would stick to (filter isJust) and use this consistently for monomorphic and polymorphic types. I am not suggesting (filter ((/=) Nothing)) /over/ (filter isJust). Obviously, once one is aware of a better tool, one should use it. But I am suggesting that for simple cases which are unlikely to change in any substantive way, we should probably just use the tools we already know of, as opposed to searching for the right one. Both might involve costs. There is a cost involved in going to Google, thinking up a search term, finding that Data.Maybe has relevant functions, picking the right one. It takes less time to write filter ... than to type haskell removing nothing from list, for example. When dealing with known unknowns, there is a balance to be made, and it is not easy. Michael's choice to ask the list imposed costs. (Not that we mind, we're all volunteers, after all). But it probably took 10 minutes to get the first reply. He could have written a bit of code that worked correctly, given the context of his problem, in 20 seconds. Then again, he probably worked on a different bit of code until somebody sent a solution, so we probably only have to account for the time spent in context switching, for everyone involved. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
On Tue, 2011-05-24 at 15:37 +0100, Colin Adams wrote: And I thought Hugs was dead. :-) I think we have explanation for the friendliness of Haskell community - even the compiler hugs. Regards signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code critique - Was [Maybe Int] sans Nothings
The input file: http://dl.dropbox.com/u/27842656/psalms The Markov chain exercise from The Practice of Programming, Kermighan/Pike. Sample runs at the end. Michael import System.Environment(getArgs)import System.Randomimport Control.Applicativeimport Control.Monad.Readerimport Control.Monad.Stateimport Data.Maybeimport Data.Map type Prefix = (String,String)type GeneratorState1 = State ((Map Prefix [String]),Prefix,[String])type GeneratorState2 = StateT (Prefix,StdGen) (Reader (Map Prefix [String])) non_word = \n f key new old = new ++ old buildMap :: GeneratorState1 (Map Prefix [String])buildMap = do (mp,(pfx1,pfx2),words) - get if (Prelude.null words) then {- No more words. Return final map (adding non_word for final prefix). -} return (insertWithKey' f (pfx1,pfx2) [non_word] mp) else do {- Add word to map at prefix continue. -} put (insertWithKey' f (pfx1,pfx2) [head words] mp, (pfx2,(head words)), tail words) buildMap generate :: GeneratorState2 (Maybe String)generate = do ((pfx1,pfx2),gen) - get mp - ask let suffixList = mp ! (pfx1,pfx2) let (index,newGen) = randomR (0, (length suffixList)-1) gen let word = suffixList !! index if (word == non_word) then return Nothing else do put ((pfx2,word),newGen) return (Just word) rInt :: String - IntrInt = read main = do (seed:nwords:_) - (Prelude.map rInt) $ getArgs contents - getContents putStrLn $ unwords $ catMaybes $ runReader (evalStateT (sequence $ replicate nwords generate) ((non_word,non_word),mkStdGen seed)) (evalState buildMap (singleton (non_word,non_word) [], (non_word,non_word), words contents)) {-[michael@hostname ~]$ ghc --make markov.hs[1 of 1] Compiling Main ( markov.hs, markov.o )Linking markov ...[michael@hostname ~]$ cat psalms | ./markov 111 100Blessed is the LORD, in thine own cause: remember how the foolish people have blasphemed thy name. In the courts of the righteous: The LORD taketh pleasure in the desert. And he led them with the wicked, and with the whole earth, is mount Zion, on the sides of thine only. O God, and was troubled: I complained, and my God. My times are in thy praise. Blessed be God, which is full of the LORD is good: for his wondrous works. Now also when I am small and despised: yet do I put my trust: how say ye to[michael@hostname ~]$ cat psalms | ./markov 666 100Blessed is the LORD, and cried unto thee, Thy face, LORD, will I remember thee from the beginning: and every one that is weaned of his heart to any wicked transgressors. Selah. They return at evening: they make ready their arrow upon the people; and thou hast destroyed all them that fight against them that trust in thee: and let my tongue cleave to the heavens by his power for ever; and thy lovingkindnesses; for they have laid a snare before them: and that my ways were directed to keep thy word. Mine eyes fail while I have said that[michael@hostname ~]$ --- On Tue, 5/24/11, Alexander Solla alex.so...@gmail.com wrote: From: Alexander Solla alex.so...@gmail.com Subject: Re: [Haskell-cafe] [Maybe Int] sans Nothings To: Haskell Cafe haskell-cafe@haskell.org Date: Tuesday, May 24, 2011, 5:01 PM Personally, I find non-functional values without Eq instances to be degenerate. So I really do not mind superfluous Eq constraints. I would not hesitate to use filter ((/=) Nothing) in a function whose type has no free type variables. It's just a bit of plumbing inside of a more complex function. Sometimes it seems to be better to not allow Eq on Float and Double. Since most algebraic laws do not hold for those types, it is more often an error than an intention to compare two Float values. And how to compare (IO a) values? Floats, Doubles, and IO are all degenerate types, for the reasons you outline. (Admittedly, Float and Double have Eq instances, but invalid Eq semantics) Notice how their value semantics each depend on the machine your runtime runs on, as opposed to merely the runtime. Bottom is another one of these degenerate types, since comparisons on arbitrary values are undecidable. Also, by thinking about function types, you often get interesting use cases. Thus I would not assume too quickly that a type will always be instantiated by types other than a function type. Thus I would stick to (filter isJust) and use this consistently for monomorphic and polymorphic types. I am not suggesting (filter ((/=) Nothing)) /over/ (filter isJust). Obviously, once one is aware of a better tool, one should use it. But I am suggesting that for simple cases which are unlikely to change in any substantive way, we should probably just use the tools we
Re: [Haskell-cafe] lambdabot check
On 2011 May 24, at 22:30, Gwern Branwen wrote: @check these days goes through mueval. Are you sure mueval is installed working? Au contraire: I am sure that mueval was *not* installed. (Am I justified to be a just a little bit annoyed that it was not installed as a dependency by cabal install? Or that there was no indication whatsoever that mueval's absence was the cause of the problem?) Now that I have installed it explicitly myself, I do seem to make some more progress, but it's still far short of the ideal: lambdabot check True unrecognized option `--loadfile=' Usage: mueval [OPTION...] --expression EXPRESSION... -p PASSWORD--password=PASSWORD The password for the mubot account. If this is set, mueval will attempt to setuid to the mubot user. This is optional, as it requires the mubot user to be set up properly. (Currently a null-op.) [etc. etc.] You can try running the tests.sh script which will exercise the QuickCheck functionality among other things. This, AFAICT, seems to go just fine. There's lots of output with which I won't spam you, other than to say that it includes the text OK, all the valid expressions worked out well. Now let's test various misbehaved expressions. The last line of the output is IO . So, it seems that I am now faced with the problem of getting lambdabot and mueval to talk to each other sensibly. Any pointers would be gratefully received. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] lambdabot hoogle
I have recenly installed lambdabot. Its response to *each* *and* *every* hoogle command is *always* A Hoogle error occurred. I'm hoping that someone on Cafe might be able to offer a more helpful diagnosis than this ... erm ... terse ... error message. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: time-recurrence-0.2
Hot on the heels of the 0.1 release of time-recurrence: http://hackage.haskell.org/package/time-recurrence comes your favorite recurring time library: time-recurrence-0.2. At this point the library can generate many of the examples given in section 3.8.5.3 of the iCalendar RFC. The interface has been reworked to make things more concise, an example: -- Generate every 10 days, 5 occurrences startDate = utcGregorianWithTime 1997 9 2 14 0 0 -- Y M D HH MM SS map moment $ take 5 $ recurBy 10 [] $ Daily startDate [1997-09-02 14:00:00 UTC ,1997-09-12 14:00:00 UTC ,1997-09-22 14:00:00 UTC ,1997-10-02 14:00:00 UTC ,1997-10-12 14:00:00 UTC] I'm still tweaking the main data structures so things are very unstable right now. There is no support for operators like the iCalendar BYSETPOS, which would allow you to generate the 30th of the month in June if it is a Week Day otherwise the last Week Day in June. For the future I also am looking at how to enforce some of the more esoteric iCalendar rules, such as using BYMONTHDAY in a MONTHLY frequency when also using BYDAY. Since I am not being strict I can simply punt on the matter, but it would be interesting to support such dependencies. As always I encourage all feedback, suggestions and pull requests. -Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code critique - Was [Maybe Int] sans Nothings
My comments are in-line, marked off with On Tue, May 24, 2011 at 4:09 PM, michael rice nowg...@yahoo.com wrote: The input file: http://dl.dropbox.com/u/27842656/psalms The Markov chain exercise from The Practice of Programming, Kermighan/Pike. Sample runs at the end. Michael import System.Environment(getArgs) import System.Random import Control.Applicative import Control.Monad.Reader import Control.Monad.State import Data.Maybe import Data.Map type Prefix = (String,String) type GeneratorState1 = State ((Map Prefix [String]),Prefix,[String]) type GeneratorState2 = StateT (Prefix,StdGen) (Reader (Map Prefix [String])) non_word = \n f key new old = new ++ old I don't see what f is for, since it doesn't do anything with the key. buildMap :: GeneratorState1 (Map Prefix [String]) buildMap = do (mp,(pfx1,pfx2),words) - get if (Prelude.null words) then {- No more words. Return final map (adding non_word for final prefix). -} return (insertWithKey' f (pfx1,pfx2) [non_word] mp) else do {- Add word to map at prefix continue. -} put (insertWithKey' f (pfx1,pfx2) [head words] mp, (pfx2,(head words)), tail words) buildMap I'm not a fan of explicit if-then-else's, but my preferred alternative won't win much either. (see http://osdir.com/ml/haskell-cafe@haskell.org/2011-05/msg00612.html for an example of what I'm talking about) generate :: GeneratorState2 (Maybe String) generate = do ((pfx1,pfx2),gen) - get mp - ask let suffixList = mp ! (pfx1,pfx2) I'm not sure how you're guaranteed that mp ! (pfx1, pfx2) exists, at first glance. lookup uses Maybe semantics, in the case there is no result. let (index,newGen) = randomR (0, (length suffixList)-1) gen I might use a function like: listRange :: [a] - (Int, Int) listRange list = (0, (length $ l) - 1) This is a common enough pattern to abstract away. let word = suffixList !! index if (word == non_word) then return Nothing else do put ((pfx2,word),newGen) return (Just word) rInt :: String - Int rInt = read rInt is fair enough, but you can also have the same effect with an explicit type signature ((read n) :: Int) I tend to prefer the latter, personally. main = do (seed:nwords:_) - (Prelude.map rInt) $ getArgs contents - getContents putStrLn $ unwords $ catMaybes $ runReader (evalStateT (sequence $ replicate nwords generate) ((non_word,non_word),mkStdGen seed)) (evalState buildMap (singleton (non_word,non_word) [], (non_word,non_word), words contents)) Nice use of functor application. {- [michael@hostname ~]$ ghc --make markov.hs [1 of 1] Compiling Main ( markov.hs, markov.o ) Linking markov ... [michael@hostname ~]$ cat psalms | ./markov 111 100 Blessed is the LORD, in thine own cause: remember how the foolish people have blasphemed thy name. In the courts of the righteous: The LORD taketh pleasure in the desert. And he led them with the wicked, and with the whole earth, is mount Zion, on the sides of thine only. O God, and was troubled: I complained, and my God. My times are in thy praise. Blessed be God, which is full of the LORD is good: for his wondrous works. Now also when I am small and despised: yet do I put my trust: how say ye to [michael@hostname ~]$ cat psalms | ./markov 666 100 Blessed is the LORD, and cried unto thee, Thy face, LORD, will I remember thee from the beginning: and every one that is weaned of his heart to any wicked transgressors. Selah. They return at evening: they make ready their arrow upon the people; and thou hast destroyed all them that fight against them that trust in thee: and let my tongue cleave to the heavens by his power for ever; and thy lovingkindnesses; for they have laid a snare before them: and that my ways were directed to keep thy word. Mine eyes fail while I have said that [michael@hostname ~]$ --- On *Tue, 5/24/11, Alexander Solla alex.so...@gmail.com* wrote: From: Alexander Solla alex.so...@gmail.com Subject: Re: [Haskell-cafe] [Maybe Int] sans Nothings To: Haskell Cafe haskell-cafe@haskell.org Date: Tuesday, May 24, 2011, 5:01 PM Personally, I find non-functional values without Eq instances to be degenerate. So I really do not mind superfluous Eq constraints. I would not hesitate to use filter ((/=) Nothing) in a function whose type has no free type variables. It's just a bit of plumbing inside of a more complex function. Sometimes it seems to be better to not allow Eq on Float and Double. Since most algebraic laws do not hold for those types, it is more often an error than an intention to compare two Float values. And how
Re: [Haskell-cafe] lambdabot hoogle
On Wed, 25 May 2011 02:20:39 +0200, Jacek Generowicz jacek.generow...@cern.ch wrote: I have recenly installed lambdabot. Its response to *each* *and* *every* hoogle command is *always* A Hoogle error occurred. I'm hoping that someone on Cafe might be able to offer a more helpful diagnosis than this ... erm ... terse ... error message. Hi Jacek, The lambdabot hoogle command requires hoogle to be installed locally, and to work. Hence the first thing to ty is to run the hoogle command line version, something like: hoogle '[a] - a' If that doesn't work, maybe try building some hoogle databases. One way to do that is to run (on gentoo this needs to be run as root): hoogle data And if that works, to try it again: hoogle '[a] - a' And if all that works hopefully it should work in lambdabot. It works in the gentoo-haskell overlay. Regards, Mark ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lambdabot check
On Wed, 25 May 2011 02:15:12 +0200, Jacek Generowicz jacek.generow...@cern.ch wrote: On 2011 May 24, at 22:30, Gwern Branwen wrote: @check these days goes through mueval. Are you sure mueval is installed working? Au contraire: I am sure that mueval was *not* installed. (Am I justified to be a just a little bit annoyed that it was not installed as a dependency by cabal install? Or that there was no indication whatsoever that mueval's absence was the cause of the problem?) Now that I have installed it explicitly myself, I do seem to make some more progress, but it's still far short of the ideal: lambdabot check True unrecognized option `--loadfile=' Usage: mueval [OPTION...] --expression EXPRESSION... -p PASSWORD--password=PASSWORD The password for the mubot account. If this is set, mueval will attempt to setuid to the mubot user. This is optional, as it requires the mubot user to be set up properly. (Currently a null-op.) [etc. etc.] You can try running the tests.sh script which will exercise the QuickCheck functionality among other things. This, AFAICT, seems to go just fine. There's lots of output with which I won't spam you, other than to say that it includes the text OK, all the valid expressions worked out well. Now let's test various misbehaved expressions. The last line of the output is IO . So, it seems that I am now faced with the problem of getting lambdabot and mueval to talk to each other sensibly. Any pointers would be gratefully received. Hi Jacek and Gwern, In the upgrade from mueval from 0.8 to 0.8.1, some of the mueval command line options were changed: --loadfile = --load-file --noimports = --no-imports For Plugins/Check.hs I change --loadfile to -l. To convince lambdabot to run on gentoo, I patch it to use --no-imports to avoid this problem: % mueval -e '1 + 2' Ambiguous module name `Control.Monad.Cont': it was found in multiple packages: monads-fd-0.1.0.2 mtl-2.0.1.0 monads-tf-0.1.0.0 % And I patch the lambdabot /usr/share/lambdabot-4.2.3.2/ghc-7.0.3/State/L.hs to used -XPackageImports. Then mueval works: % mueval --no-imports -l ~/.lambdabot/State/L.hs -e '1 + 2' 3 % And lambdabot works: % lambdabot Initialising plugins ... done. lambdabot @check True +++ OK, passed 100 tests. OK, passed 100 tests. lambdabot The patch is here: https://github.com/markwright/gentoo-haskell/blob/master/dev-haskell/lambdabot/files/lambdabot-4.2.3.2-eval.patch Regards, Mark ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code critique - Was [Maybe Int] sans Nothings
Thanks, Alexander. Not as much red ink as I was expecting. My monitor is acting up, so I may be be dropping off the radar unexpectedly while acquiring a replacement. Each prefix is guaranteed to have at least one following word in its suffix list (possibly more) because the map is built from the actual Psalms text. The only prefix for which this does not occur is the final two words of the text, thus the TRUE case in buildMap puts the sole non_word in the suffix list. The generate function then _always_ builds a prefix from the first two words of the text, Blessed is, looks up its suffix list, chooses the next word randomly, and creates a new prefix by pairing the second word of the old prefix and the new word. Repeat. I've attached the AWK and C++ sources for the same Markov exercise if you wish to examine them. Both just write a single word on each line so I cobbled a Haskell program (lines.hs) to turn them into lines. Michael --- On Tue, 5/24/11, Alexander Solla alex.so...@gmail.com wrote: From: Alexander Solla alex.so...@gmail.com Subject: Re: [Haskell-cafe] Code critique - Was [Maybe Int] sans Nothings To: michael rice nowg...@yahoo.com Cc: Haskell Cafe haskell-cafe@haskell.org Date: Tuesday, May 24, 2011, 10:42 PM My comments are in-line, marked off with On Tue, May 24, 2011 at 4:09 PM, michael rice nowg...@yahoo.com wrote: The input file: http://dl.dropbox.com/u/27842656/psalms The Markov chain exercise from The Practice of Programming, Kermighan/Pike. Sample runs at the end. Michael import System.Environment(getArgs)import System.Randomimport Control.Applicativeimport Control.Monad.Reader import Control.Monad.Stateimport Data.Maybeimport Data.Map type Prefix = (String,String)type GeneratorState1 = State ((Map Prefix [String]),Prefix,[String]) type GeneratorState2 = StateT (Prefix,StdGen) (Reader (Map Prefix [String])) non_word = \n f key new old = new ++ old I don't see what f is for, since it doesn't do anything with the key. buildMap :: GeneratorState1 (Map Prefix [String])buildMap = do (mp,(pfx1,pfx2),words) - get if (Prelude.null words) then {- No more words. Return final map (adding non_word for final prefix). -} return (insertWithKey' f (pfx1,pfx2) [non_word] mp) else do {- Add word to map at prefix continue. -} put (insertWithKey' f (pfx1,pfx2) [head words] mp, (pfx2,(head words)), tail words) buildMap I'm not a fan of explicit if-then-else's, but my preferred alternative won't win much either. (see http://osdir.com/ml/haskell-cafe@haskell.org/2011-05/msg00612.html for an example of what I'm talking about) generate :: GeneratorState2 (Maybe String)generate = do ((pfx1,pfx2),gen) - get mp - ask let suffixList = mp ! (pfx1,pfx2) I'm not sure how you're guaranteed that mp ! (pfx1, pfx2) exists, at first glance. lookup uses Maybe semantics, in the case there is no result. let (index,newGen) = randomR (0, (length suffixList)-1) gen I might use a function like: listRange :: [a] - (Int, Int) listRange list = (0, (length $ l) - 1) This is a common enough pattern to abstract away. let word = suffixList !! index if (word == non_word) then return Nothing else do put ((pfx2,word),newGen) return (Just word) rInt :: String - IntrInt = read rInt is fair enough, but you can also have the same effect with an explicit type signature ((read n) :: Int) I tend to prefer the latter, personally. main = do (seed:nwords:_) - (Prelude.map rInt) $ getArgs contents - getContents putStrLn $ unwords $ catMaybes $ runReader (evalStateT (sequence $ replicate nwords generate) ((non_word,non_word),mkStdGen seed)) (evalState buildMap (singleton (non_word,non_word) [], (non_word,non_word), words contents)) Nice use of functor application. {-[michael@hostname ~]$ ghc --make markov.hs[1 of 1] Compiling Main ( markov.hs, markov.o ) Linking markov ...[michael@hostname ~]$ cat psalms | ./markov 111 100Blessed is the LORD, in thine own cause: remember how the foolish people have blasphemed thy name. In the courts of the righteous: The LORD taketh pleasure in the desert. And he led them with the wicked, and with the whole earth, is mount Zion, on the sides of thine only. O God, and was troubled: I complained, and my God. My times are in thy praise. Blessed be God, which is full of the LORD is good: for his wondrous works. Now also when I am small and despised: yet do I put my trust: how say ye to[michael@hostname ~]$ cat psalms | ./markov 666 100 Blessed is the LORD, and cried unto thee, Thy face, LORD, will I remember thee from the beginning: and every one that is weaned of his heart to