Re: Haskell-Cafe Digest, Vol 61, Issue 49
whoops! wow, wrong message to reply to... please disregard the previous. Apologies, ~Mark Snyder ----- Original Message ---- From: "haskell-cafe-request@haskell.org" <haskell-cafe-request@haskell.org> To: haskell-cafe@haskell.org Sent: Thursday, September 25, 2008 12:13:22 PM Subject: Haskell-Cafe Digest, Vol 61, Issue 49 Send Haskell-Cafe mailing list submissions to haskell-cafe@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/haskell-cafe or, via email, send a message with subject or body 'help' to haskell-cafe-request@haskell.org You can reach the person managing the list at haskell-cafe-owner@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Haskell-Cafe digest..." Today's Topics: 1. RE: Injecting Haskell into C (Simon Peyton-Jones) 2. Re: Haskell board game (Ryan Ingram) 3. Re: Am I doing it right? (Achim Schneider) 4. Re: if - then - else layout (Jules Bean) 5. Re: if - then - else layout (Achim Schneider) 6. Re: Distributing Haskell binaries as OSX App Bundles (Christian Maeder) 7. Re: if - then - else layout (Achim Schneider) 8. Re: if - then - else layout (Achim Schneider) 9. announcing darcs 2.1.0pre2 (Eric Kow) 10. Re: pure Haskell database (jean-christophe mincke) 11. Re: pure Haskell database (Achim Schneider) 12. Re: pure Haskell database (Marc Weber) 13. Re[2]: [Haskell-cafe] pure Haskell database (Bulat Ziganshin) 14. Re: Google Android (Adam Langley) 15. Re: Google Android (Maarten Hazewinkel) 16. Where is OpenGL loadMatrix ? (minh thu) 17. Re: Where is OpenGL loadMatrix ? ( Krzysztof Skrz?tnicki ) 18. Re: Where is OpenGL loadMatrix ? (Achim Schneider) 19. Re: Re: Where is OpenGL loadMatrix ? (minh thu) 20. StateWriter: a monad-writing exercise (Anthony LODI) 21. Re: StateWriter: a monad-writing exercise (Henning Thielemann) 22. Re: Re: Where is OpenGL loadMatrix ? (Bit Connor) 23. Re: Re: Where is OpenGL loadMatrix ? (minh thu) 24. Re: Where is OpenGL loadMatrix ? (Achim Schneider) 25. Re: pure Haskell database (Manlio Perillo) 26. Microsoft's Craig Mundie outlines the future of computing (Lihn, Steve) 27. GHC 6.10, OS X, Fink and CPPFLAGS (Svein Ove Aas) 28. Re: Climbing up the shootout... (Ketil Malde) 29. Problem with existential quantification (Eric) ---------------------------------------------------------------------- Message: 1 Date: Thu, 25 Sep 2008 08:32:44 +0100 From: Simon Peyton-Jones <simonpj@microsoft.com> Subject: RE: [Haskell-cafe] Injecting Haskell into C To: Anatoly Yakovenko <aeyakovenko@gmail.com>, "roma@ro-che.info" <roma@ro-che.info> Cc: haskell <haskell-cafe@haskell.org> Message-ID: <638ABD0A29C8884A91BC5FB5C349B1C32D766E2F96@EA-EXMSG-C334.europe.corp.microsoft.com> Content-Type: text/plain; charset="us-ascii" Anatoly I have not been following the details, but would you consider writing up your example on the GHC user guide Wiki? http://haskell.org/haskellwiki/GHC/Using_the_FFI It's a very good way to share your experience with others. Simon | -----Original Message----- | From: haskell-cafe-bounces@haskell.org [mailto:haskell-cafe- | bounces@haskell.org] On Behalf Of Anatoly Yakovenko | Sent: 24 September 2008 22:42 | To: roma@ro-che.info | Cc: haskell | Subject: Re: [Haskell-cafe] Injecting Haskell into C | | you'll find this example really helpfull | | | ---------- Forwarded message ---------- | From: Claude Heiland-Allen <claudiusmaximus@goto10.org> | Date: 2008/6/5 | Subject: Re: [Haskell-cafe] example of FFI FunPtr | To: "Galchin, Vasili" <vigalchin@gmail.com> | Cc: haskell <haskell-cafe@haskell.org> | | | Galchin, Vasili wrote: | > | > Hello, | > | > I want to model a Haskell function that is a callback from C. I have | > only found one example in the unix package's Semaphore.hsc, which | apparently | > is not used. I want to be able to marshall a Haskell function that is a | > first class citizen residing in a Haskell data type and pass to a C | function | > via FFI. Are there examples of this? | | Attached is a simple example. | | The main thing to note is 'foreign import ccall "wrapper"' which gives | you a factory for turning Haskell functions into foreign function | pointers. | | More information: | | http://www.cse.unsw.edu.au/~chak/haskell/ffi/ | | | Claude | -- | http://claudiusmaximus.goto10.org | | | CallBacker: CallBacker.hs callerback.c callerback.h | ghc -O2 -Wall -fffi -o CallBacker CallBacker.hs callerback.c | | _______________________________________________ | Haskell-Cafe mailing list | Haskell-Cafe@haskell.org | http://www.haskell.org/mailman/listinfo/haskell-cafe ------------------------------ Message: 2 Date: Thu, 25 Sep 2008 01:09:02 -0700 From: "Ryan Ingram" <ryani.spam@gmail.com> Subject: Re: [Haskell-cafe] Haskell board game To: "Rafael C. de Almeida" <almeidaraf@gmail.com> Cc: haskell-cafe@haskell.org Message-ID: <2f9b2d30809250109g3f0a2359s31a003c515549875@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Bertram has put together a peg solitaire game using gtk2hs with Prompt for control: http://int-e.home.tlink.de/haskell/solitaire.tar.gz It's a good read and probably a good starting point for other board games. -- ryan On Wed, Sep 24, 2008 at 7:04 PM, Rafael C. de Almeida <almeidaraf@gmail.com> wrote:
Hello,
I'm interested in doing a simple board game on haskell. For that I want to be able to draw stuff like the possible player movements and I want to be able to display very simple animations. I want to know what graphical interface library you suggest to me.
I have almost no prior experience with graphical interfaces of any kind, so I rather start with something easy and straightforward. I have no need for great performance or anything like that. I'd like if it runs on windows with much trouble, that is, it'll be easy to package it for windows without requiring the user to install anything besides my game.
My first thought was to use GTK's gtkTable, but I'm unsure how easy it is to make it work on windows. Beside that, I'm not sure it would be the easiest API for me to use.
[]'s Rafael _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
------------------------------ Message: 3 Date: Thu, 25 Sep 2008 10:41:38 +0200 From: Achim Schneider <barsoap@web.de> Subject: [Haskell-cafe] Re: Am I doing it right? To: haskell-cafe@haskell.org Message-ID: <20080925104138.02079514@solaris> Content-Type: text/plain; charset=US-ASCII Daniel Fischer <daniel.is.fischer@web.de> wrote:
The fast searching function on ByteStrings has already been written for you :)
That's in ghc 6.8.3, which is not in gentoo but only in the haskell overlay, which means that all blame goes to the gentoo maintainers for being utterly out of date. The KMP import works like a charm. findSubstring is only defined for strict bytestrings... try running those benchmarks again, this time on data bigger than your ram. Not to mention that it's deprecated. The really interesting topic is hacking Parsec to use KMP search on "manyTill anyChar (try string match), or rather any recursive try involving combinators that can calculate the position for the next candidate match as a side effect. PS: Thank you for not pointing out that my original code crashes on B.tail B.empty in some cases, or even just that it can't replace overlapping matches at all. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or broadcasting of this signature prohibited. ------------------------------ Message: 4 Date: Thu, 25 Sep 2008 09:45:12 +0100 From: Jules Bean <jules@jellybean.co.uk> Subject: Re: [Haskell-cafe] if - then - else layout To: leledumbo <leledumbo_cool@yahoo.co.id> Cc: haskell-cafe@haskell.org Message-ID: <48DB4F98.9000804@jellybean.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed leledumbo wrote:
consider this partial program: if n>5 then putStrLn "big" else putStrLn "small"
this works fine in hugs, but in ghc I must change it to: if n>5 then putStrLn "big" else putStrLn "small"
Actually both of those are valid expressions. And they both work in hugs and ghc. The question I imagine you're asking involves layout mode: do if n>5 then putStrLn "big" else putStrLn "small" this is shorthand for do { if n > 5 then putStrLn "big" ; else putStrLn "small" } which is a syntax error. A statement in a do block cannot begin with the keyword "else". If you indent the else a bit further than it counts and a continuation of the enclosing expression (beginning with if) so it desugars to do { if n > 5 then putStrLn "big" else putStrLn "small" } which is fine. Haskell' is apparently going to include a hack to permit this case. I think that's a poor decision, because including a hack to the layout rule makes it harder to understand and explain the layout rule. Jules ------------------------------ Message: 5 Date: Thu, 25 Sep 2008 10:48:21 +0200 From: Achim Schneider <barsoap@web.de> Subject: [Haskell-cafe] Re: if - then - else layout To: haskell-cafe@haskell.org Message-ID: <20080925104821.09da2a93@solaris> Content-Type: text/plain; charset=US-ASCII "Brandon S. Allbery KF8NH" <allbery@ece.cmu.edu> wrote:
I think Hugs is violating the Haskell98 layout rules.
One could argue that GHC should, too. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or broadcasting of this signature prohibited. ------------------------------ Message: 6 Date: Thu, 25 Sep 2008 11:04:00 +0200 From: Christian Maeder <Christian.Maeder@dfki.de> Subject: [Haskell-cafe] Re: Distributing Haskell binaries as OSX App Bundles To: Stephen <analytic@gmail.com> Cc: Haskell-Cafe@haskell.org Message-ID: <48DB5400.4060804@dfki.de> Content-Type: text/plain; charset=ISO-8859-1 Stephen wrote:
I wrote a command-line program recently for a friend in haskell. However, he's far away and not particularly computer literate. I sent him the raw binaries, but they came up with errors about not being able to find libgmp stuff. So then I thought I should probably be able to
I usually link in libgmp.a statically. This happens automatically if libgmp.a resides in ghc's libdir (just copy it) Cheers Christian ------------------------------ Message: 7 Date: Thu, 25 Sep 2008 11:12:26 +0200 From: Achim Schneider <barsoap@web.de> Subject: [Haskell-cafe] Re: if - then - else layout To: haskell-cafe@haskell.org Message-ID: <20080925111226.67482196@solaris> Content-Type: text/plain; charset=US-ASCII Jules Bean <jules@jellybean.co.uk> wrote:
do if n>5 then putStrLn "big" else putStrLn "small"
this is shorthand for
do { if n > 5 then putStrLn "big" ; else putStrLn "small" }
which is a syntax error. A statement in a do block cannot begin with the keyword "else".
Haskell' is apparently going to include a hack to permit this case. I think that's a poor decision, because including a hack to the layout rule makes it harder to understand and explain the layout rule.
There's no need to hack the layout rule, you're even giving pointers to the solution. Something like this: if p = do (_, c, a) <- get put (b, c, a) mzero then c = do (b, _, a) <- get put (b, c, a) mzero else a = do (b, c, _) <- get put (b, c, a) mzero end = do (b, c, a) <- get return if p then a else c Advantages are obvious: Order doesn't really matter anymore, as in then "get away" else "or else" if i tell you to end Furthermore, this scheme supports logical comments, a rare kind of control structure enabling mindboggingly diverse rapid prototyping options: if i knew what i want to do if i knew how to do it then i'd have written the next line much earlier if i wrote this line then i don't need to remove the other lines else where in other languages i'd have to do that end -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or broadcasting of this signature prohibited. ------------------------------ Message: 8 Date: Thu, 25 Sep 2008 11:20:58 +0200 From: Achim Schneider <barsoap@web.de> Subject: [Haskell-cafe] Re: if - then - else layout To: haskell-cafe@haskell.org Message-ID: <20080925112058.46e0c095@solaris> Content-Type: text/plain; charset=US-ASCII Achim Schneider <barsoap@web.de> wrote:
if i knew how to do it
Sorry, apparent mistake, besides confusing b (bool) with p (predicate): if p _ c = do (_, _, a) <- get put (p, c, a) mzero -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or broadcasting of this signature prohibited. ------------------------------ Message: 9 Date: Thu, 25 Sep 2008 10:32:27 +0100 From: Eric Kow <kowey@darcs.net> Subject: [Haskell-cafe] announcing darcs 2.1.0pre2 To: darcs-users@darcs.net Cc: haskell-cafe@haskell.org Message-ID: <20080925093227.GG301@Macintosh.local> Content-Type: text/plain; charset="utf-8" Hi everybody, The second pre-release of darcs 2.1 (formerly known as 2.0.3) is now available at http://darcs.net/darcs-2.1.0pre2.tar.gz We have increased the version number since the last pre-release because we are adopting an important new behaviour: The darcs initialize command now creates darcs-2 format repositories by default This will help new repositories to benefit from the improved handling of duplicate patches and to avoid the exponential time conflicts problem. Upcoming release schedule ------------------------- 2008-10-03: darcs 2.1.0pre3 2008-10-10: darcs 2.1.0 Work remaining -------------- * http://bugs.darcs.net/issue971 (Petr Ročkai) When using hashed or repositories, allow darcs check to deal with filenames that differ only in case when run on a case-insensitive filesystem. Petr has done 90% of the work for this -- he has implemented this for darcs repair -- so this shall largely be a question of refactoring. * http://bugs.darcs.net/issue1003 Allow darcs-transfer mode to deal with a specific set of missing files (namely _darcs/format) so that users can benefit from ssh connection sharing even if the remote end uses an old-fashioned repository. In the meantime, a simple workaround is to touch the _darcs/format file in the remote repoistory * http://bugs.darcs.net/issue1078 Fix a corner case in paths handling that makes darcs overly cautious if the repository is a symbolic link * http://bugs.darcs.net/issue1026 Improve the error messages for 'bug in get_extra' errors, which can happen if darcs is fooled into thinking that two patches are the same. Changes since the last pre-release ---------------------------------- * User Experience: Do not allow users to add files to a darcs repository if their filenames would be considered invalid under Windows. This can be overridden with the --reserved-ok flag (issue53, Eric Kow) * Bug Fix: Do not leave behind a half-gotten directory if darcs get fails (issue1041, Vlad Dogaru, David Roundy) * User Experience: notice when you are trying to pull from a seemingly unrelated repository, that is one with a sufficiently different history. This can be overridden with the --allow-unrelated-repos flag (Dmitry Kurochkin, David Roundy) * Bug Fix: Fix hang after a user input error (for example, EOF) (Judah Jacobson) * Quality Assurance: Improvements to documentation and online help (Simon Michael) -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9
Mark Snyder wrote:
whoops! wow, wrong message to reply to... please disregard the previous.
Apologies, ~Mark Snyder
[Snip entire digest] Ouch. When apologising for quoting the entire digest, quoting your entire previous message doesn't really help the situation :-). <grin> -- src/
participants (2)
-
Mark Snyder -
Simon Richard Clarkstone