Re[2]: [Haskell-cafe] Re: Windows details
Hello Andrew, Thursday, September 11, 2008, 11:24:24 PM, you wrote: interestingly, XN seems to make GHC-compiled binary files dramatically *smaller*... huh??) probably it does `strip` on executable. -optl-s option does the same trick -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Erroneous package listings in hackage?
$ cabal update ... $ cabal list | less ... * cairo Latest version installed: 0.9.13 Homepage: http://haskell.org/gtk2hs/ License: BSD3 ... $ cabal install cairo cabal: There is no package named cairo I must admit I was surprised to see a gtk2hs module on Hackage, but not half as surprised when I found it wasn't there after all... D ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Erroneous package listings in hackage?
On Fri, 12 Sep 2008 13:21:59 +0200, Dougal Stanton [EMAIL PROTECTED] wrote: $ cabal update ... $ cabal list | less ... * cairo Latest version installed: 0.9.13 Homepage: http://haskell.org/gtk2hs/ License: BSD3 ... $ cabal install cairo cabal: There is no package named cairo I must admit I was surprised to see a gtk2hs module on Hackage, but not half as surprised when I found it wasn't there after all... D There is clearly something wrong here; there is also a package named gtk that is listed with cabal list but cannot be downloaded. If you need Cairo, it is included in the Gtk2Hs package ( http://haskell.org/gtk2hs/download/ ). -- Met vriendelijke groet, Henk-Jan van Tuyl -- http://functor.bamikanarie.com http://Van.Tuyl.eu/ -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: darcs hacking sprint, venues confirmed! (25-26 October)
On Sat, Sep 06, 2008 at 08:12:04 +0100, Eric Y. Kow wrote: Earlier I wrote an announcement for the darcs hacking sprint on 25-26 October. Tonight, I am delighted to announce that we have two venues confirmed for the sprint and one serious offer. Just to add to that: the Paris venue is now confirmed as well! * CONFIRMED: Brighton, UK (University of Brighton) * CONFIRMED: Portland, USA(Galois Connections) * CONFIRMED: Paris,France (Université Paris Diderot) This is for the weekend of 25-26 October. http://wiki.darcs.net/index.html/Sprints Thanks! P.S. If you wish to participate at the Paris venue, please notify Nicolas Pouillard at least one week in advance. -- Eric Kow http://www.nltg.brighton.ac.uk/home/Eric.Kow PGP Key ID: 08AC04F9 signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Workshop on Generic Programming: Call for Participation (co-located w/ ICFP08)
Dear all, the Workshop on Generic Programming is only a few days away: 20th September 2008 (http://www.regmaster.com/conf/icfp2008.html). == Invited talk: The Generic Paradigm == Lambert Meertens (Utrecht University) == We have reserved 20 minutes for *lightning talks*. If you plan to == attend and if you would like to give a short talk (about half-baked, == exciting, new stuff) please drop me a short note. Slots will be == reserved on a first-come-first-serve basis. Looking forward to seeing you in Victoria, Ralf Hinze CALL FOR PARTICIPATION Workshop on Generic Programming 2008 Victoria, Canada, 20th September 2008 http://www.comlab.ox.ac.uk/ralf.hinze/wgp2008/cfp.{html,pdf,ps,txt} The Workshop on Generic Programming is sponsored by ACM SIGPLAN and forms part of ICFP 2008. Previous Workshops on Generic Programming have been held in Marstrand (affiliated with MPC), Ponte de Lima (affiliated with MPC), Nottingham (informal workshop), Dagstuhl (IFIP WG2.1 Working Conference), Oxford (informal workshop), Utrecht (informal workshop), and Portland (affiliated with ICFP). Preliminary program --- 9:00 - 10:00, Session Chair: Ralf Hinze (University of Oxford) Welcome Invited talk: The Generic Paradigm Lambert Meertens (Utrecht University) 10:30 - 12:00, Session Chair: Jeremy Gibbons (University of Oxford) A Functional Model-View-Controller Software Architecture for Command-oriented Programs Alley Stoughton (Kansas State University) A Lightweight Approach to Datatype-Generic Rewriting Thomas van Noort (Radboud University Nijmegen), Alexey Rodriguez, Stefan Holdermans (Utrecht University), Johan Jeuring (Utrecht University and Open University of the Netherlands), Bastiaan Heeren (Open University of the Netherlands) Lightning talks 13:30 - 15:00, Session Chair: Ralf Hinze (University of Oxford) Report from the program chair Ralf Hinze (University of Oxford) Scala for Generic Programmers Bruno C. d. S. Oliveira, Jeremy Gibbons (University of Oxford) A Comparison of C++ Concepts and Haskell Type Classes Jean-Philippe Bernardy, Patrik Jansson, Marcin Zalewski, Sibylle Schupp, Andreas Priesnitz (Chalmers University of Technology and University of Gothenburg) Lightning talks 15:30 - 17:30, Session Chair: Patrik Jansson (Chalmers University of Technology and University of Gothenburg) Polytypic Programming in Coq Wendy Verbruggen, Edsko de Vries, Arthur Hughes (Trinity College Dublin) Bialgebra Views: A Way for Polytypic Programming to Cohabit with Data Abstraction Pablo Nogueira, Juan Jose Moreno-Navarro (Universidad Politecnica de Madrid) Discussion ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] JSON serialization/deserialization
Dear list members, I try to use Text.JSON (http://hackage.haskell.org/cgi-bin/hackage-scripts/package/json) to serialize and deserialize record types. As I understand it, the data types need to be instances of class JSON. However I have difficulties to come up with a nice implementation of showJSON and readJSON. For example: module Test where import Text.JSON data Record = One { field1 :: String, field2 :: String } | Two { field :: String } deriving (Eq, Ord, Show, Read) showJSON (One x y) = toJSObject [(field1, x), (field2, y)] showJSON (Two x) = toJSObject [(field, x)] readJSON x = -- ??? This lacks the instance declaration itself but my problem is more fundamental. How can I write the readJSON method? In general how would one approach the problem of serialization/deserialization? I am puzzled that the type classes Show and Read can be derived automatically. I can not think of any way to do this. Thanks for your help! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Real World HAppS: Cabalized, Self-Demoing HAppS Tutorial (Version 3)
I pushed a new version of happs-tutorial to the online demo at http://happstutorial.com:5001 This is also on hackage: cabal install happs-tutorial. (now version 3.) or darcs get http://code.haskell.org/happs-tutorial for the latest The demo/tutorial has the same basic functionality as the last release -- just a login form essentially -- but a lot more bling now. Like menu link items that change colors when the page is clicked. Also the login form that gives sane error messages. The focus for this release was on explaining how I used StringTemplate with HAppS. Hopefully in version 4 I'll finally get to State and Macid! And hopefully some functionality that actually does something beyond just showing what users have created logins :) Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Can you do everything without shared-memory concurrency?
--- On Fri, 9/12/08, Bruce Eckel [EMAIL PROTECTED] wrote: OK, let me throw another idea out here. When Allen Holub first explained Actors to me, he made the statement that Actors prevent deadlocks. In my subsequent understanding of them, I haven't seen anything that would disagree with that -- as long as you only use Actors and nothing else for parallelism. As I believe it is the case that you can emulate shared resources, and locks to control concurrent access to them, using the actor model, I can't see how this can be true. rcg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] mailing list choices?
I think I'll go the route of @haskell.org and gmane. Does anyone have advice about spam protection or other helpful matters? - Conal On Mon, Sep 8, 2008 at 12:42 PM, Alexey Beshenov [EMAIL PROTECTED] wrote: On Monday 08 September 2008 14:33:47 Conal Elliott wrote: I want to set up some kind of mailing list for reactive (which I plan to release soon). The most obvious thing is to set up a mailman-based list on haskell.org, but I wonder -- do people really want to keep using mailman technology? Or something more modern like Yahoo or Google groups. Mailman is nice. You can register your list at the http://gmane.org/ (see http://dir.gmane.org/index.php?prefix=gmane.comp.lang.haskell) -- Sweetmorn, Bureaucracy 32, 3174 YOLD Alexey Beshenov http://beshenov.ru/ ___ 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] Re: Can you do everything without shared-memory concurrency?
OK, let me throw another idea out here. When Allen Holub first explained Actors to me, he made the statement that Actors prevent deadlocks. In my subsequent understanding of them, I haven't seen anything that would disagree with that -- as long as you only use Actors and nothing else for parallelism. If someone were to create a programming system where you were only able to use Actors and nothing else for parallelism, could you do everything using Actors? Is there anything you couldn't do? I'm assuming again that we can throw lots of processors at a problem. On Thu, Sep 11, 2008 at 8:17 PM, Aaron Denney [EMAIL PROTECTED] wrote: On 2008-09-10, David Roundy [EMAIL PROTECTED] wrote: On Wed, Sep 10, 2008 at 03:30:50PM +0200, Jed Brown wrote: On Wed 2008-09-10 09:05, David Roundy wrote: I should point out, however, that in my experience MPI programming involves deadlocks and synchronization handling that are at least as nasty as any I've run into doing shared-memory threading. Absolutely, avoiding deadlock is the first priority (before error handling). If you use the non-blocking interface, you have to be very conscious of whether a buffer is being used or the call has completed. Regardless, the API requires the programmer to maintain a very clear distinction between locally owned and remote memory. Even with the blocking interface, you had subtle bugs that I found pretty tricky to deal with. e.g. the reduce functions in lam3 (or was it lam4) at one point didn't actually manage to result in the same values on all nodes (with differences caused by roundoff error), which led to rare deadlocks, when it so happened that two nodes disagreed as to when a loop was completed. Perhaps someone made the mistake of assuming that addition was associative, or maybe it was something triggered by the non-IEEE floating point we were using. But in any case, it was pretty nasty. And it was precisely the kind of bug that won't show up except when you're doing something like MPI where you are pretty much forced to assume that the same (pure!) computation has the same effect on each node. Ah, okay. I think that's a real edge case, and probably not how most use MPI. I've used both threads and MPI; MPI, while cumbersome, never gave me any hard-to-debug deadlock problems. -- Aaron Denney -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Bruce Eckel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Can you do everything without shared-memory concurrency?
Sebastian Sylvan wrote: For correctness, maybe not, for efficiency, yes definitely! In theory, decades of research and engineering went into shared memory on common hardware, so it should be faster. In practice, you give shared memory to spoiled kids (and seldom encourage them to use other paradigms), and they have no incentive to decompose their problems. They just gratuitously share all variables and therefore need to lock everything. So it becomes slower. If you think hard to decompose a problem, several possibilities occur: - Some problems need shared memory badly. - Most other problems need sharing so little that the way you use shared memory ends up simulating message passing. I encourage you to re-think how often your problems land in the second case. Because we are all spoiled by shared memory, it may be hard to notice. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] mailing list choices?
On Friday 12 September 2008 19:37:26 Conal Elliott wrote: I think I'll go the route of @haskell.org and gmane. Does anyone have advice about spam protection or other helpful matters? - Conal For filtering the junk e-mail manually, I recommend listadmin: http://heim.ifi.uio.no/kjetilho/hacks/#listadmin -- Setting Orange, Bureaucracy 36, 3174 YOLD Alexey Beshenov http://beshenov.ru/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Can you do everything without shared-memory concurrency?
On Fri, Sep 12, 2008 at 4:07 PM, Bruce Eckel [EMAIL PROTECTED] wrote: OK, let me throw another idea out here. When Allen Holub first explained Actors to me, he made the statement that Actors prevent deadlocks. In my subsequent understanding of them, I haven't seen anything that would disagree with that -- as long as you only use Actors and nothing else for parallelism. I think you need to specify what you mean by actors, because I can't see how they would eliminate deadlocks as I understand them. Could you not write an actor that holds a single cell mailbox (both reads and writes are blocking), then set up two classes that shuffles values from the same two mailboxes in the opposite direction? -- Sebastian Sylvan +44(0)7857-300802 UIN: 44640862 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] JSON serialization/deserialization
The trouble: module A data ABC = A { a :: String } | B { a :: String } | C { a :: String } module B data ABC = A { a :: String } | B { a :: String } | C { a :: String } is valid haskell. so how should you know having the serialized String { a : abc } wether to use the constructor A,B,C ? or wether to use ABC from module A or from B? There are many ways to solve this: One is to serialize it this way: { datatype: A.ABC, constructor : C , a :text } or such.. Maybe also read about Data.Typable, have a look at derive or DrIft (or the lib itself, I'm not sure wethere there is one which has choosen one way to do this).. Basically JavaScript doesn't have real typing (such as classes). But there exist some libraries to emulate it such as mootools or scriptaculous.. I hope you'll find a solution which works for you. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell and Java
On Wed, Sep 10, 2008 at 05:35:20PM -0400, Brian Alliet wrote: On Wed, Sep 10, 2008 at 02:12:00PM +0200, Marc Weber wrote: There used to be. http://www.cs.rit.edu/~bja8464/lambdavm/ (Last darcs change log entry: Sun Oct 21 03:05:20 CEST 2007 Brian Alliet [EMAIL PROTECTED] * fix build for hsjava change ) Sorry about this. I hit a critical mass of darcs conflicts (I look forward to giving git a try) around the same time I got really busy at work. I've been meaning to get back into it (and update it to GHC HEAD) but I haven't received sufficient nagging yet. Please yell if you're interested in LambdaVM. At the very least I should be able to help get whatever is in darcs compiling. I for one would welcome the ability to compile Haskell programs into Java bytecode. One issue I have right now is the ability to get my code into the hands of a wide audience, since the Haskell toolchain is not widely installed by default. That and I tend to use a ton of Haskell modules, and there isn't a just install all the deps in ghc yet ;-) -- John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Windows details
Bulat Ziganshin wrote: Hello Andrew, Thursday, September 11, 2008, 11:24:24 PM, you wrote: interestingly, XN seems to make GHC-compiled binary files dramatically *smaller*... huh??) probably it does `strip` on executable. -optl-s option does the same trick And what exactly does a strip mean, then? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Windows details
Jeff Zaroyko wrote: Andrew Coppin andrewcoppin at btinternet.com writes: Jeff Zaroyko wrote: In theory, you should be able to use mingw's windres tool to produce an object file from the resource definition which you'd link with the rest of your program. Yes, there's a cryptic comment burried away in the GHC manual that says GHC itself already uses windres to embed the manifest file into the compiled binary file. (And sure enough, if you crawl through with a hex editor you'll find the raw XML in there.) There's an option to tell GHC to not do this - however, I don't see any option anywhere to tell it to embed a *different* resource file instead. All I meant by linking is including the object file when you invoke ghc. windres foo.rc -o foores.o ghc bar.hs foo.o Not sure if that works when using ghc --make, but we'll see. Actually no, we won't. Because I have just spent about 2 hours trying to get that first command to work. I am now exasperated beyond my powers of description. I made GHC print out all the commands it executes. I cut and pasted the windres command and changed the filenames. windres stubbornly *refuses* to work for me. It complains endlessly about invalid arguments. (E.g., it claims that -B isn't a valid option.) And yet, this is the EXACT command that GHC executed, and it didn't complain for GHC. GRRR!!! _ I even tried removing the arguments it doesn't like - but then it can't find any of the include files. Basically no matter what I do, I cannot make windres compile anything. I literally cannot *believe* how hard it is to put a few little words into that version tab... Every other kind of resource seems to be completely trivial, but this just won't work for toffee! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell and Java
+1 Due to the commercial environment I work in, there's really no chance of me using Haskell at work unless it runs under JVM or CLR. Brian, consider yourself nagged! And if there's anywhere you need some help, please yell. Neil On Fri, Sep 12, 2008 at 8:44 AM, John Goerzen [EMAIL PROTECTED] wrote: On Wed, Sep 10, 2008 at 05:35:20PM -0400, Brian Alliet wrote: On Wed, Sep 10, 2008 at 02:12:00PM +0200, Marc Weber wrote: There used to be. http://www.cs.rit.edu/~bja8464/lambdavm/ (Last darcs change log entry: Sun Oct 21 03:05:20 CEST 2007 Brian Alliet [EMAIL PROTECTED] * fix build for hsjava change ) Sorry about this. I hit a critical mass of darcs conflicts (I look forward to giving git a try) around the same time I got really busy at work. I've been meaning to get back into it (and update it to GHC HEAD) but I haven't received sufficient nagging yet. Please yell if you're interested in LambdaVM. At the very least I should be able to help get whatever is in darcs compiling. I for one would welcome the ability to compile Haskell programs into Java bytecode. One issue I have right now is the ability to get my code into the hands of a wide audience, since the Haskell toolchain is not widely installed by default. That and I tend to use a ton of Haskell modules, and there isn't a just install all the deps in ghc yet ;-) -- John ___ 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] Re: Windows details
On Fri, 2008-09-12 at 18:07 +0100, Andrew Coppin wrote: Bulat Ziganshin wrote: Hello Andrew, Thursday, September 11, 2008, 11:24:24 PM, you wrote: interestingly, XN seems to make GHC-compiled binary files dramatically *smaller*... huh??) probably it does `strip` on executable. -optl-s option does the same trick And what exactly does a strip mean, then? Remove the symbol table. And, for C, other debugging information. Historically, I believe, on Unix the distinction between an executable and an object file was weaker than it is now (so, for example, a.out was originally the default name of an object file, back when you didn't always need to link in a library). So (and this is still sometimes true on linux) the linker's output could be used as input to the linker. Unix linkers still include the combined symbol table in the executables they generate, to allow this. But if your executable is complete, you don't need a symbol table, so Unix includes a program `strip' that removes it from an executable (or object file, if you do something stupid). GHC's Windows port, of course, uses a port of the Unix toolchain, so the above discussion (almost) completely applies. (Although I don't think any (static) linker actually accepts Windows PE executables as input). jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Windows details
Hello Andrew, Friday, September 12, 2008, 9:07:28 PM, you wrote: probably it does `strip` on executable. -optl-s option does the same trick And what exactly does a strip mean, then? stripping C debugging info, which is useless anyway -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Windows details
Jonathan Cast wrote: On Fri, 2008-09-12 at 18:07 +0100, Andrew Coppin wrote: And what exactly does a strip mean, then? Remove the symbol table. And, for C, other debugging information. Historically, I believe, on Unix the distinction between an executable and an object file was weaker than it is now (so, for example, a.out was originally the default name of an object file, back when you didn't always need to link in a library). So (and this is still sometimes true on linux) the linker's output could be used as input to the linker. Unix linkers still include the combined symbol table in the executables they generate, to allow this. But if your executable is complete, you don't need a symbol table, so Unix includes a program `strip' that removes it from an executable (or object file, if you do something stupid). GHC's Windows port, of course, uses a port of the Unix toolchain, so the above discussion (almost) completely applies. (Although I don't think any (static) linker actually accepts Windows PE executables as input). That would certainly explain why the end of my compiled binary contains several miles of ASCII that looks like function names then... ;-) So if I give GHC the right options, it'll do that for me? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Windows details
On Fri, 2008-09-12 at 18:35 +0100, Andrew Coppin wrote: Jonathan Cast wrote: On Fri, 2008-09-12 at 18:07 +0100, Andrew Coppin wrote: And what exactly does a strip mean, then? Remove the symbol table. And, for C, other debugging information. Historically, I believe, on Unix the distinction between an executable and an object file was weaker than it is now (so, for example, a.out was originally the default name of an object file, back when you didn't always need to link in a library). So (and this is still sometimes true on linux) the linker's output could be used as input to the linker. Unix linkers still include the combined symbol table in the executables they generate, to allow this. But if your executable is complete, you don't need a symbol table, so Unix includes a program `strip' that removes it from an executable (or object file, if you do something stupid). GHC's Windows port, of course, uses a port of the Unix toolchain, so the above discussion (almost) completely applies. (Although I don't think any (static) linker actually accepts Windows PE executables as input). That would certainly explain why the end of my compiled binary contains several miles of ASCII that looks like function names then... ;-) So if I give GHC the right options, it'll do that for me? Correct. Finding the right option is left as a Google-enabled exercise for the reader. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Windows console
Max Bolingbroke wrote: 2008/9/9 Andrew Coppin [EMAIL PROTECTED]: Actually, now that I think about it, it would be kind of nice to have a magic package that writes out escape codes or calls the Win32 API depending on which platform your program is compiled on - in the style of System.FilePath. I don't know how to do that though... A nice idea, guys? I wrote this package a few weeks ago: check out http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ansi-terminal and it's companion http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ansi-wl-pprint Ah, so somebody has already beaten me to it, eh? Looks like the only thing it doesn't do is let you change the title on the console window. (Because, obviously, that's only possible on Windows.) And what do you know, it installed out of the box without issue on my Windows system. Now that's pretty rare... Any ideas about the build log error that's preventing Hackage from autogenerating the documentation? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] template haskell -- include a file?
I'd like to use template Haskell to include as a string in a Haskell file. How do I do it? Is there any lengthy documentation with examples for Template Haskell? The pages linked to from `haskell.org` are a little sparse. -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] template haskell -- include a file?
Hello Jason, Friday, September 12, 2008, 11:47:44 PM, you wrote: I'd like to use template Haskell to include as a string in a Haskell file. How do I do it? TH is a typed macrosystem - you generate special datastructure representing haskell code rather than untyped strings Is there any lengthy documentation with examples for Template Haskell? The pages linked to from `haskell.org` are a little sparse. look for Bulat's tutorials at http://haskell.org/haskellwiki/Template_Haskell although they both are unfinished -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] template haskell -- include a file?
On Fri, Sep 12, 2008 at 9:47 PM, Jason Dusek [EMAIL PROTECTED] wrote: I'd like to use template Haskell to include as a string in a Haskell file. How do I do it? I presume you mean Include a string from the outside world with a IO action (a file, keyborad, etc ...) -- module EmbedStr (embedStr) where import Language.Haskell.TH import Language.Haskell.TH.Syntax (lift) embedStr :: IO String - ExpQ embedStr readStr = lift = runIO readStr -- For example, to get asked about the string you want to embed during compilation ... $ ghci -XTemplateHaskell EmbedStr.hs GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. [1 of 1] Compiling EmbedStr ( EmbedStr.hs, interpreted ) Ok, modules loaded: EmbedStr. *EmbedStr let myStr = $(embedStr ((putStrLn What string?) getLine)) Loading package array-0.1.0.0 ... linking ... done. Loading package packedstring-0.1.0.0 ... linking ... done. Loading package containers-0.1.0.1 ... linking ... done. Loading package pretty-1.0.0.0 ... linking ... done. Loading package template-haskell ... linking ... done. What String? Foo *EmbedStr myStr Foo *EmbedStr Is there any lengthy documentation with examples for Template Haskell? The pages linked to from `haskell.org` are a little sparse. Uhm, I only know about http://www.haskell.org/haskellwiki/Template_Haskell#Template_Haskell_tutorials_and_papers I particularly like Mark Snyder's Template Haskell chapter on the Software Generation and Configuration Report , but the link is broken :( ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] template haskell -- include a file?
Thank you! -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] template haskell -- include a file?
Alfonso Acosta [EMAIL PROTECTED] wrote: Uhm, I only know about http://www.haskell.org/haskellwiki/Template_Haskell#Template_Haskell_tutorials_and_papers Oh, I guess I missed the wiki. -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Fwd: profiling in haskell]
Tim Chevalier wrote: When you build your own code with -prof, GHC automatically links in profiling versions of the standard libraries. However, its profiling libraries were not built with -auto-all (the reason is that adding cost centres interferes with optimization). To build the libraries with -auto-all, you would need to build GHC from sources, which is not for the faint of heart. However, the results of doing that aren't usually very enlightening anyway -- for example, foldr might be called from many different places, but you might only care about a single call site (and then you can annotate that call site). Hmm, okay -- that makes some sense. Just from looking, I would guess this is the culprit: termToStr t il = {-# SCC termToStr #-} ((:) (t ++ t ++ ++ (foldl ilItemToStr il))) If you want to be really sure, you can rewrite this as: termToStr t il = {-# SCC termToStr #-} ((:) (t ++ t ++ ++ ({-# SCC termToStr_foldl #-} foldl ilItemToStr il))) and that will give you a cost centre measuring the specific cost of the invocation of foldl. I did that and found out that it accounts for only about 0.6 percent of the running time. Changing fold to fold' does improve it, though overall it's not that significant (again, since it's not the bottleneck). I just realized that most of the time is spent inside 'serialize' and not inherited as I originally claimed. Here is how my current code and profiling output look like: http://hpaste.org/10329 How do I figure out what exactly in 'serialize' takes so much time? -- Vlad Skvortsov, [EMAIL PROTECTED], http://vss.73rus.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Text.JSON idiomatic use
As a follow up to my previous JSON serialization post I came up with a first draft of some simple record type serialization/deserialization. What I would like to know is, whether this is the right approach or what better ways there are to make a custom data type an instance of class JSON. Any chance to reduce the amount of boilerplate required to do this? I would be grateful for any feedback (also general style comments are much appreciated). Many thanks! module Test where import Text.JSON data Message = Error { event :: String, channel :: String, id :: String, cause :: String, message :: String} | Join { event :: String, channel :: String, id :: String, name:: String} | Leave { event :: String, channel :: String, id :: String, really :: Bool} deriving (Eq, Show, Read) asJSString :: String - JSValue asJSString = JSString . toJSString asString :: JSValue - String asString (JSString s) = fromJSString s asBool :: JSValue - Bool asBool (JSBool b) = b showErrorJSON, showJoinJSON, showLeaveJSON :: Message - JSValue showErrorJSON (Test.Error evt cha id cau msg) = showJSON $ toJSObject [(event, evt), (channel, cha), (id, id), (cause, cau), (message, msg)] showJoinJSON (Join evt cha id nme) = showJSON $ toJSObject [(event, evt), (channel, cha), (id, id), (name, nme)] showLeaveJSON (Leave evt cha id rly) = showJSON $ toJSObject [(event, asJSString evt), (channel, asJSString cha), (id, asJSString id), (really, JSBool rly)] createMessage, readErrorJSON, readJoinJSON, readLeaveJSON :: [(String, JSValue)] - Maybe Message readErrorJSON xs = do evt - lookup event xs cha - lookup channel xs id - lookup id xs cau - lookup cause xs msg - lookup message xs Just (Test.Error (asString evt) (asString cha) (asString id) (asString cau) (asString msg)) readJoinJSON xs = do evt - lookup event xs cha - lookup channel xs id - lookup id xs nme - lookup name xs Just (Join (asString evt) (asString cha) (asString id) (asString nme)) readLeaveJSON xs = do evt - lookup event xs cha - lookup channel xs id - lookup id xs rly - lookup really xs Just (Leave (asString evt) (asString cha) (asString id) (asBool rly)) createMessage obj = do evt - lookup event obj case asString evt of /error - readErrorJSON obj /me/add - readJoinJSON obj /me/remove - readLeaveJSON obj _ - Nothing instance JSON Message where showJSON x@(Test.Join_ _ _ _) = showJoinJSON x showJSON x@(Test.Leave _ _ _ _) = showLeaveJSON x showJSON x@(Test.Error _ _ _ _ _) = showErrorJSON x readJSON (JSObject o) = case createMessage . fromJSObject $ o of Just m - Ok m Nothing - Text.JSON.Error Parsing failed. readJSON _ = Text.JSON.Error Records must be JSObjects ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] do like notation works fine when using ghc head
There is also the combinator approach of Text.Html, which gives you a syntax similar to (3) but without abusing do: (rootElt ! [xmlns http://www.w3.org/1999/xhtml;, lang en-US xml:lang en-US]) $ concatXml [head $ title $ text minimal ,body $ concatXml [h1 $ text minimal ,div $ text $ args passed to this program: ++ (show args) ] ] Keep in mind that my library tries to do real DTD type checking. This means that body, h1, div all have different types. So they can't easily be put into a list. And yes: I care about each character I have to type less :-) About IO (). IO was just a poor man example to show that you can nest arbitrary monads. Have a look at the WASH library to see in which wonderful ways this can be used.. One working snippet from the testXHTML.hs sample file provided by the lib: #include vxmldos.h tDo $ runHtmlDoc $ vdo head $ title $ text text body $ vdo script $ X.type text/javascript text document.writeln('hi'); h2 $ text That's a headline, hello and how do you do? -- br e eg a br/ is not allowed here div $ vdo onclick alert('clicked'); styleA color:#F79 text text within the div div e return That's nice, isn't it? vxmldos.h defines a vdo cpp macro which expands to let ; in $ do where ... rebinds =, , lift to make this work (in with ghc head) The library can now cope with fancy dts such as (a*)* etc as well If you still find bugs let me know. The more interesting part starts now: figuring out how do build a nice HTML library on top of this all. Sincerly Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Tons of retainers when inserting 611, 756 elements into a Trie
Dear haskell-cafe, I've got an anagram-finder (puzzler) that uses a dictionary datatype, which in turn uses a trie. In src/hs/Main.hs, I create a new dictionary from a word list (a file containing one word per line) and perform a query on it in order to force it to actually load something from disk. By problem is that though my word list is just shy of 7MB, puzzler occupies nearly 1GB of resident memory as soon as the dictionary is loaded. I'm using GHC 6.8.3 and Gtk2hs 0.9.13 on OS X 10.4.11. To see for yourself, check out the code with git and run it: $ git clone git://github.com/dbueno/puzzler.git $ git checkout -b origin/bsbench $ cabal configure # needs gtk2hs $ cabal build $ ./dist/build/puzzler/puzzler # look at the resident memory Retainer profiling (attachment puzzler-hr.pdf) shows that `insertWith' on my trie is responsible for most of the memory. As you will see, in `makeDictionary' I try to strictly apply the combining function to combat these retainers. But the problem doesn't go away. More strangely: puzzler has a second executable, puzzler-test, which runs unit tests, including loading the exact same anagram query. However, puzzler-test never uses more than 250MB or so. The dictionary (in module Puzzler.Anagram) is an array of bytestrings paired with a Trie mapping bytestrings to sets of indices in the array. data Dictionary = Dictionary { dictWords :: Words , sortWords :: Trie IntSet } type Words = Array Int ByteString The Trie is a custom bytestring trie datatype. Each level is mapped to by the character it represents. If that character is a terminal character for some word (Right (t,x)), then that word maps to x. Otherwise no word ends at that character, but there may be longer words, so the trie continues with (Left t). newtype Trie a = Trie { unTrie :: IntMap (Either (Trie a) (Trie a, a)) } deriving (Eq, Ord, Show) The following is where _I think_ the error lies (src/hs/Puzzler/Anagram.hs): -- | Creates an anagram dictionary from a file of words, one per line. The -- words may be compound, as long as there is one per line. createDictionary :: FilePath - IO Dictionary createDictionary path = (makeDictionary . lines) `liftM` readFile path -- | Makes an anagram dictionary from a list of words. makeDictionary :: [ByteString] - Dictionary makeDictionary ws = Dictionary { dictWords = dw , sortWords = go end Trie.empty } where dw = listArray (0, length ws - 1) ws ; (begin, end) = bounds dw go i t | seq t $ False = undefined | i begin = t | otherwise = go (i-1) -- $ Trie.insertWith Set.union (BS.sort (dw!i)) (Set.singleton i) t $ insertWith' Set.union (BS.sort (dw!i)) (Set.singleton i) t insertWith' f k v m | seq k $ False = undefined insertWith' f k v m = case Trie.lookup k m of Nothing - Trie.insert k v m Just s - (Trie.insert k $! f v s) m I've been scouring haskell-cafe for similar issues, and all seem to have been solved by a function similar to my `insertWith''. Uncommenting `Trie.insertWith' and commenting out the rest doesn't appear to differ noticeably in memory consumption. The implementation of `Trie.insertWith' is: insertWith :: (a - a - a) - ByteString - a - Trie a - Trie a insertWith f bs x t@(Trie m) = case uncons bs of Nothing - t Just (c, cs) - Trie (Map.alter myAlter (ord c) m) where myAlter Nothing = Just $ cons (insertWith f cs x empty, x) myAlter (Just (Left t)) = Just $ cons (insertWith f cs x t, x) myAlter (Just (Right (t,x'))) = Just $ Right (insertWith f cs x t, if isLast then f x x' else x') -- If `cs' is empty then `c' is the last char of the word to insert; -- that is, we're done. cons (t, x) = if isLast then Right (t, x) else Left t isLast = BS.null cs Any ideas? Denis puzzler-hr.pdf Description: Adobe PDF document ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] uuid package on OS X
The UUID package builds and runs fine on OS X without any need for `e2fsprog` -- just remove the `extra-libs` line from the Cabal file. (Apple put the UUID stuff in `libc`.) Has anyone tried to build it on Windows? -- _jsn |...UUID package...| http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uuid ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Fwd: profiling in haskell]
On Fri, Sep 12, 2008 at 2:30 PM, Vlad Skvortsov [EMAIL PROTECTED] wrote: How do I figure out what exactly in 'serialize' takes so much time? At this point, I don't know any more -- I can't see what inherited costs serialize could have that don't come from one of the cost centres you've inserted, either. Perhaps you could try the glasgow-haskell-users mailing list, where people interested in this are more likely to be reading carefully... Cheers, Tim -- Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in doubt Just enough: Obama/Biden '08. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Erroneous package listings in hackage?
On Fri, 2008-09-12 at 14:18 +0200, Henk-Jan van Tuyl wrote: On Fri, 12 Sep 2008 13:21:59 +0200, Dougal Stanton $ cabal list | less ... * cairo Latest version installed: 0.9.13 Homepage: http://haskell.org/gtk2hs/ License: BSD3 ... $ cabal install cairo cabal: There is no package named cairo I must admit I was surprised to see a gtk2hs module on Hackage, but not half as surprised when I found it wasn't there after all... There is clearly something wrong here; there is also a package named gtk that is listed with cabal list but cannot be downloaded. There is nothing wrong, but perhaps the output is not very clear. Here's what it says about packages are are installed *and* available on hackage: * zlib Latest version available: 0.4.0.4 Latest version installed: 0.4.0.4 Synopsis: Compression and decompression in the gzip and zlib formats License: BSD3 Where as for cairo and gtk you'll notice that it does not list any available version. Perhaps for packages that are installed but not re-installable via Cabal (like cairo, base, ghc etc) it should say something. Do you have any specific suggestions? Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
Hi, The following piece of code runs just fine, if I say: instance Random RGB where random = color randomR = colorR instead of: instance Random RGB where random = color2 randomR = colorR When I use random = color2 I encounter a stack space overflow: [EMAIL PROTECTED]:~/lab/test/colors ./var2 +RTS -K3000 Stack space overflow: current size 3000 bytes. Use `+RTS -Ksize' to increase it. I think I'm doing something wrong with the definition of colorR. Can anyone explain me what's wrong? import GHC.Word import Data.Word import System.Random import System.Random.Mersenne.Pure64 type RGB = (Int,Int,Int) instance Bounded RGB where minBound = minRGB maxBound = maxRGB minRGB = (0 ,0 ,0 ) maxRGB = (255,255,255) instance Random RGB where random = color2 randomR = colorR color2 :: RandomGen g ⇒ g → (RGB,g) color2 = colorR (minRGB,maxRGB) color :: RandomGen g ⇒ g → (RGB,g) color s0 = ((r,g,b),s3) where (r,s1) = q s0 (g,s2) = q s1 (b,s3) = q s2 q = randomR (0,255) colorR :: RandomGen g ⇒ (RGB,RGB) → g → (RGB,g) colorR ((a,b,c),(x,y,z)) s0 = ((r,g,b),s3) where (r,s1) = q (a,x) s0 (g,s2) = q (b,y) s1 (b,s3) = q (c,z) s2 q = randomR main :: IO () main = do mt ← newPureMT let cs = randoms mt :: [RGB] print cs -- This one also just works fine: import Data.Word import System.Random.Mersenne type RGB = (Word8,Word8,Word8) instance MTRandom RGB where random m = do r ← random m :: IO Word8 g ← random m :: IO Word8 b ← random m :: IO Word8 return (r,g,b) main :: IO () main = do g ← newMTGen Nothing cs ← randoms g :: IO [RGB] print cs but I really need the range constraints colorR might provide me and would greatly appreciate any help to understand/solve the issue. Best Regards, Cetin P/s: uname -a Linux linux-d312 2.6.25.16-0.1-default #1 SMP 2008-08-21 00:34:25 +0200 x86_64 x86_64 x86_64 GNU/Linux ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
cetin.sert: random = color2 randomR = colorR color2 :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color2 = colorR (minRGB,maxRGB) color :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color s0 = ((r,g,b),s3) where ^^ There's some corruption in this text. Could you post the file somewhere? -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
Oh, hi *^o^* mersenne.pure64 http://sert.homedns.org/lab/colors/var2.hs mersenne http://sert.homedns.org/lab/colors/var.hs the problem seems to be with the definition of colorR in var2.hs CS 2008/9/13 Don Stewart [EMAIL PROTECTED] cetin.sert: random = color2 randomR = colorR color2 :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color2 = colorR (minRGB,maxRGB) color :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color s0 = ((r,g,b),s3) where ^^ There's some corruption in this text. Could you post the file somewhere? -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
Oh, you've got unicode source. What's the flag to get this to actually compile? (Note to readers, using extensions , you should always include the LANGUAGE pragmas required to build the file when asking for help :) How are you compiling this? -- Don cetin.sert: Oh, hi *^o^* mersenne.pure64 [1]http://sert.homedns.org/lab/colors/var2.hs mersenne [2]http://sert.homedns.org/lab/colors/var.hs the problem seems to be with the definition of colorR in var2.hs CS 2008/9/13 Don Stewart [EMAIL PROTECTED] cetin.sert: random = color2 randomR = colorR color2 :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color2 = colorR (minRGB,maxRGB) color :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color s0 = ((r,g,b),s3) where ^^ There's some corruption in this text. Could you post the file somewhere? -- Don References Visible links 1. http://sert.homedns.org/lab/colors/var2.hs 2. http://sert.homedns.org/lab/colors/var.hs 3. mailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
Cetin Sert wrote: [snip] colorR :: RandomGen g ⇒ (RGB,RGB) → g → (RGB,g) colorR ((a,b,c),(x,y,z)) s0 = ((r,g,b),s3) where (r,s1) = q (a,x) s0 (g,s2) = q (b,y) s1 (b,s3) = q (c,z) s2 q = randomR Look closely at how you use the variable 'b'. HTH, Bertram ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
Oh, sorry... ^__^ ghc -fglasgow-exts -O2 --make var ghc -fglasgow-exts -O2 --make var2 I've not used pragmas in any source file o_O so far... should go fix that sometime. Thanks for reminding... Using ghc 6.8.3, mersenne-random-0.1.3 and mersenne-random-pure64-0.2.0.2. (Cause I could not find out how to check things out with darcs from hackage o__O google was not very helpful there so I used the latest tar packages.) @don: sorry I sent my reply twice only to you and then to the list and you... it's because of gmail... I'll be very careful not to repeat my mistake. 2008/9/13 Don Stewart [EMAIL PROTECTED] Oh, you've got unicode source. What's the flag to get this to actually compile? (Note to readers, using extensions , you should always include the LANGUAGE pragmas required to build the file when asking for help :) How are you compiling this? -- Don cetin.sert: Oh, hi *^o^* mersenne.pure64 [1]http://sert.homedns.org/lab/colors/var2.hs mersenne [2]http://sert.homedns.org/lab/colors/var.hs the problem seems to be with the definition of colorR in var2.hs CS 2008/9/13 Don Stewart [EMAIL PROTECTED] cetin.sert: random = color2 randomR = colorR color2 :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color2 = colorR (minRGB,maxRGB) color :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color s0 = ((r,g,b),s3) where ^^ There's some corruption in this text. Could you post the file somewhere? -- Don References Visible links 1. http://sert.homedns.org/lab/colors/var2.hs 2. http://sert.homedns.org/lab/colors/var.hs 3. mailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
bertram.felgenhauer: Cetin Sert wrote: [snip] colorR :: RandomGen g ⇒ (RGB,RGB) → g → (RGB,g) colorR ((a,b,c),(x,y,z)) s0 = ((r,g,b),s3) where (r,s1) = q (a,x) s0 (g,s2) = q (b,y) s1 (b,s3) = q (c,z) s2 q = randomR Look closely at how you use the variable 'b'. :-) fast eyes. Btw, Cetin, this is good practice, along with -funbox-strict-fields: data RGB = RGB !Int !Int !Int deriving Show Much better code than using a lazy triple. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
Oh thank you both *^o^*... now works like a charm again. Btw, Cetin, this is good practice, along with -funbox-strict-fields: data RGB = RGB !Int !Int !Int deriving Show Much better code than using a lazy triple. Where can I read more of such good practice? Looking forward to Real World Haskell to read lots of code, hope it'll help lots of people interested in learning haskell. (Will be released around Christmas here in Germany, I think.) CS 2008/9/13 Don Stewart [EMAIL PROTECTED] bertram.felgenhauer: Cetin Sert wrote: [snip] colorR :: RandomGen g ⇒ (RGB,RGB) → g → (RGB,g) colorR ((a,b,c),(x,y,z)) s0 = ((r,g,b),s3) where (r,s1) = q (a,x) s0 (g,s2) = q (b,y) s1 (b,s3) = q (c,z) s2 q = randomR Look closely at how you use the variable 'b'. :-) fast eyes. Btw, Cetin, this is good practice, along with -funbox-strict-fields: data RGB = RGB !Int !Int !Int deriving Show Much better code than using a lazy triple. ___ 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] random colors, stack space overflow, mersenne and mersenne.pure64
cetin.sert: Where can I read more of such good practice? Looking forward to Real World Haskell to read lots of code, hope it'll help lots of people interested in learning haskell. (Will be released around Christmas here in Germany, I think.) Yeah, that's right. November some time. There's a chapter that talks about performance and data structures, http://book.realworldhaskell.org/read/profiling-and-optimization.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
On 2008 Sep 12, at 21:57, Don Stewart wrote: cetin.sert: random = color2 randomR = colorR color2 :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color2 = colorR (minRGB,maxRGB) color :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color s0 = ((r,g,b),s3) where There's some corruption in this text. Could you post the file somewhere? It's not corrupt; he used UTF-8 symbols. It shows up properly in Mail.app but doesn't quote right (admittedly I force plaintext). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Windows console
On 2008-09-12 20:29 +0100 (Fri), Andrew Coppin wrote: Looks like the only thing it doesn't do is let you change the title on the console window. (Because, obviously, that's only possible on Windows.) Right. Unless you send an ^[^H]0;foo^G sequence (^[ being ESC) to your xterm. You'll find that the title changes to foo. cjs -- Curt Sampson [EMAIL PROTECTED]+81 90 7737 2974 Mobile sites and software consulting: http://www.starling-software.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
main :: IO () main = do as - getArgs mt - newPureMT let colors = randomRs (lo,hi) mt :: [RGB] print $ zip tx cs where lo = read $ as !! 0 hi = read $ as !! 1 tx =as !! 2 Why is as not visible in the where block? 2008/9/13 Brandon S. Allbery KF8NH [EMAIL PROTECTED] On 2008 Sep 12, at 21:57, Don Stewart wrote: cetin.sert: random = color2 randomR = colorR color2 :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color2 = colorR (minRGB,maxRGB) color :: RandomGen g .$BM.(B g .$B*.(B (RGB,g) color s0 = ((r,g,b),s3) where There's some corruption in this text. Could you post the file somewhere? It's not corrupt; he used UTF-8 symbols. It shows up properly in Mail.app but doesn't quote right (admittedly I force plaintext). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hackage needs a theme song!
I realized tonight that Hackage needs a theme song. Here is my attempt at it, apologies to Jefferson Starship: We built this hackage, We built this hackage on lambda and types Say you don't know me, or the parameters I pass Say you don't care who instances this type class Knee deep in the thunk, value infinitely big Too many constraints eating up the type sig Main runs the Monad, Listen to the Reader Don't you remember? We built this hackage We built this hackage on lambda and types! We built this hackage, we built this hackage on lambda and types Built this hackage, we built this hackage on lambda and types Someone always playing package games Who cares they're always changing package names We just want to compile here, someone stole the type hack They call us lazy, evaluate us off the stack Main runs the Monad, Listen to the Reader Don't you remember? We built this hackage We built this hackage on lambda and types! We built this hackage, we built this hackage on lambda and types Built this hackage, we built this hackage on lambda and types It's just another version in our release style Cabal has got the build deps, and we upload the file Who counts the downloads underneath package node Who writes the type errors into our source code Don't tell us you need us, 'cause we're the db of tools Looking for pragmas, crawling through your RULES Don't you remember ... Main runs the Monad, Listen to the Reader - Don't you remember? We built this hackage, We built this hackage on lambda and types We built this hackage, we built this hackage on lambda and types Built this hackage, we built this hackage on lambda and types Built this hackage, we built this hackage on lambda and types Built this hackage, we built this hackage on lambda and types We built, we built this hackage yeah We built this hackage We built, we built this hackage (Repeat - fade) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
cetin.sert: main :: IO () main = do as - getArgs mt - newPureMT let colors = randomRs (lo,hi) mt :: [RGB] print $ zip tx cs where lo = read $ as !! 0 hi = read $ as !! 1 tx =as !! 2 Why is as not visible in the where block? Same as: main = let lo = read $ as !! 0 hi = read $ as !! 1 tx =as !! 2 in do as - getArgs mt - newPureMT let colors = randomRs (lo,hi) mt :: [RGB] print $ zip tx cs If that helps think about when things are bound. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] random colors, stack space overflow, mersenne and mersenne.pure64
On Fri, Sep 12, 2008 at 8:53 PM, Don Stewart [EMAIL PROTECTED] wrote: cetin.sert: main :: IO () main = do as - getArgs mt - newPureMT let colors = randomRs (lo,hi) mt :: [RGB] print $ zip tx cs where lo = read $ as !! 0 hi = read $ as !! 1 tx =as !! 2 Why is as not visible in the where block? Same as: main = let lo = read $ as !! 0 hi = read $ as !! 1 tx =as !! 2 in do as - getArgs mt - newPureMT let colors = randomRs (lo,hi) mt :: [RGB] print $ zip tx cs If that helps think about when things are bound. And you probably want this rewrite (untested): main :: IO () main = do as - getArgs let lo = read $ as !! 0 hi = read $ as !! 1 tx = as !! 2 mt - newPureMT let colors = randomRs (lo,hi) mt :: [RGB] print $ zip tx cs My indentation may be a bit off as I didn't use a fixed width font to type it. Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Twidge
Hi folks, I've released Twidge, a command-line Twitter and Identi.ca client, written -- of course -- in Haskell. I'm pretty excited about it, but then hey, I'm biased. Anyhow, it's available from Hackage or from the homepage at: http://software.complete.org/twidge I've also got links to its (11-page!) manual as well as some HOWTOs and FAQs on the wiki at the above URL. Comments, patches welcome. Feel free to reply here or send them to @jgoerzen. -- John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Windows console
On 2008 Sep 12, at 22:29, Curt Sampson wrote: On 2008-09-12 20:29 +0100 (Fri), Andrew Coppin wrote: Looks like the only thing it doesn't do is let you change the title on the console window. (Because, obviously, that's only possible on Windows.) Right. Unless you send an ^[^H]0;foo^G sequence (^[ being ESC) to your xterm. You'll find that the title changes to foo. 0 = both title and icon 1 = icon name 2 = titlebar text Most X11 terminal emulators use the same protocol. (ISTR that dtterm doesn't, but I don't think most people care any more.) One other gotcha is that Terminal.app on Leopard (dunno about Tiger) treats 0, 1, 2 the same way so if you set the icon name after the title you end up with the icon name in the titlebar. (OSX uses the titlebar text as the icon name when minimized.) -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe