From tretriluxana.s at gmail.com Sat Sep 1 01:42:30 2007 From: tretriluxana.s at gmail.com (Sukit Tretriluxana) Date: Sat Sep 1 01:33:12 2007 Subject: [Haskell-cafe] GHC 6.6.1 binary package for Ubuntu available? In-Reply-To: References: <8252533f0708310919sc72e8f4ia7c752925b8d5999@mail.gmail.com> Message-ID: <8252533f0708312242w6447b636r18ca2705aaeed2a2@mail.gmail.com> Thanks! On 8/31/07, Thomas Hartman wrote: > > > you may find this helpful. (with link) > > http://www.haskell.org/pipermail/haskell-cafe/2007-April/024137.html > > > > *"Sukit Tretriluxana" * > Sent by: haskell-cafe-bounces@haskell.org > > 08/31/2007 12:19 PM > To > haskell-cafe@haskell.org cc > > Subject > [Haskell-cafe] GHC 6.6.1 binary package for Ubuntu available? > > > > > > > Hi, > > I am wondering if there is the binary package for GHC 6.6.1 for Ubuntu. I > searched in the package manager and I only see the version 6.6. > > Thanks, > Ed_______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > --- > > This e-mail may contain confidential and/or privileged information. If you > > are not the intended recipient (or have received this e-mail in error) > please notify the sender immediately and destroy this e-mail. Any > unauthorized copying, disclosure or distribution of the material in this > e-mail is strictly forbidden. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070831/4d60a4a6/attachment.htm From semanticphilosopher at googlemail.com Sat Sep 1 07:03:46 2007 From: semanticphilosopher at googlemail.com (Neil Davies) Date: Sat Sep 1 06:54:10 2007 Subject: [Haskell-cafe] Data.Unique not "safe" in concurrent environments (or brain burned)? Message-ID: <46D94712.7000407@gmail.com> Hi, I was looking over the libraries for bits of GHC (no doubt a standard form of relaxation for readers of this list), and noticed the following statement (in Data.Unique): -- | Creates a new object of type 'Unique'. The value returned will -- not compare equal to any other value of type 'Unique' returned by -- previous calls to 'newUnique'. This set me thinking - so I looked at the code newUnique :: IO Unique newUnique = do val <- takeMVar uniqSource let next = val+1 putMVar uniqSource next return (Unique next) In the concurrent execution world in which we live - I don't think that the implementation supports the "uniqueness" statement above - or am I not understanding something? Cheers Neil From semanticphilosopher at googlemail.com Sat Sep 1 07:13:07 2007 From: semanticphilosopher at googlemail.com (Neil Davies) Date: Sat Sep 1 07:03:51 2007 Subject: [Haskell-cafe] Re: Data.Unique not "safe" in concurrent environments (or brain burned)? In-Reply-To: <46D94712.7000407@gmail.com> References: <46D94712.7000407@gmail.com> Message-ID: <46D94943.4000704@gmail.com> Let me answer this myself - brain burnt... Of course it is OK, that is precisely the semantics of MVars - the are empty or full, thus assuring the mutual exclusion between threads. Been a hard week..... Neil ... so the deeper question - why don't you realise these mistakes till five minutes *after* you've pressed the send button.... Neil Davies wrote: > Hi, I was looking over the libraries for bits of GHC (no doubt a standard form of > relaxation for readers of this list), and noticed the following statement > (in Data.Unique): > > -- | Creates a new object of type 'Unique'. The value returned will > -- not compare equal to any other value of type 'Unique' returned by > -- previous calls to 'newUnique'. > > This set me thinking - so I looked at the code > > newUnique :: IO Unique > newUnique = do > val <- takeMVar uniqSource > let next = val+1 > putMVar uniqSource next > return (Unique next) > > In the concurrent execution world in which we live - I don't think that the implementation > supports the "uniqueness" statement above - or am I not understanding something? > > Cheers > > Neil > > > From alexteslin at yahoo.co.uk Sat Sep 1 07:59:50 2007 From: alexteslin at yahoo.co.uk (Alexteslin) Date: Sat Sep 1 07:50:31 2007 Subject: [Haskell-cafe] defining mapPairs function In-Reply-To: <22fcbd520708291513q61273f54i2f7beee1c7489acd@mail.gmail.com> References: <12395628.post@talk.nabble.com> <22fcbd520708291513q61273f54i2f7beee1c7489acd@mail.gmail.com> Message-ID: <12439704.post@talk.nabble.com> Brent Yorgey wrote: > > On 8/29/07, Alexteslin wrote: >> >> >> Hello, >> >> I just came across with this question on the exam and can not think of >> implementing it. > > > Wait, is this an exam for a class you're taking? Or just a problem from > an > exam that you're trying to solve for fun? If the former, it really isn't > appropriate to ask the list to solve the problem for you, or even for > hints. Your work on the exam should be your own. > > -Brent > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > Hi, It is the former, but I sat an exam and trying to discuss my exam answers which will make no difference to what so ever to an exam, as an exam duration was 1.5 hours. Which means that no matter how much i would like to try to amend my answers, it is too late. I merely trying to figure out if i answered my questions right. -- View this message in context: http://www.nabble.com/defining-mapPairs-function-tf4350356.html#a12439704 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. From ross at soi.city.ac.uk Sat Sep 1 08:56:31 2007 From: ross at soi.city.ac.uk (Ross Paterson) Date: Sat Sep 1 08:48:01 2007 Subject: [Haskell-cafe] defining mapPairs function In-Reply-To: <12439704.post@talk.nabble.com> References: <12395628.post@talk.nabble.com> <22fcbd520708291513q61273f54i2f7beee1c7489acd@mail.gmail.com> <12439704.post@talk.nabble.com> Message-ID: <20070901125630.GA3474@soi.city.ac.uk> On Sat, Sep 01, 2007 at 04:59:50AM -0700, Alexteslin wrote: > It is the former, but I sat an exam and trying to discuss my exam answers > which will make no difference to what so ever to an exam, as an exam > duration was 1.5 hours. Which means that no matter how much i would like to > try to amend my answers, it is too late. I merely trying to figure out if i > answered my questions right. I can confirm that this is innocent checking after the fact. This is question 2(e) on my resit paper, but the first posting was half an hour after the end of the exam. The answer you posted is correct, though those suggested by Neil and Max would be neater. From byorgey at gmail.com Sat Sep 1 10:35:54 2007 From: byorgey at gmail.com (Brent Yorgey) Date: Sat Sep 1 10:26:34 2007 Subject: [Haskell-cafe] defining mapPairs function In-Reply-To: <12439704.post@talk.nabble.com> References: <12395628.post@talk.nabble.com> <22fcbd520708291513q61273f54i2f7beee1c7489acd@mail.gmail.com> <12439704.post@talk.nabble.com> Message-ID: <22fcbd520709010735x33e72135k58f012198150170d@mail.gmail.com> On 9/1/07, Alexteslin wrote: > > > Hi, > > It is the former, but I sat an exam and trying to discuss my exam answers > which will make no difference to what so ever to an exam, as an exam > duration was 1.5 hours. Which means that no matter how much i would like > to > try to amend my answers, it is too late. I merely trying to figure out if > i > answered my questions right. OK, my apologies! From the way you phrased it, it sounded to me like it was some sort of take-home exam you were working on. In retrospect I guess that was sort of unlikely, but stranger things have happened. =) -Brent -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070901/b0238923/attachment.htm From sven.panne at aedion.de Sat Sep 1 12:47:15 2007 From: sven.panne at aedion.de (Sven Panne) Date: Sat Sep 1 12:37:58 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <1185903596.5989.46.camel@localhost> References: <1185903596.5989.46.camel@localhost> Message-ID: <200709011847.16725.sven.panne@aedion.de> On Tuesday 31 July 2007 19:39, Duncan Coutts wrote: > [...] > The docs for those packages would be available for packages installed > via cabal (assuming the user did the optional haddock step) and would > link to each other. Well, on a normal Linux distro a user should *never* have to call cabal (or any of its cousins) directly, the distro's package manager should be the used instead. On an e.g. RPM system, the .spec file would use Cabal to e.g. (un-)register a package, because RPM has to know what is installed, which other packages are prerequisites, how to cleanly uninstall, etc. IMHO Cabal should not try to mirror a full-fledged package system, simply because on every (non-Windows ;-) platform there are tons of native tools for this purpose, and Cabal is not "in the driver's seat" when it comes to SW installation. > What is missing from the local docs is a single integrated index page > that lists all the modules and then links off to the various packages's > docs like we have on the ghc website. > > The problem with generating one of those is what manages it? What > package would it belong to etc. Of course we are not the first project to face this kind of problem: Texinfo offers a central contents page as well. To maintain this page, it comes with a tool "install-info", which updates the index page after (de-)installation. On RPM systems, the .spec file calls install-info after (de-)installation of a package with info pages. http://www.gnu.org/software/texinfo/manual/texinfo/html_node/Installing-an-Info-File.html > On some systems (windows, gnome) there are dedicated help viewers that > can help with this contents/index issue. haddock supports both (mshelp, > devhelp). I'm not sure everyone would find that a sufficient solution > however. A "install-haddock" tool would be the solution IMHO. Cheers, S. From chaddai.fouche at gmail.com Sat Sep 1 13:48:11 2007 From: chaddai.fouche at gmail.com (=?ISO-8859-1?Q?Chadda=EF_Fouch=E9?=) Date: Sat Sep 1 13:38:51 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <200709011847.16725.sven.panne@aedion.de> References: <1185903596.5989.46.camel@localhost> <200709011847.16725.sven.panne@aedion.de> Message-ID: As a enthusiast Perl user over the years, I note that the CPAN and the associated toolkit (the CPAN module, its shell, ExtUtils::MakeMaker and Module::Build) is pretty good at this. It has it's share of cruft (in fact a whole lot of it) but it's certainly better than most solutions in this field in my eye. Perl already has it's own centralised documentation on the CPAN and local copies are installed and accessible through the command line tool perldoc and miscellanous other modules that allows a more pleasant esthetic experience (Pod::POM::Web is pretty good at this, it even comes with it's own little http server and allow you to search your local doc in many way). It might be worth keeping an eye on the development of the CP6AN if it ever comes to life (I'm a firm Perl6 believer but some don't share this belief, with some justifications I fear)... Cabal is an interesting experiment but it just don't compare for now. -- Jeda? From james at neurogami.com Sat Sep 1 14:50:10 2007 From: james at neurogami.com (James Britt) Date: Sat Sep 1 14:40:57 2007 Subject: [Haskell-cafe] HApps API Documentation? Message-ID: <46D9B462.5020106@neurogami.com> Are there alternative sites for HAppS API docs? There are two links on http://happs.org/#documentation but both give "File not found!" messages. Thanks, James From felipe.lessa at gmail.com Sat Sep 1 16:01:56 2007 From: felipe.lessa at gmail.com (Felipe Almeida Lessa) Date: Sat Sep 1 15:52:35 2007 Subject: [Haskell-cafe] HApps API Documentation? In-Reply-To: <46D9B462.5020106@neurogami.com> References: <46D9B462.5020106@neurogami.com> Message-ID: On 9/1/07, James Britt wrote: > Are there alternative sites for HAppS API docs? I'm currently using the one from the tarball (runghc Setup.hs haddock). -- Felipe. From jerzy.karczmarczuk at info.unicaen.fr Sat Sep 1 16:55:06 2007 From: jerzy.karczmarczuk at info.unicaen.fr (jerzy.karczmarczuk@info.unicaen.fr) Date: Sat Sep 1 16:45:06 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> Message-ID: Yes, I know, this is Haskell list. So, I apologize, but not too much... Johan Gr?nqvist cites me: >> Anyway, I believe strongly that ALL people who have problems... >> should be encouraged to learn Prolog. IN DEPTH, > > Do you have a recommendation on how to do this? > (e.g., books, web-pages, (available) lecture notes, problem sets) First, install a decent Prolog on your machine. There are plenty: http://kti.mff.cuni.cz/~bartak/prolog/implementations.html http://www.cs.cmu.edu/Groups/AI/html/faqs/lang/prolog/prg/part2/faq-doc-2.ht ml You may wish to install the free version of Visual Prolog. My favourite is the SWI Prolog: http://www.swi-prolog.org/ (University of Amsterdam) The documentation is complete, and the reference manual contains references to such standard books as ClocksinMellish, or Sterling&Shapiro. The last one is very, very instructive. Also, Prolog Programming for Artificial Intelligence, written by Bratko, is very useful. There are on the web collection of examples from this book, don't remember where. Try here: http://promethee.philo.ulg.ac.be/engdep1/download/prolog/bratko/ On-line there are thousands of examples, tutorials, etc. J. Fisher: (There is an example of cut, especially for A. Coppin) http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/contents.html others: http://www.coli.uni-saarland.de/~kris/learn-prolog-now/lpnpage.php?pageid=on line http://computing.unn.ac.uk/staff/cgpb4/prologbook/book.html http://www.cs.nuim.ie/~jpower/Courses/PROLOG/ Etc., etc. Really! Examples. For example: http://www.csse.monash.edu.au/~lloyd/tildeLogic/Prolog.toy/Examples/ http://kti.mff.cuni.cz/~bartak/prolog/learning.html http://www.visual-prolog.com/vip/example/ and of course there are discussion lists, FAQs, etc. Ask Google... =================== Andrew Coppin writes: > I did once try to learn Prolog. And failed. Miserably. > I just couldn't bend my head around how the Prolog interpreter manages to > make seemingly "impossible" leaps of deduction. (It's a *machine*! How can > it deduce arbitrarily complex conclusions from any arbitrary set of > axioms? That requires *intelligence*!) And yet, in other, seemingly > identical cases, it utterly fails to deduce patently *obvious* results... > really weird! One of standard exercices in Prolog is the construction of the meta-interpreter of Prolog in Prolog. While this is cheating, I recommend it to you. It opens eyes. Actually, there are three basic items to learn while trying to master Prolog after having dealt with the syntactic essentials term construction, and the like. 1. The unification, which shows the "ultimate" instance of pattern-matching and is useful for recognizing some techniques for the automatic inference of types in functional languages. 2. The usage of unbound "logical variable", which sometimes permits to to do things which require laziness in Haskell. 3. The control backtracking, which is at the heart of the logical non-de- terminism. Now, the non-deterministic algorithms in Haskell are usually implemented using the *data backtracking*, or the List Monad. The control backtrack, via, say success/failure continuations, is more difficult, they are rarely taught, and problematic because of strong typing. Prolog strategies are straightforward, and I simply cannot understand the comments of Andrew Coppin. Which arbitrary set of conclusions?? Which patently obvious results not derivable?? Be kind, give some examples, otherwise people may suspect that you are issuing vacuous statements... The best. Jerzy Karczmarczuk From benjamin.franksen at bessy.de Sat Sep 1 17:53:21 2007 From: benjamin.franksen at bessy.de (Benjamin Franksen) Date: Sat Sep 1 17:44:27 2007 Subject: [Haskell-cafe] Re: RE: Definition of the Haskell standard library References: <1185903596.5989.46.camel@localhost> <200709011847.16725.sven.panne@aedion.de> Message-ID: Sven Panne wrote: > On Tuesday 31 July 2007 19:39, Duncan Coutts wrote: >> [...] >> The docs for those packages would be available for packages installed >> via cabal (assuming the user did the optional haddock step) and would >> link to each other. > > Well, on a normal Linux distro a user should *never* have to call cabal (or > any of its cousins) directly, the distro's package manager should be the used > instead. This is very theoretical. I use debian (stable) and have to install non-deb Haskell libraries all the time. No way distro package maintainers can provide packages for each and every library out there, and even for 'standard' libs (whatever that may mean) sometimes you need a newer or an older version of a certain library (relative to what the distro offers). >> On some systems (windows, gnome) there are dedicated help viewers that >> can help with this contents/index issue. haddock supports both (mshelp, >> devhelp). I'm not sure everyone would find that a sufficient solution >> however. > > A "install-haddock" tool would be the solution IMHO. Yes. Cheers Ben From mmitar at gmail.com Sat Sep 1 18:27:57 2007 From: mmitar at gmail.com (Mitar) Date: Sat Sep 1 18:18:35 2007 Subject: [Haskell-cafe] let and fixed point operator In-Reply-To: <46D861C5.2060702@btinternet.com> References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46D861C5.2060702@btinternet.com> Message-ID: Hi! > I did once try to learn Prolog. And failed. Miserably. You should backtrack at this point and try again differently. :-) Mitar From prionic at gmx.de Sat Sep 1 18:38:00 2007 From: prionic at gmx.de (Martin =?utf-8?b?TMO8dGtl?=) Date: Sat Sep 1 18:28:50 2007 Subject: [Haskell-cafe] Re: HApps API Documentation? References: <46D9B462.5020106@neurogami.com> Message-ID: James Britt neurogami.com> writes: > > Are there alternative sites for HAppS API docs? > > There are two links on http://happs.org/#documentation but both give > "File not found!" messages. > > Thanks, > > James > Just compile your one version from the HAppS source. Use runghc Setup.hs haddock. You do have have haddock installed, havent you? From prionic at gmx.de Sat Sep 1 19:04:39 2007 From: prionic at gmx.de (Martin =?utf-8?b?TMO8dGtl?=) Date: Sat Sep 1 18:55:37 2007 Subject: [Haskell-cafe] Re: wanted: HAppS example combining state and io References: Message-ID: Thomas Hartman db.com> writes: > > > In the latest happs (darcs pulled, updated > head is 0.9.1 iirc), I am experimenting with the example file in src/HAppS/Examples/HTTP1.hs. > I would like to combine state with io. > Eventually io will mean stuff like reading from a database, but for now > I'm just reading a file. > The example file HTTP1.hs has an example > that demonstrates state with macid. > I added an example that allows you to > execute arbitrary io. > I tried, but was unable to, add a handler > that combines state and io. > > , h ["iohandler"] GET $ ioReadFileHandler > > , h ["statehandler"] GET $ stateHandler > > --, h ["ioandstatehandler"] GET $ ioAndStateHandler > ..... > -- displays contents of HAPPS.hs in > current directory > ioReadFileHandler = iohandler $ readFile > "./HAppS.hs" > -- displays incremented state counter > stateHandler = ok $ \() () -> > > modify (+(1::Int)) >> get >>= > respond . show > -- should combine effect of iohandler > with statehandler > -- specifically, should display contents > of HAppS.hs, and under that an incremented state handler > -- is this possible > ioAndStateHandler = undefined undefined > Is mixing state and io possible with > HAppS? If so, an example showing how to do it would be extremely helpful. > best, thomas. > ---This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. > > Attachment (https1-whatsnew): application/octet-stream, 1933 bytes > Attachment (HTTP1.hs): application/octet-stream, 4794 bytes > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > I had no trouble getting this handler to work: h ["iohandler"] GET $ \() () -> do modify (+1) x <- get respond $ do cnts <- readFile "./sometext.txt" sresult 200 (cnts ++ show x) I believe the trick is that you cant mix io INTO the HAppS ServerPart monad. But from the ServerPart monad you can RETURN an io action. From duncan.coutts at worc.ox.ac.uk Sat Sep 1 20:00:51 2007 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Sat Sep 1 19:49:29 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <200709011847.16725.sven.panne@aedion.de> References: <1185903596.5989.46.camel@localhost> <200709011847.16725.sven.panne@aedion.de> Message-ID: <1188691251.10322.198.camel@localhost> On Sat, 2007-09-01 at 18:47 +0200, Sven Panne wrote: > On Tuesday 31 July 2007 19:39, Duncan Coutts wrote: > > [...] > > The docs for those packages would be available for packages installed > > via cabal (assuming the user did the optional haddock step) and would > > link to each other. > > Well, on a normal Linux distro a user should *never* have to call cabal (or > any of its cousins) directly, the distro's package manager should be the used > instead. On an e.g. RPM system, the .spec file would use Cabal to e.g. > (un-)register a package, because RPM has to know what is installed, which > other packages are prerequisites, how to cleanly uninstall, etc. IMHO Cabal > should not try to mirror a full-fledged package system, simply because on > every (non-Windows ;-) platform there are tons of native tools for this > purpose, and Cabal is not "in the driver's seat" when it comes to SW > installation. I think it's inevitable that there will always be a mixture of packages that are managed by the system package manager and ones that are too insignificant to be packaged by the distro. So cabal-install should cooperate with the system package manager somehow. Another strategy would be to have tools that the users can use to generate system packages from cabal packages and then install those via the system package manager. We already have such tools for rpm and gentoo ebuilds. Again, these would be for the case of less significant package that the distro does not package itself. For example, gentoo has a tool that can be used to install perl CPAN packages via the system package manager, since there are many 1000's of CPAN packages and only a few hundred of those are included in the main portage collection. There are other cases not covered by system package managers, like unprivileged user installations under $HOME. > > The problem with generating one of those is what manages it? What > > package would it belong to etc. > > Of course we are not the first project to face this kind of problem: Texinfo > offers a central contents page as well. To maintain this page, it comes with [..] > A "install-haddock" tool would be the solution IMHO. That re-generates the index page, right. Perhaps haddock itself should be extended with this ability. All it should need to do is read all the .haddock files that ghc-pkg knows about and generate the index page from that. I assume the .haddock files contain enough information to do this, or it could be modified to include enough. Duncan From trebla at vex.net Sat Sep 1 21:12:30 2007 From: trebla at vex.net (Albert Y. C. Lai) Date: Sat Sep 1 21:03:11 2007 Subject: [Haskell-cafe] interaction between OS processes In-Reply-To: <20070830101428.GI16235@laptop.nowhere.net> References: <20070830101428.GI16235@laptop.nowhere.net> Message-ID: <46DA0DFE.5080807@vex.net> Andrea Rossato wrote: > loop s = do > putStrLn s Most likely, the content of s sits in a local buffer and never leaves this process, following most OS conventions and as others point out. Another process waiting for it will deadlock. Most similar process deadlock problems are not specific to Haskell or even relevant to Haskell; they are misunderstandings of the underneath OS. I recommend every Haskell programmer to take an in-depth Unix course. From trebla at vex.net Sat Sep 1 21:17:43 2007 From: trebla at vex.net (Albert Y. C. Lai) Date: Sat Sep 1 21:08:25 2007 Subject: [Haskell-cafe] let and fixed point operator In-Reply-To: References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46D861C5.2060702@btinternet.com> Message-ID: <46DA0F37.5000202@vex.net> Mitar wrote: >> I did once try to learn Prolog. And failed. Miserably. > > You should backtrack at this point and try again differently. :-) There is likely a problem if he has inadvently walked past a cut. XD From hughperkins at gmail.com Sat Sep 1 21:19:52 2007 From: hughperkins at gmail.com (Hugh Perkins) Date: Sat Sep 1 21:10:30 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> Message-ID: <837db430709011819x20f4a714m538d23482099853b@mail.gmail.com> Cool.... I had prolog for my Spectrum, many years ago (83?), but I stopped using it when I realized it didnt have any input/output capabilities beyond print, and no way to "escape" from the prolog "bubble", eg FFI (not sure what FFI stands for, but I think it is a way for Haskell to "escape" into other libraries?). Thanks for the links, it sounds fun. From hughperkins at gmail.com Sat Sep 1 21:29:54 2007 From: hughperkins at gmail.com (Hugh Perkins) Date: Sat Sep 1 21:20:33 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <1188691251.10322.198.camel@localhost> References: <1185903596.5989.46.camel@localhost> <200709011847.16725.sven.panne@aedion.de> <1188691251.10322.198.camel@localhost> Message-ID: <837db430709011829p28f78ff9le32e5340360e7389@mail.gmail.com> A really simple way to track the "quality" of a package is to display the number of downloads. A posteriorae, this works great in other download sites. We can easily hypothesize about why a download count gives a decent indication of some measure of quality: - more people downloading it means more people specifically wanted that package - more people downloading it means more people trying it, giving feedback, maybe giving patches - and, of course, it's an objective measure, easy to do From bf3 at telenet.be Sun Sep 2 02:08:03 2007 From: bf3 at telenet.be (Peter Verswyvelen) Date: Sun Sep 2 01:58:40 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <46DA4F34.1010202@telenet.be> References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA4F34.1010202@telenet.be> Message-ID: <46DA5343.3020200@telenet.be> An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070902/860246ca/attachment.htm From bf3 at telenet.be Sun Sep 2 02:08:58 2007 From: bf3 at telenet.be (Peter Verswyvelen) Date: Sun Sep 2 01:59:34 2007 Subject: [Haskell-cafe] Extending the idea of a general Num to other types? In-Reply-To: <46DA52EA.2040502@telenet.be> References: <46DA52EA.2040502@telenet.be> Message-ID: <46DA537A.6070004@telenet.be> I like the fact that Haskel treats numbers in a generic way, so you can lift them to any other datatype by instantiating Num. Can the same be done on other builtin constructs? For example, if I have [a], can this list be lifted to other types? I guess not, because no type class exists for the list type? Does this make sense? I'm still searching for correct terminology... Thanks, Peter From james at neurogami.com Sun Sep 2 02:28:00 2007 From: james at neurogami.com (James Britt) Date: Sun Sep 2 02:18:47 2007 Subject: [Haskell-cafe] Re: HApps API Documentation? In-Reply-To: References: <46D9B462.5020106@neurogami.com> Message-ID: <46DA57F0.7090505@neurogami.com> Martin L?tke wrote: > James Britt neurogami.com> writes: > >> Are there alternative sites for HAppS API docs? >> >> There are two links on http://happs.org/#documentation but both give >> "File not found!" messages. >> >> Thanks, >> >> James >> > > Just compile your one version from the HAppS source. Use runghc Setup.hs > haddock. OK, I can give that a shot. I'm still curious about my original question, though. Are there alternative online API docs for Happs? > You do have have haddock installed, havent you? > I didn't. I'm grabbing Alex from darcs now. James From s.clover at gmail.com Sun Sep 2 02:48:02 2007 From: s.clover at gmail.com (Sterling Clover) Date: Sun Sep 2 02:38:44 2007 Subject: [Haskell-cafe] Looking for suggestions to improve my algorithm In-Reply-To: References: <2f9b2d30708291639t57215541y6faa0a129d873fc6@mail.gmail.com> Message-ID: <3C5F61C3-F5D3-4A0F-99BE-138B174D58C7@gmail.com> I played around with this for a while based on the same sort of algorithm and ended up with a similar solution too. It turns out the operations saved by keeping track of already visited nodes are more than outweighed by the cost of doing so. (As you can see, I still have the hook in my code where amCn returns the visited list that I'm just disregarding. Ii had initially kept a giant array of all values to calculate, but the cost of that was unmanageable. After that, my big roadblock was that I couldn't come up with a good sumDivisors function to save my life. I tried a number of "optimized" methods that combined trial division with reduction based on prime factorizations, but i had to either reduce the lists by checking divisibility again somewhere along the way, or calling nub, and strictness and memoization still didn't let me produce a factorization in reasonable time. In the end, I ended up lifting yours. The only problem is that I've been staring at it for a bit and am not really sure how it works. I'd love an explanation. In any case, the code of my solution follows: amCn maxval n = amCn' (propDSum n) [] where amCn' cur visitedlist = if cur > maxval || cur < n then (0,visitedlist) else if elem cur visitedlist then (0,visitedlist) else if (cur == n) then ((length visitedlist) + 1,visitedlist) else (amCn' $! (propDSum cur)) $! (cur:visitedlist) longestAmTo maxval = longestAm' 2 (0,0) where longestAm' n bestFit@(chainLen,minVal) = if n > maxval then bestFit else longestAm' (n+1) $! bestFit' where (count, visited) = amCn maxval n bestFit' = if chainLen > count then bestFit else (count,n) properDivisorsSum :: UArray Int Int properDivisorsSum = accumArray (+) 1 (0,1000000) $ (0,-1):[(k,factor)| factor<-[2..1000000 `div` 2] , k<-[2*factor,2*factor+factor..1000000] ] propDSum n = properDivisorsSum ! n --S On Aug 30, 2007, at 11:33 AM, Chadda? Fouch? wrote: > 2007/8/30, Chadda? Fouch? : >> I managed it in 7 seconds (on 1500 MHz) with an idea close to yours >> (but I used IntSet, not IntMap), Daniel Fisher gave you some good >> ideas to achieve it, the real snail in this problem is the >> sumDivisors >> function. >> > I put my final solution on the wiki, it get it done in 6s now (on a > Pentium M 1.73Mhz). > > -- > Jeda? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From mailing_list at istitutocolli.org Sun Sep 2 02:51:16 2007 From: mailing_list at istitutocolli.org (Andrea Rossato) Date: Sun Sep 2 02:41:57 2007 Subject: [Haskell-cafe] interaction between OS processes In-Reply-To: <46DA0DFE.5080807@vex.net> References: <20070830101428.GI16235@laptop.nowhere.net> <46DA0DFE.5080807@vex.net> Message-ID: <20070902065115.GQ16235@laptop.nowhere.net> On Sat, Sep 01, 2007 at 09:12:30PM -0400, Albert Y. C. Lai wrote: > Andrea Rossato wrote: > > loop s = do > > putStrLn s > > Most likely, the content of s sits in a local buffer and never leaves this > process, following most OS conventions and as others point out. Another > process waiting for it will deadlock. > > Most similar process deadlock problems are not specific to Haskell or even > relevant to Haskell; they are misunderstandings of the underneath OS. I > recommend every Haskell programmer to take an in-depth Unix course. Yes, I knew it was something related to the underneath OS. I'll have to study Unix seriously.... Thanks you guys for your kind attention. Andrea From sven.panne at aedion.de Sun Sep 2 05:19:26 2007 From: sven.panne at aedion.de (Sven Panne) Date: Sun Sep 2 05:10:04 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <837db430709011829p28f78ff9le32e5340360e7389@mail.gmail.com> References: <1188691251.10322.198.camel@localhost> <837db430709011829p28f78ff9le32e5340360e7389@mail.gmail.com> Message-ID: <200709021119.26265.sven.panne@aedion.de> On Sunday 02 September 2007 03:29, Hugh Perkins wrote: > A really simple way to track the "quality" of a package is to display > the number of downloads. > > A posteriorae, this works great in other download sites. > > We can easily hypothesize about why a download count gives a decent > indication of some measure of quality: [...] ... and even more easily hypothesize why this is not always a good indication: High-qualitiy standard libraries which are packaged with GHC/Hugs/... will probably almost never be downloaded separately. Cheers, S. From chaddai.fouche at gmail.com Sun Sep 2 05:23:36 2007 From: chaddai.fouche at gmail.com (=?ISO-8859-1?Q?Chadda=EF_Fouch=E9?=) Date: Sun Sep 2 05:14:13 2007 Subject: [Haskell-cafe] Extending the idea of a general Num to other types? In-Reply-To: <46DA537A.6070004@telenet.be> References: <46DA52EA.2040502@telenet.be> <46DA537A.6070004@telenet.be> Message-ID: 2007/9/2, Peter Verswyvelen : > Can the same be done on other builtin constructs? For example, if I have > [a], can this list be lifted to other types? I guess not, because no > type class exists for the list type? > You can indeed already do that, except it won't be a single instance since list have a bucketful of interesting properties. A good starting is looking at what list is an instance of and trying to identify the set of instance which interest us in this case, Foldable and Functor are probably a good start, embodying most of the interesting way to access a data structure as a list (head and tail don't really make sense for most of the alternatives, except other "sequence" library which currently provide this functionality in an ad-hoc way, see Sequence and ByteString for example of that). An alternative is Traversable. -- Jeda? From hughperkins at gmail.com Sun Sep 2 05:34:26 2007 From: hughperkins at gmail.com (Hugh Perkins) Date: Sun Sep 2 05:25:04 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <200709021119.26265.sven.panne@aedion.de> References: <1188691251.10322.198.camel@localhost> <837db430709011829p28f78ff9le32e5340360e7389@mail.gmail.com> <200709021119.26265.sven.panne@aedion.de> Message-ID: <837db430709020234v78522954md0a588a0ee91278a@mail.gmail.com> On 9/2/07, Sven Panne wrote: > High-qualitiy standard libraries which are packaged with GHC/Hugs/... will > probably almost never be downloaded separately. Good point. Note however that if someone is hunting for a library, it's generally because it's not already bundled with their default ghc install ;-) Sucks for hugs users I know ;-) From chaddai.fouche at gmail.com Sun Sep 2 05:55:23 2007 From: chaddai.fouche at gmail.com (=?ISO-8859-1?Q?Chadda=EF_Fouch=E9?=) Date: Sun Sep 2 05:46:00 2007 Subject: [Haskell-cafe] Looking for suggestions to improve my algorithm In-Reply-To: <3C5F61C3-F5D3-4A0F-99BE-138B174D58C7@gmail.com> References: <2f9b2d30708291639t57215541y6faa0a129d873fc6@mail.gmail.com> <3C5F61C3-F5D3-4A0F-99BE-138B174D58C7@gmail.com> Message-ID: Right, your program is 2 times faster than mine on my machine... I wonder if there is a better structure to do this bookkeeping than IntSet (maybe Sequence slightly remanied ?), anyway it goes to show how sometimes the bookkeeping can be more expensive than the operations it's meant to prevent ! As for my sumOfProperDivisors function it's dead simple, I would even say stupid (but it's faster than anything else I tried for now). An accumArray use the function you give it to update a cell, ok ? Here it's just (+) and all cells began their life as 1 since 1 is a proper divisors of all numbers (except 1, thus the (1,-1) for correctness). The following list just associate each proper divisor of a num with it, so the final value of a cell is the sum of those proper divisors. To achieve that we make factor take the value of all proper divisors possible for numbers from 1 to 1000000, in other words [2..1000000 `div` 2] (the `div` 2 is ok since we're speaking about proper divisors here), and then we go on to associate this divisor with all the numbers he divides properly, which are [factor * 2, factor * 3,...1000000]. Is it clear now ? -- Jeda? From bf3 at telenet.be Sun Sep 2 06:13:12 2007 From: bf3 at telenet.be (Peter Verswyvelen) Date: Sun Sep 2 06:03:57 2007 Subject: [Haskell-cafe] Extending the idea of a general Num to other types? In-Reply-To: References: <46DA52EA.2040502@telenet.be> <46DA537A.6070004@telenet.be> Message-ID: <46DA8CB8.8050607@telenet.be> Chadda? Fouch? wrote: > You can indeed already do that, except it won't be a single instance > since list have a bucketful of interesting properties. A good starting > is looking at what list is an instance of and trying to identify the > set of instance which interest us in this case, Foldable and Functor > are probably a good start, embodying most of the interesting way to > access a data structure as a list (head and tail don't really make > sense for most of the alternatives, except other "sequence" library > which currently provide this functionality in an ad-hoc way, see > Sequence and ByteString for example of that). > An alternative is Traversable. Thanks! But before digging into this, maybe I should rephrase myself by giving a more specific (although useless) example of what I mean. When I write: data Foo = Foo Int Int deriving (Show,Eq) instance Num Foo where fromInteger x = Foo x' x' where x' = fromInteger x _ + _ = error "Not relevant for example" _ * _ = error "Not relevant for example" abs _ = error "Not relevant for example" signum _ = error "Not relevant for example" x = 42::Foo I don't have to apply the Foo data constructor to lift the number 42 because I guess the compiler has builtin support for calling fromInteger (or fromRational). I even don't have to add the type annotation most of the time when the compiler can infer the type needed, which is very cool, sometimes a bit annoying. However, now I try the same for lists data Bar = Bar [Int] [Int] -- A List type class does not exist, so this cannot work instance List Bar where fromList x = Bar x x -- This does not work y = [1..10]::Bar So the only way to do this, is to create a constructor function like bar x = Bar x x which means the usage of lists in Haskell is not as general as numbers, in the sense one cannot take advantage of the builtin syntactic sugar of lists like [x,y,z] := x : (y : (z : [])) So if I would like to use this compact notation for e.g. creating a Set datatype, I would have to create special constructor functions (fromList or mkSet or whatever) Is this correct? If so, I'm sure a good reason must exist for this :) Thanks, Peter From prionic at gmx.de Sun Sep 2 06:53:01 2007 From: prionic at gmx.de (=?ISO-8859-1?Q?Martin_L=FCtke?=) Date: Sun Sep 2 06:39:53 2007 Subject: [Haskell-cafe] Re: HApps API Documentation? In-Reply-To: <46DA57F0.7090505@neurogami.com> References: <46D9B462.5020106@neurogami.com> <46DA57F0.7090505@neurogami.com> Message-ID: <46DA960D.3010600@gmx.de> > > > Just compile your one version from the HAppS source. Use runghc > Setup.hs > > haddock. > > OK, I can give that a shot. > > I'm still curious about my original question, though. Are there > alternative online API docs for Happs? I am sorry I dont answer your question directly, but the last online api documentation I found was outdated anyway. I think it was one you mentioned. Someone ask Alex Jacobson? He is maintaining HAppS. I heard he wants to redesign certain aspects. Maybe he doesnt have time to update the older docs? HApps is a flagship of Haskell development, there should be people helping Alex especially with better tutorials and a nice and uptodate website... oh... well that could just be me. From allbery at ece.cmu.edu Sun Sep 2 06:52:36 2007 From: allbery at ece.cmu.edu (Brandon S. Allbery KF8NH) Date: Sun Sep 2 06:43:15 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <46DA5343.3020200@telenet.be> References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA4F34.1010202@telenet.be> <46DA5343.3020200@telenet.be> Message-ID: On Sep 2, 2007, at 2:08 , Peter Verswyvelen wrote: >> But after reading http://en.wikipedia.org/wiki/ >> Fifth_generation_computer, it seemed to me that Prolog was a dead >> language, having only pure theoretical purposes. Is this true? Tell that to the order pricing system I wrote in Prolog for a customer site in the early 90s. (Admittedly, I did eventually rewrite it in C.). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH From hughperkins at gmail.com Sun Sep 2 07:02:40 2007 From: hughperkins at gmail.com (Hugh Perkins) Date: Sun Sep 2 06:53:22 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: References: <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA4F34.1010202@telenet.be> <46DA5343.3020200@telenet.be> Message-ID: <837db430709020402y31b4d716y3dfac625ae398099@mail.gmail.com> On 9/2/07, Brandon S. Allbery KF8NH wrote: > in the early 90s I think I found the flaw in your argument ;-) From bf3 at telenet.be Sun Sep 2 07:10:40 2007 From: bf3 at telenet.be (Peter Verswyvelen) Date: Sun Sep 2 07:01:19 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <200709021119.26265.sven.panne@aedion.de> References: <1188691251.10322.198.camel@localhost> <837db430709011829p28f78ff9le32e5340360e7389@mail.gmail.com> <200709021119.26265.sven.panne@aedion.de> Message-ID: <46DA9A30.4050305@telenet.be> Sven Panne wrote: > ... and even more easily hypothesize why this is not always a good indication: > High-qualitiy standard libraries which are packaged with GHC/Hugs/... will > probably almost never be downloaded separately. > Solution: change GHC/Hugs so it submits usage counters of which libraries the user "imports" to a webservice, stored in a database ;-) Of course this is subject to the user accepting such a feedback, to protect it's privacy. Google does this all the time! From andrewcoppin at btinternet.com Sun Sep 2 07:23:32 2007 From: andrewcoppin at btinternet.com (Andrew Coppin) Date: Sun Sep 2 07:12:57 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> Message-ID: <46DA9D34.9010604@btinternet.com> > One of standard exercices in Prolog is the construction of the > meta-interpreter of Prolog in Prolog. While this is cheating, I recommend > it to you. It opens eyes. Ever tried implementing Haskell in Haskell? ;-) > Prolog strategies are straightforward, and I simply cannot understand the > comments of Andrew Coppin. Which arbitrary set of conclusions?? Which > patently obvious results not derivable?? Be kind, give some examples, > otherwise people may suspect that you are issuing vacuous statements... Read my whole message. What I was saying (in essence) is that Prolog seemed to be performing "impossible" feats of logical deduction - until I saw a unification algorithm implemented in Haskell, and then it all made sense. (They showed an example where you basically program in a list of who is related to who, and then the computer suddenly seems to be able to magically deduce arbitrary family relationships - without any code for doing this being defined. This seemed utterly far-out to me... I'm not used to computers begin able to "think" for themselves. I'm more used to having them blindly follow whatever broken sequence of commands you feed to them... And yet, given a set of facts, this Prolog interpreter seemed to be able to magically derive arbitrarily complex conclusions from them. Double-impossible! Until I learned how it's implemented...) Having said all that, I still don't "get" what the purpose of the "cut" operator is. I also failed to understand the Prolog syntax description. (What the heck is an "atom" when it's at home? I thought an atom is a unit composed of protons and electrons...) I can certainly see why Prolog would be very useful for certain types of problems. As it happens, not the kind of problems that usually interest me. ;-) From bf3 at telenet.be Sun Sep 2 07:52:56 2007 From: bf3 at telenet.be (Peter Verswyvelen) Date: Sun Sep 2 07:43:36 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <46DA9A30.4050305@telenet.be> References: <1188691251.10322.198.camel@localhost> <837db430709011829p28f78ff9le32e5340360e7389@mail.gmail.com> <200709021119.26265.sven.panne@aedion.de> <46DA9A30.4050305@telenet.be> Message-ID: <46DAA418.1070300@telenet.be> Sven Panne wrote: > ... and even more easily hypothesize why this is not always a good indication: > High-qualitiy standard libraries which are packaged with GHC/Hugs/... will probably almost never be downloaded separately. Solution: change GHC/Hugs so it submits (via a webservice, stored in a database) usage counters of which libraries the user "imports" ;-) Of course this is subject to the user accepting such a feedback, to protect its privacy. Google does this all the time... From semanticphilosopher at googlemail.com Sun Sep 2 08:26:43 2007 From: semanticphilosopher at googlemail.com (Neil Davies) Date: Sun Sep 2 08:17:21 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <46DA9D34.9010604@btinternet.com> References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> Message-ID: <37c497340709020526vd72fef4if8d27eba86cbaddf@mail.gmail.com> Cut is a means of preventing backtracking beyond that point - it prunes the potential search space saying the answer must be built on the current set of bindings. (Lots of work went into how automatically get "cut's" into programs to make them efficient but without the programmer having to worry about them). Atoms: think unique symbols that are elements in the set which is the program's universe of discourse - one that is closed (no infinities there please). All its doing is unifying things to see if they fit the rules. It is one large parser that gives you back the bindings it made on the way. I do remember the day when a prologue researcher was fiercely defending that prologue could compute solutions to problems that were not achievable with "ordinary turing complete languages" - nothing as ugly as a rampaging mob of Computer Scientists! I've even written (late 80's) a program in prologue that performed real-time subtitling for the deaf, which I'm told is still being used out there..... Would I use it now? - never - it may give you an answer but rarely does using it give you understanding and you can always code up the searching algorithms if you have to go that brute force. And in the end it is the understanding that is reusable, not the answer. Neil On 02/09/07, Andrew Coppin wrote: > > > One of standard exercices in Prolog is the construction of the > > meta-interpreter of Prolog in Prolog. While this is cheating, I recommend > > it to you. It opens eyes. > > Ever tried implementing Haskell in Haskell? ;-) > > > Prolog strategies are straightforward, and I simply cannot understand the > > comments of Andrew Coppin. Which arbitrary set of conclusions?? Which > > patently obvious results not derivable?? Be kind, give some examples, > > otherwise people may suspect that you are issuing vacuous statements... > > Read my whole message. What I was saying (in essence) is that Prolog > seemed to be performing "impossible" feats of logical deduction - until > I saw a unification algorithm implemented in Haskell, and then it all > made sense. > > (They showed an example where you basically program in a list of who is > related to who, and then the computer suddenly seems to be able to > magically deduce arbitrary family relationships - without any code for > doing this being defined. This seemed utterly far-out to me... I'm not > used to computers begin able to "think" for themselves. I'm more used to > having them blindly follow whatever broken sequence of commands you feed > to them... And yet, given a set of facts, this Prolog interpreter seemed > to be able to magically derive arbitrarily complex conclusions from > them. Double-impossible! Until I learned how it's implemented...) > > Having said all that, I still don't "get" what the purpose of the "cut" > operator is. I also failed to understand the Prolog syntax description. > (What the heck is an "atom" when it's at home? I thought an atom is a > unit composed of protons and electrons...) > > I can certainly see why Prolog would be very useful for certain types of > problems. As it happens, not the kind of problems that usually interest > me. ;-) > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From jerzy.karczmarczuk at info.unicaen.fr Sun Sep 2 08:51:41 2007 From: jerzy.karczmarczuk at info.unicaen.fr (jerzy.karczmarczuk@info.unicaen.fr) Date: Sun Sep 2 08:41:39 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <46DA9D34.9010604@btinternet.com> References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> Message-ID: Andrew Coppin writes: > Ever tried implementing Haskell in Haskell? ;-) Seriously: Haskell is a *complicated* language, needing a parser, which by itself is a non-trivial exercice. Moreover, it has a type-inference engine, which may be simulated, sure, but Haskell in Haskell is a tough job. However, typing Haskell in Haskell is doable, see: http://citeseer.ist.psu.edu/424440.html The point is that Mark Jones is a well known Haskell guru, the creator of Gofer/Hugs, not an average student... Lisp/Scheme in Scheme is simpler, and is also a pretty standard exercice. Prolog is also from this perspective, very simple. Terms and clauses have the same syntax, the "program", i.e., the database of assertions can be dynamically extended, etc. A real fun. >> Prolog strategies are straightforward, and I simply cannot understand the >> comments of Andrew Coppin. Which arbitrary set of conclusions?? Which >> patently obvious results not derivable?? Be kind, give some examples, >> otherwise people may suspect that you are issuing vacuous statements... > > Read my whole message. What I was saying (in essence) is that Prolog > seemed to be performing "impossible" feats of logical deduction - until I > saw a unification algorithm implemented in Haskell, and then it all made > sense. > > (They showed an example where you basically program in a list of who is > related to who, and then the computer suddenly seems to be able to > magically deduce arbitrary family relationships - without any code for > doing this being defined. This seemed utterly far-out to me... I'm not > used to computers begin able to "think" for themselves. I'm more used to > having them blindly follow whatever broken sequence of commands you feed > to them... And yet, given a set of facts, this Prolog interpreter seemed > to be able to magically derive arbitrarily complex conclusions from them. > Double-impossible! Until I learned how it's implemented...) My deepest congratulations. It seems that you are the first person in my pedagogical life, who got acquainted with the unification through its implementation in Haskell. Gosh, why I gave to my students the assignment to construct an unifier in a functional language, when I was absolutely sure that they understood well the unification itself?... Actually, perhaps if you tried to do it otherwise, you *would* recognize that programs in Prolog do not "think", but just constitute a database of clauses/terms, which undergo a sufficiently powerful pattern-matching. It is the only "intelligence" inside, helped by the logic protocol, different from the functional one, which ensures that a predicate in Prolog may treat *all* its parameters either as input or an output, while in Haskell this is fixed. > Having said all that, I still don't "get" what the purpose of the "cut" > operator is. Imagine that your life is a path through a tree. Depth first. At every branching you choose a branch, and you continue. When you are stuck, you remember that you have left a trail behind you, and you backtrack until the last choice point. Then you choose another path, the previous being marked as 'seen'. Well, the cut is a commitment. You cut your way back, Now, you must succeed, i.e., find a terminal node which gives you what you want, or your failure is definitive, you jump out of the system. There are hundreds of easy examples of cuts, e.g., when descending the tree consumes the ressources which cannot be restored. The cut is criticized sometimes as something "not logical", a pragmatic device. OK. > I also failed to understand the Prolog syntax description. > (What the heck is an "atom" when it's at home? I thought an atom is a unit > composed of protons and electrons...) Now, you are pulling my leg. An "atom" means that you cannot split it in constituents, this name came from Lisp into other languages, but the meaning comes from Democritus, who didn't know protons. I won't say more, just that if you want to be really funny, you should not forget neutrons. http://en.wikipedia.org/wiki/Atom also: http://en.wikipedia.org/wiki/Atom_%28standard%29 http://en.wikipedia.org/wiki/Prolog also: http://en.wikipedia.org/wiki/Democritus > I can certainly see why Prolog would be very useful for certain types of > problems. As it happens, not the kind of problems that usually interest > me. ;-) Well, who am I or other readers to contradict it?... My point was that learning more than one language (and moreover, not so well) gives you a better perspective to learn the ESSENCE. Let's terminate by two citations from Democritus, who invented atoms: # "Nature and instruction are similar; for instruction transforms the man."(DK 68 B 33) # "If any man listens to my opinions, here recorded, with intelligence, he will achieve many things worthy of a good man, and avoid doing many unworthy things.(DK 68 B 35) ============== Jerzy Karczmarczuk From chaddai.fouche at gmail.com Sun Sep 2 09:24:50 2007 From: chaddai.fouche at gmail.com (=?ISO-8859-1?Q?Chadda=EF_Fouch=E9?=) Date: Sun Sep 2 09:15:28 2007 Subject: [Haskell-cafe] Array.Diff, strange oversight or myopia ? Message-ID: Data.Array.Diff don't have an instance for DiffUArray Bool, which is strange by itself since IOUArray Bool exists and it's the only IOUArray that is not mirrored in Diff. But ok, why not, I guess it might be a small oversight, so I go on to create the missing instance IArray (IOToDiffArray IOUArray) Bool on the model of the instances in the source of Array.Diff. Ok, Diff exports readDiffArray, newDiffArray and replaceDiffArray for this exact purpose, seems it will be straightforward... except that boundsDiffArray is not exported and you can't rewrite it since it needs to take apart the DiffArrayData type which is not exported either ! So how can I do this (short of copying and renaming an alternative Array.Diff or changing the library in my installation of GHC) ? And is there something obvious I missed due to a sudden case of myopia ? -- Jeda? From william.wood3 at comcast.net Sun Sep 2 09:24:23 2007 From: william.wood3 at comcast.net (Bill Wood) Date: Sun Sep 2 09:17:15 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> Message-ID: <1188739463.2061.17.camel@localhost> As to whether Prolog is "dead" or not, it depends on your definition of "dead". Three years ago (not ten!) I made my living maintaining and developing a large application written in Prolog. That was actually an interesting experience, since one of the performance drivers was speed. As a result code was being perpetually tuned toward less non-determinism. You know what the limit is? Functional programming! At the time I did a little research looking for an FP language that was "ready for prime time" and for which the pain of the move for a large organization would have been acceptably low. Sadly, nothing came of it. I still think the application could have been profitably ported to a functional language. Recently I have been experimenting with ECLiPSe, a Constraint Logic Programming system embedded within standard Prolog. I found several of the problems in the Euler Project were perfect candidates for attack by constraint programming. Yes, I could have written solutions that implemented some sort of search strategy, but there is a legitimate question of leverage. For example, Sudoku puzzles are very naturally viewed as constraint programming problems. But why should I write my own solution when the Sudoku solver provided as a demo could solve 50 problems in 0.10 seconds! By the way, I could get a fairly good idea of the "how and why" of the problem nd its solution from the form of the demo code, and oh yes I had already written my own Sudoku solver on OCaml a year or so ago. To Jerzy's point -- I strongly believe that learning a language like Prolog is a good idea for two reasons -- first, it adds another tool to the programmer's toolkit, and second, it enlarges the programmer's view of ways to think about solving problems. -- Bill Wood From bos at serpentine.com Sun Sep 2 09:37:07 2007 From: bos at serpentine.com (Bryan O'Sullivan) Date: Sun Sep 2 09:29:32 2007 Subject: [Haskell-cafe] interaction between OS processes In-Reply-To: <20070902065115.GQ16235@laptop.nowhere.net> References: <20070830101428.GI16235@laptop.nowhere.net> <46DA0DFE.5080807@vex.net> <20070902065115.GQ16235@laptop.nowhere.net> Message-ID: <46DABC83.3050808@serpentine.com> Andrea Rossato wrote: >> Most likely, the content of s sits in a local buffer and never leaves this >> process, following most OS conventions and as others point out. Another >> process waiting for it will deadlock. > Yes, I knew it was something related to the underneath OS. I'll have > to study Unix seriously.... Your problem may be buffering-related (I haven't read your code to check), but if so, there's a fair likelihood that it has nothing to do with the OS. GHC's runtime does its own buffer management on Handles. It's quite possible that your deadlock lies at that level, rather than anything lower. Are you calling hFlush after writing to your pipe? References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> Message-ID: <46DAC1BF.104@btinternet.com> jerzy.karczmarczuk@info.unicaen.fr wrote: > Andrew Coppin writes: >> Ever tried implementing Haskell in Haskell? ;-) > > Seriously: > Haskell is a *complicated* language, needing a parser, which by itself is > a non-trivial exercice. It looks so simple on the surface... [Actually, so does cold fusion.] >> Read my whole message. What I was saying (in essence) is that Prolog >> seemed to be performing "impossible" feats of logical deduction - >> until I saw a unification algorithm implemented in Haskell, and then >> it all made sense. > > My deepest congratulations. It seems that you are the first person in my > pedagogical life, who got acquainted with the unification through its > implementation in Haskell. Heh. Well. It took a *long* time, mind you... (BTW, that's a really rather good book, that.) >> Having said all that, I still don't "get" what the purpose of the >> "cut" operator is. > > Imagine that your life is a path through a tree. Depth first. At every > branching you choose a branch, and you continue. When you are stuck, you > remember that you have left a trail behind you, and you backtrack until > the last choice point. Then you choose another path, the previous being > marked as 'seen'. > Well, the cut is a commitment. You cut your way back, Now, you must > succeed, > i.e., find a terminal node which gives you what you want, or your failure > is definitive, you jump out of the system. There are hundreds of easy > examples of cuts, e.g., when descending the tree consumes the ressources > which cannot be restored. So... it's the opposite of Parsec's "try" combinator? >> I also failed to understand the Prolog syntax description. (What the >> heck is an "atom" when it's at home? I thought an atom is a unit >> composed of protons and electrons...) > > Now, you are pulling my leg. An "atom" means that you cannot split it in > constituents, this name came from Lisp into other languages, but the > meaning comes from Democritus, who didn't know protons. I won't say > more, just that > if you want to be really funny, you should not forget neutrons. Well, true. But they're so neutral! They don't even affect the chemical properties of the atom, only its physical ones. ;-) [Actually, I'm told this isn't *quite* true. For example, heavy water is mildly toxic due to the atom radius being slightly different or something which means that some enzyme somewhere doesn't quite work properly any more, or similar...] But anyway, I usually find that language syntax descriptions are written for maximum crypticness... This is presumably to enhance the idea that only extremely intelligent people can understand it or something. >> I can certainly see why Prolog would be very useful for certain types >> of problems. As it happens, not the kind of problems that usually >> interest me. ;-) > > Well, who am I or other readers to contradict it?... > My point was that learning more than one language Do you have Any Idea how many programming languages I've learned and used in my life so far? (Hint: lots.) ;-) [Hell, I was bored one day so I learned PostScript in my lunch break... Most normal people don't do that.] From mailing_list at istitutocolli.org Sun Sep 2 10:09:11 2007 From: mailing_list at istitutocolli.org (Andrea Rossato) Date: Sun Sep 2 10:00:25 2007 Subject: [Haskell-cafe] GHC-API: a few questions Message-ID: <20070902140911.GR16235@laptop.nowhere.net> Hi, I'm trying to acquire some confidence with the GHC-API and I'm having some problems, related to error handling, I seem not be able to solve. Basically there are 3 functions to (interactively) compile/run Haskell expressions: compileExpr, dyCompileExpr and runStmt. The first 2 will return the value of the compiled expression, as a Maybe HValue the first, and a Maybe Dynamic the second, while the third can bind names and report them, or report exceptions. But my problem is related to the first two. I run expressions (string_expression) wrapped around some let x = string_expression in take 2048 (show x) to avoid infinite list or loops. According to the documentation one should be able to control how error messages are dealt with, by manipulation the GHC session's state. One component of the session state, indeed, is the log_action which, by default, prints errors and warnings to the standard error (compiler/main/DynFlags.hs). Now, no matter what I do, I seem not to be able to change the log_action to collect error messages and warnings. In any case everything seem to be printed to standard error. This way I can only collect exceptions raised by the compiler. For instance: "Prelude.last: empty list" for string_expression = "last []" But if my expression raises a type error, this is printed to stderr. Like in the case of string_expression = "last" which would produce a "No instance for (Show ([a] -> a))" What am I doing wrong? Thanks for your kind attentions. Andrea ps: there are quite a lot of other questions I'd like to ask about some programming techniques I've seen applied in GHC. For instance, sometime a list of actions is given as a string, to be compiled to a HValue which is written to a IORef. Running those actions is just a matter of reading the IORef (you can see this in compiler/ghci/InteractiveUIhs, when it comes to buffer management. For instance: flushInterpBuffers). I ask to myself: Why? Just to amaze the reader? ;-) From hughperkins at gmail.com Sun Sep 2 10:52:12 2007 From: hughperkins at gmail.com (Hugh Perkins) Date: Sun Sep 2 10:42:50 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <46DAC1BF.104@btinternet.com> References: <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> Message-ID: <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> Sooo.. what is the modern equivalent of Prolog? From jerzy.karczmarczuk at info.unicaen.fr Sun Sep 2 11:16:12 2007 From: jerzy.karczmarczuk at info.unicaen.fr (jerzy.karczmarczuk@info.unicaen.fr) Date: Sun Sep 2 11:06:09 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> References: <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> Message-ID: Hugh Perkins writes: > Sooo.. what is the modern equivalent of Prolog? Well, first, I wouldn't agree entirely that Prolog is "not modern". Anyway... If you want something wih more bells and whistles, modularity, coroutining, more security (less power, e.g. no program auto-modification), etc., - see Mercury. http://www.cs.mu.oz.au/research/mercury/information/features.html http://en.wikipedia.org/wiki/Mercury_(programming_language) http://www.cs.kuleuven.ac.be/~dtai/projects/ALP/newsletter/archive_93_96/net /systems/mercury1.html and also: http://lambda-the-ultimate.org/node/890 Perhaps somebody can say more about constraint languages which replaced Prolog in some contexts as well. Have fun. Jerzy Karczmarczuk From lennart at augustsson.net Sun Sep 2 12:16:42 2007 From: lennart at augustsson.net (Lennart Augustsson) Date: Sun Sep 2 12:07:18 2007 Subject: [Haskell-cafe] Extending the idea of a general Num to other types? In-Reply-To: <46DA8CB8.8050607@telenet.be> References: <46DA52EA.2040502@telenet.be> <46DA537A.6070004@telenet.be> <46DA8CB8.8050607@telenet.be> Message-ID: You're right. The list syntax is only for lists in Haskell. It would be nice if the list syntax was overloaded too. You can overload numeric literals (by defining fromInteger) and string literals (by defining fromString, in 6.7). BTW, the [1..10] syntax is overloaded, you need an Enum instance. -- Lennart On 9/2/07, Peter Verswyvelen wrote: > > Chadda? Fouch? wrote: > > You can indeed already do that, except it won't be a single instance > > since list have a bucketful of interesting properties. A good starting > > is looking at what list is an instance of and trying to identify the > > set of instance which interest us in this case, Foldable and Functor > > are probably a good start, embodying most of the interesting way to > > access a data structure as a list (head and tail don't really make > > sense for most of the alternatives, except other "sequence" library > > which currently provide this functionality in an ad-hoc way, see > > Sequence and ByteString for example of that). > > An alternative is Traversable. > Thanks! > > But before digging into this, maybe I should rephrase myself by giving a > more specific (although useless) example of what I mean. > > When I write: > > data Foo = Foo Int Int deriving (Show,Eq) > > instance Num Foo where > fromInteger x = Foo x' x' where x' = fromInteger x > _ + _ = error "Not relevant for example" > _ * _ = error "Not relevant for example" > abs _ = error "Not relevant for example" > signum _ = error "Not relevant for example" > > x = 42::Foo > > I don't have to apply the Foo data constructor to lift the number 42 > because I guess the compiler has builtin support for calling fromInteger > (or fromRational). I even don't have to add the type annotation most of > the time when the compiler can infer the type needed, which is very > cool, sometimes a bit annoying. > > However, now I try the same for lists > > data Bar = Bar [Int] [Int] > > -- A List type class does not exist, so this cannot work > instance List Bar where > fromList x = Bar x x > > -- This does not work > y = [1..10]::Bar > > So the only way to do this, is to create a constructor function like > > bar x = Bar x x > > which means the usage of lists in Haskell is not as general as numbers, > in the sense one cannot take advantage of the builtin syntactic sugar of > lists like > > [x,y,z] := x : (y : (z : [])) > > So if I would like to use this compact notation for e.g. creating a Set > datatype, I would have to create special constructor functions (fromList > or mkSet or whatever) > > Is this correct? If so, I'm sure a good reason must exist for this :) > > Thanks, > Peter > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070902/2f886e65/attachment.htm From sven.panne at aedion.de Sun Sep 2 12:20:09 2007 From: sven.panne at aedion.de (Sven Panne) Date: Sun Sep 2 12:10:47 2007 Subject: [Haskell-cafe] Ideas In-Reply-To: <46D079B4.9040700@btinternet.com> References: <46D01785.7070503@btinternet.com> <46D079B4.9040700@btinternet.com> Message-ID: <200709021820.10101.sven.panne@aedion.de> On Saturday 25 August 2007 20:49, Andrew Coppin wrote: > [...] Would be nice if I could build something in Haskell that overcomes > these. OTOH, does Haskell have any way to talk to the audio hardware? Depending on what you are exactly trying to do, the OpenAL/ALUT packages might be of interest. Slighty dated online docs are here: http://haskell.org/HOpenGL/newAPI/OpenAL/Sound-OpenAL.html http://haskell.org/HOpenGL/newAPI/ALUT/Sound-ALUT.html Cheers, S. From mailing_list at istitutocolli.org Sun Sep 2 12:22:15 2007 From: mailing_list at istitutocolli.org (Andrea Rossato) Date: Sun Sep 2 12:14:30 2007 Subject: [Haskell-cafe] GHC-API: a few questions In-Reply-To: <20070902140911.GR16235@laptop.nowhere.net> References: <20070902140911.GR16235@laptop.nowhere.net> Message-ID: <20070902162215.GS16235@laptop.nowhere.net> On Sun, Sep 02, 2007 at 04:09:11PM +0200, Andrea Rossato wrote: > Hi, > > I'm trying to acquire some confidence with the GHC-API and I'm having > some problems, related to error handling, I seem not be able to solve. It's always like this: you finally give up, ask for help in the haskell-cafe, go for a walk with your dog and then the glimpse. Now you know what you were doing wrong. In my case I did some confusion when reading the documentation: I thought that newSession was using the dynamic flag set with defaultErrorHandler. That is to say, I thought I should control the log_action with defaultErrorHandler, instead you must: ses <- newSession Interactive (Just ghcPath) df <- getSessionDynFlags ses setSessionDynFlags ses df {log_action = myLog } -- set here your stuff!! ... The wiki was reporting this correctly, but I was misguided when reading this blog entry: http://austin.youareinferior.net/?q=node/29 which, nonetheless, is very helpful (the post is not incorrect by itself. It was me who misunderstood it). Sorry for the noise. BTW, play with the GHC-API is a *great* fun. Thanks for your kind attention. Andrea From hthiel.char at zonnet.nl Sun Sep 2 13:33:02 2007 From: hthiel.char at zonnet.nl (Hans van Thiel) Date: Sun Sep 2 13:23:03 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <1188739463.2061.17.camel@localhost> References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <1188739463.2061.17.camel@localhost> Message-ID: <1188754382.4311.14.camel@localhost.localdomain> On Sun, 2007-09-02 at 08:24 -0500, Bill Wood wrote: > As to whether Prolog is "dead" or not, it depends on your definition of > "dead". Three years ago (not ten!) I made my living maintaining and > developing a large application written in Prolog. That was actually an > interesting experience, since one of the performance drivers was speed. > As a result code was being perpetually tuned toward less > non-determinism. I've been following the discussion with interest, and I wonder what heppened to G?del, which promised to be a successor of Prolog. See the link for features, but http://www.cs.bris.ac.uk/~bowers/goedel.html was last updated in 1995. Does anybody know more? Hans van Thiel [snip] > > To Jerzy's point -- I strongly believe that learning a language like > Prolog is a good idea for two reasons -- first, it adds another tool to > the programmer's toolkit, and second, it enlarges the programmer's view > of ways to think about solving problems. > > -- Bill Wood > > > From wavexx at users.sf.net Sun Sep 2 13:45:54 2007 From: wavexx at users.sf.net (Yuri D'Elia) Date: Sun Sep 2 13:40:47 2007 Subject: [Haskell-cafe] Haskell as an extension language Message-ID: Hello everyone; I've been using haskell for quite some time now, but, as usual, I still find myself resorting to c code too much often due to the performance penalty introduced. FFI is all nice and dandy, yet, the need to compile the code and separate the implementation in two is a mayor development issue I'd like to eliminate along with batch compilation. In the way I like to work, I only use the interpreter (I mainly started with this approach with ocaml); just program interactively; close the whole session and pretend to resume the work next time I reopen the interpreter. Unfortunately, the interpreted performance is, many times, not sufficient for my purposes. In the past I've been coding several programs that would allow the user to extend the functionality at runtime through real c code. The "host" program itself could start an internal editor that accepted c code. The code would then be sent to the system compiler, generating a dynamic object that would be loaded in the current program (and executed) immediately. With some voodoo usage of "unexelf", I could create a simple runtime environment with very good performance (except for the initial compilation delay), interactivity and persistence, but, as you might expect, almost no resilience to errors and difficult debugging issues. I would like to resume this idea. Programming the core (minimal) application in c and then adding an extension mechanism always led to better and faster programs in my experience than trying to use directly an higher-level language and (ab)use the various forms of FFI. UI latency was one of the primary reasons in many cases. The amount of c code needed was always lower too, in the end, as the code was extended beyond the original minimal requirements. The extensions, being wrapped around the core data structures, tended to be more specialized and concise than general all-purpose libraries. Has anyone experienced similar situations? Is there some documentation about integrating an haskell interpreter in host programs that would allow session persistence and some minimal form of debugging? Which interpreter works better in this context? Thanks From trebla at vex.net Sun Sep 2 13:56:44 2007 From: trebla at vex.net (Albert Y. C. Lai) Date: Sun Sep 2 13:47:25 2007 Subject: [Haskell-cafe] interaction between OS processes In-Reply-To: <46DABC83.3050808@serpentine.com> References: <20070830101428.GI16235@laptop.nowhere.net> <46DA0DFE.5080807@vex.net> <20070902065115.GQ16235@laptop.nowhere.net> <46DABC83.3050808@serpentine.com> Message-ID: <46DAF95C.5030907@vex.net> Bryan O'Sullivan wrote: > Your problem may be buffering-related (I haven't read your code to > check), but if so, there's a fair likelihood that it has nothing to do > with the OS. GHC's runtime does its own buffer management on Handles. > It's quite possible that your deadlock lies at that level, rather than > anything lower. Although GHC's runtime kind of re-invents buffering, it still follows the Unix convention, i.e., if stdio is determined to be attached to a tty, then default to line buffering, else default to block buffering. Indeed, I wager that it bothers to re-invent buffering because of some other technical necessity (green-threading comes to mind), and if it goes out of its way to re-invent buffering, why, of all conceivable conventions, the Unix convention again? E.g., why not take this opportunity to spare beginners a nasty surprise and default to line buffering across the board? It seems to me clearly that the answer is precisely to spare the Unix-informed programmers a nasty surprise. Therefore although GHC's runtime does its own buffering, a Unix education still informs you of what it does. The problem is the same and the solution is the same. Even taking a step back, even if GHC or some other Haskell runtimes or some other language runtimes or even other VMs and OSes do not follow the Unix convention, a Unix course still serves to alert you of buffering issues, that buffering can be weird, that the OS does its weird buffering, that a language runtime may or may not add yet its weird buffering... You will develop a habit of double-checking with the docs and testing, not a habit of just assuming that what you see on a tty is what you get on a pipeline. Along the way, you will also see why getChar waits for a newline (and why sometimes even a newline doesn't suffice)... It is similar to saying, if you use a high-level language on x86, you don't have to learn low-level 680x0. Ah, but knowing low-level 680x0 informs you of certain issues of the high-level language (e.g., performance) and how to use it more successfully. This is despite 680x0 is not the x86 you use. It is similar to saying, if you use Haskell, you don't have to learn dependent typing. Ah, but knowing dependent typing informs you of certain typing issues and how to use the Haskell type system more successfully. This is despite tutorials on dependent typing talk about Clean or Coq rather than the Haskell you use. It is similar to saying, if you use Java and C#, you don't have to learn Haskell. Ah, but knowing Haskell informs you of certain programming issues and how to use Java and C# more successfully. This is despite Haskell does not talk about objects. It is education and personal growth. It is not just vocational training. From trebla at vex.net Sun Sep 2 14:10:22 2007 From: trebla at vex.net (Albert Y. C. Lai) Date: Sun Sep 2 14:00:59 2007 Subject: [Haskell-cafe] interaction between OS processes In-Reply-To: <46DAF95C.5030907@vex.net> References: <20070830101428.GI16235@laptop.nowhere.net> <46DA0DFE.5080807@vex.net> <20070902065115.GQ16235@laptop.nowhere.net> <46DABC83.3050808@serpentine.com> <46DAF95C.5030907@vex.net> Message-ID: <46DAFC8E.3050902@vex.net> Albert Y. C. Lai wrote: > It is similar to saying, if you use Haskell, you don't have to learn > dependent typing. Ah, but knowing dependent typing informs you of > certain typing issues and how to use the Haskell type system more > successfully. This is despite tutorials on dependent typing talk about > Clean or Coq rather than the Haskell you use. s/Clean/Cayenne/ From alexander.vodomerov at gmail.com Sun Sep 2 14:32:40 2007 From: alexander.vodomerov at gmail.com (Alexander Vodomerov) Date: Sun Sep 2 14:25:59 2007 Subject: [Haskell-cafe] GHC 6.6.1 and SELinux issues In-Reply-To: <20070829200356.GA3688@localhost.localdomain> References: <20070828091443.GA21275@isil.ipib.msu.ru> <1188309902.3165.7.camel@vision.buscaluz.org> <20070828205944.GA6400@localhost.localdomain> <1188355985.3156.11.camel@vision.buscaluz.org> <20070829070114.GA5706@localhost.localdomain> <46D59398.8030208@serpentine.com> <20070829184041.GA9231@localhost.localdomain> <20070829200356.GA3688@localhost.localdomain> Message-ID: <20070902183239.GA21713@localhost.localdomain> On Wed, Aug 29, 2007 at 01:03:56PM -0700, Stefan O'Rear wrote: > > So it is not clear if GHC does really need this PROT_EXEC. Can someone > > familiar with GHC internals answer why PROT_EXEC is used in getMBlocks? > > It's not possible to correctly implement 'foreign import ccall > "wrapper"' without self-modifying code on any mainstream computer > architecture. Does this program work on your no-PROT_EXEC ghc? : > > {-# OPTIONS_GHC -ffi #-} > import Foreign > > foreign import ccall "wrapper" wrap :: IO () -> IO (FunPtr (IO ())) > foreign import ccall "dynamic" call :: FunPtr (IO ()) -> IO () > > main = call =<< wrap (print "hi!") Thanks, that is exactly what I asked for. This program compiles with my no-PROT_EXEC ghc, but doesn't work: $ ghc -o 1 1.hs $ ./1 1: internal error: makeExecutable: failed to protect 0x0x2b115597e000 (GHC version 6.6.1 for x86_64_unknown_linux) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug Aborted $ The errors comes from rts/posix/OSMem.c, function setExecutable which tries to mprotect block of memory with PROT_EXEC and PROT_WRITE. What is so special about wrapper and dynamic functions? I've never used Haskell FFI, but I've heavily used Python-C interface and Ocaml-C interface, calling both C from Ocaml and Ocaml from C and even Ocaml from Python via C and etc. It all worked fine without any runtime code generation or self-modifying code. Can you please give some ideas how self-modifying code can be used in FFI implementation? With best regards, Alexander. From ahey at iee.org Sun Sep 2 14:57:18 2007 From: ahey at iee.org (Adrian Hey) Date: Sun Sep 2 14:50:43 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <837db430709011829p28f78ff9le32e5340360e7389@mail.gmail.com> References: <1185903596.5989.46.camel@localhost> <200709011847.16725.sven.panne@aedion.de> <1188691251.10322.198.camel@localhost> <837db430709011829p28f78ff9le32e5340360e7389@mail.gmail.com> Message-ID: <46DB078E.5050501@iee.org> Hugh Perkins wrote: > A really simple way to track the "quality" of a package is to display > the number of downloads. > > A posteriorae, this works great in other download sites. > > We can easily hypothesize about why a download count gives a decent > indication of some measure of quality: > - more people downloading it means more people specifically wanted that package > - more people downloading it means more people trying it, giving > feedback, maybe giving patches > - and, of course, it's an objective measure, easy to do I don't agree. The idea that any arbitrary "objective" measure provides any indication quality seems quite wrong to me, especially this one. The problem is the effect of positive feedback. The popularity of MS Winders or Office Suite are the obvious examples. We all know why these are used on 95% or whatever of the worlds PCs, and it has nothing whatever to do with quality. Or a little closer to home, the popularity of Haskell vs. Clean. Other meaningless measures that have been suggested are the rate of patch submissions of the number of developers involved. I seem to remember someone recently suggesting that libraries that score highly in on this regard should be elevated to "blessed" status. I cynic like me could just as well regard this as an indication of the complete opposite, that the library was being developed by an uncoordinated troop of barely competent code monkeys desperately trying to produce something that works reliably by a process of trial and error :-) Personally the first things I tend to look at are things like the quality of documentation and the presence of of some kind of test suite. Both these are IMO opinion pretty reliable indications that the author(s) have actually devoted some time and effort into deciding what it is that the library aims to achieve and have designed a coherent API (and have made reasonable effort to ensure that it actually works). I tend lose interest pretty fast if even basic Haddock API documentation is either non-existant, or consists of nothing but type signatures, or that plus broken link to some ancient postscript paper. Regards -- Adrian Hey From bf3 at telenet.be Sun Sep 2 15:16:12 2007 From: bf3 at telenet.be (Peter Verswyvelen) Date: Sun Sep 2 15:07:03 2007 Subject: [Haskell-cafe] Extending the idea of a general Num to other types? In-Reply-To: References: <46DA52EA.2040502@telenet.be> <46DA537A.6070004@telenet.be> <46DA8CB8.8050607@telenet.be> Message-ID: <46DB0BFC.4030609@telenet.be> Snif, this is sad... :-( Oh well, maybe this gets improved in Haskell Prime ;-) Lennart Augustsson wrote: > You're right. The list syntax is only for lists in Haskell. It would > be nice if the list syntax was overloaded too. > You can overload numeric literals (by defining fromInteger) and string > literals (by defining fromString, in 6.7). > BTW, the [1..10] syntax is overloaded, you need an Enum instance. From bf3 at telenet.be Sun Sep 2 15:19:18 2007 From: bf3 at telenet.be (Peter Verswyvelen) Date: Sun Sep 2 15:09:54 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: References: <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> Message-ID: <46DB0CB6.4020800@telenet.be> Jerzy Karczmarczuk wrote > Perhaps somebody can say more about constraint languages which replaced Yes please! Of example, how correct is http://en.wikipedia.org/wiki/Constraint_programming? From chaddai.fouche at gmail.com Sun Sep 2 15:27:06 2007 From: chaddai.fouche at gmail.com (=?ISO-8859-1?Q?Chadda=EF_Fouch=E9?=) Date: Sun Sep 2 15:17:42 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <46DB078E.5050501@iee.org> References: <1185903596.5989.46.camel@localhost> <200709011847.16725.sven.panne@aedion.de> <1188691251.10322.198.camel@localhost> <837db430709011829p28f78ff9le32e5340360e7389@mail.gmail.com> <46DB078E.5050501@iee.org> Message-ID: 2007/9/2, Adrian Hey : > Other meaningless measures that have been suggested are the rate of > patch submissions of the number of developers involved. I seem to > remember someone recently suggesting that libraries that score highly > in on this regard should be elevated to "blessed" status. > I don't see them as completely meaningless, such a library is more likely to be corrected if you report a bug, and if a library lacks certain features but seems interesting, I'm less inclined to give it a chance if nobody worked on it for years than if there's an active community, frequent update and a roadmap. Still it's not sufficient, I agree with you. > Personally the first things I tend to look at are things like the > quality of documentation and the presence of of some kind of test > suite. Both these are IMO opinion pretty reliable indications that > the author(s) have actually devoted some time and effort into > deciding what it is that the library aims to achieve and have > designed a coherent API (and have made reasonable effort to ensure > that it actually works). I tend lose interest pretty fast if even > basic Haddock API documentation is either non-existant, or consists > of nothing but type signatures, or that plus broken link to some > ancient postscript paper. > Yes, those are some of the more interesting metrics, the CPAN try to take them into account with the recent Kwalitee metric. Thing is we probably won't find _the best_ metric (if such a thing existed, I think it will already have been found) but we can try to give some useful indications. -- Jeda? From benjamin.franksen at bessy.de Sun Sep 2 19:05:15 2007 From: benjamin.franksen at bessy.de (Benjamin Franksen) Date: Sun Sep 2 18:56:17 2007 Subject: [Haskell-cafe] Re: Learn Prolog... References: <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> Message-ID: Hugh Perkins wrote: > Sooo.. what is the modern equivalent of Prolog? I once learned about LIFE (Logic, Inheritance, Functions, and Equations) and was deeply fascinated. However, it died the quick death of most research languages. Cheers Ben From hughperkins at gmail.com Sun Sep 2 19:25:06 2007 From: hughperkins at gmail.com (Hugh Perkins) Date: Sun Sep 2 19:15:43 2007 Subject: [Haskell-cafe] Haskell as an extension language In-Reply-To: References: Message-ID: <837db430709021625ye53068fo357f775324f465dc@mail.gmail.com> Off-topic, so stop reading now if you want ;-) , but reminds me of my experience using Python and C++. Python and C++ are both great languages, with their own strengths, and one might think that combining thing gets the best of both. However, using Swig etc to join Python to C++ takes a significant amount of time, and one needs project members now to learn two languages. Then I discovered a different language (not Haskell) that combined the ease of Python with the speed of C++. It's really a big advantage. From derek.a.elkins at gmail.com Sun Sep 2 19:25:06 2007 From: derek.a.elkins at gmail.com (Derek Elkins) Date: Sun Sep 2 19:18:38 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> References: <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> Message-ID: <1188775506.5450.5.camel@derek-laptop> On Sun, 2007-09-02 at 22:52 +0800, Hugh Perkins wrote: > Sooo.. what is the modern equivalent of Prolog? Because no one has said it quite this way: The modern equivalent of Prolog is Prolog. Most of the advancement in logic programming has either been folded back into Prolog or has been advanced within Prolog. There are, for example, constraint systems as add-ons to various Prolog implementations. The theory of logic programming, however, has massively advanced beyond Prolog producing languages much, much more beautiful than Prolog (not hard...). Unfortunately, they have not been made into practical languages, at least not successfully. I'm not aware of any real competitors to Prolog in the logic programming languages space. From hughperkins at gmail.com Sun Sep 2 19:28:16 2007 From: hughperkins at gmail.com (Hugh Perkins) Date: Sun Sep 2 19:18:52 2007 Subject: [Haskell-cafe] RE: Definition of the Haskell standard library In-Reply-To: <46DB078E.5050501@iee.org> References: <1185903596.5989.46.camel@localhost> <200709011847.16725.sven.panne@aedion.de> <1188691251.10322.198.camel@localhost> <837db430709011829p28f78ff9le32e5340360e7389@mail.gmail.com> <46DB078E.5050501@iee.org> Message-ID: <837db430709021628t474da115t3e3f32ac4f1695ab@mail.gmail.com> On 9/3/07, Adrian Hey wrote: > The popularity of MS > Winders or Office Suite are the obvious examples. We all know why these > are used on 95% or whatever of the worlds PCs, and it has nothing > whatever to do with quality. Oh come on. You've been reading waaayyy too much Slashdot... From hughperkins at gmail.com Sun Sep 2 19:43:49 2007 From: hughperkins at gmail.com (Hugh Perkins) Date: Sun Sep 2 19:34:25 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <1188775506.5450.5.camel@derek-laptop> References: <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> <1188775506.5450.5.camel@derek-laptop> Message-ID: <837db430709021643o13aad28m14fce20a61eff24a@mail.gmail.com> On 9/3/07, Derek Elkins wrote: > Because no one has said it quite this way: > The modern equivalent of Prolog is Prolog. Ok, thanks. Just wanted to check that. (btw, just thought, when I was talking about FFI, probably meant Forth, not Prolog. FFI for Prolog probably isnt that important.) From william.wood3 at comcast.net Sun Sep 2 20:14:25 2007 From: william.wood3 at comcast.net (Bill Wood) Date: Sun Sep 2 20:07:15 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <837db430709021643o13aad28m14fce20a61eff24a@mail.gmail.com> References: <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> <1188775506.5450.5.camel@derek-laptop> <837db430709021643o13aad28m14fce20a61eff24a@mail.gmail.com> Message-ID: <1188778465.26578.14.camel@localhost> On Mon, 2007-09-03 at 07:43 +0800, Hugh Perkins wrote: > On 9/3/07, Derek Elkins wrote: > > Because no one has said it quite this way: > > The modern equivalent of Prolog is Prolog. I was just about to say the same thing :-); thanks, Derek. . . . > (btw, just thought, when I was talking about FFI, probably meant > Forth, not Prolog. FFI for Prolog probably isnt that important.) No, Foreign Function Interfaces are as useful with Prolog as with any other high-level language. (BTW I thought the FFI for Forth was the Forth assembler; have things changed since FIG/F83?) I just did a fast scan and found that XSB and SWI Prolog seem to be still quite active. If you have a few bucks (or euros) sicstus is also available. I was quite satisfied with XSB, though my experience is somewhat dated now. It is somewhat idiosyncratic (they're talking about getting closer to ISO Prolog with their latest release). I have also had good results with SWI. Both of them support some CLP libraries. GNU Prolog is also out there, but I don't know how active development is (please, I said I don't know, not that I thought it was becoming moribund). I've used it a little. It also comes with something of a CLP library. It looks like you can get an individual license for sicstus for ca. 155 euros. I used it a lot about three years ago and it seemed to be quite stable, had good performance, and we received good support. Of course we were a big corporate customer. Prolog seems to be quite alive and kicking. From hughperkins at gmail.com Sun Sep 2 20:42:40 2007 From: hughperkins at gmail.com (Hugh Perkins) Date: Sun Sep 2 20:33:15 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <1188778465.26578.14.camel@localhost> References: <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> <1188775506.5450.5.camel@derek-laptop> <837db430709021643o13aad28m14fce20a61eff24a@mail.gmail.com> <1188778465.26578.14.camel@localhost> Message-ID: <837db430709021742l1236f224q13093171495ff57d@mail.gmail.com> > (BTW I thought the FFI for Forth was the Forth assembler; have things > changed since FIG/F83?) I didnt have a real PC, just a ZX Spectrum. It wasnt real Forth, just Spectrum Forth. It was kindof fun, but a little disappointing not to be able to do anything useful with it. Well, I wanted to write space invaders on it, but not being able to write characters to arbitrary points on the screen was a bit of a show-stopper for that ;-) From bertram.felgenhauer at googlemail.com Sun Sep 2 20:56:52 2007 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Sun Sep 2 20:47:32 2007 Subject: [Haskell-cafe] GHC 6.6.1 and SELinux issues In-Reply-To: <20070902183239.GA21713@localhost.localdomain> References: <20070828091443.GA21275@isil.ipib.msu.ru> <1188309902.3165.7.camel@vision.buscaluz.org> <20070828205944.GA6400@localhost.localdomain> <1188355985.3156.11.camel@vision.buscaluz.org> <20070829070114.GA5706@localhost.localdomain> <46D59398.8030208@serpentine.com> <20070829184041.GA9231@localhost.localdomain> <20070829200356.GA3688@localhost.localdomain> <20070902183239.GA21713@localhost.localdomain> Message-ID: <20070903005652.GA7444@zombie.inf.tu-dresden.de> Alexander Vodomerov wrote: > On Wed, Aug 29, 2007 at 01:03:56PM -0700, Stefan O'Rear wrote: [snip] > What is so special about wrapper and dynamic functions? > > Can you please give some ideas how self-modifying code can be used in > FFI implementation? It's not self-modifying code really, it's dynamically generated code. Here is a small complete example for illustration: >>> V.hs >>> import Foreign import Foreign.C foreign import ccall "wrapper" mkCallback :: (CInt -> CInt) -> IO (FunPtr (CInt -> CInt)) foreign import ccall "v.h foo" c_foo :: FunPtr (CInt -> CInt) -> IO CInt main = do add_21 <- mkCallback (+21) c_foo add_21 >>= print <<< >>> v.c >>> #include "v.h" int foo(callback_t fun) { return fun(fun(0)); } <<< >>> v.h >>> typedef int (* callback_t)(int); int foo(callback_t fun); <<< (compile with ghc -ffi V.hs v.c) This program takes a function that adds 21 to a CInt, wraps it into a C function pointer of type callback_t, and then calls this function from the C side two times; it prints 42. In particular, the wrapper mkCallback takes any *Haskell* function of type CInt -> CInt and returns a *C* function pointer that represents the same function. Note that this function receives no additional context in its arguments. This is convenient but it means that each call to mkCallback has to return a different function pointer, so it is necessary to generate a small piece of code dynamically to implement it. HTH, Bertram From hughperkins at gmail.com Sun Sep 2 21:29:04 2007 From: hughperkins at gmail.com (Hugh Perkins) Date: Sun Sep 2 21:19:39 2007 Subject: [Haskell-cafe] Re: Bi-directional Maps In-Reply-To: <46CB4BE9.50302@vex.net> References: <14cf844b0708201146w715809afs26f20b37ba09b852@mail.gmail.com> <837db430708210608m442fcb9s7dc0bfca05cd8b40@mail.gmail.com> <46CB4BE9.50302@vex.net> Message-ID: <837db430709021829g644a474dpc86336a4a054479c@mail.gmail.com> Just noticed, erlang has the second kind of bimap (a "bijection"?) built into each process: >From http://www.erlang.org/doc/reference_manual/processes.html : "10.9 Process Dictionary Each process has its own process dictionary, accessed by calling the following BIFs: put(Key, Value) get(Key) get() get_keys(Value) erase(Key) erase()" That's interesting. From scm at iis.sinica.edu.tw Mon Sep 3 00:18:34 2007 From: scm at iis.sinica.edu.tw (Shin-Cheng Mu) Date: Mon Sep 3 00:09:06 2007 Subject: [Haskell-cafe] APLAS07 - Call for Participation Message-ID: Call for Participation The Fifth Asian Symposium on Programming Languages and Systems November 29 - December 1, 2007 Singapore http://www.comp.nus.edu.sg/~aplas07/ http://flint.cs.yale.edu/aplas2007/ Scope of the Conference ----------------------- APLAS aims at stimulating programming language research by providing a forum for the presentation of recent results and the exchange of ideas and experience in topics concerned with programming languages and systems. APLAS is based in Asia, but is an international forum that serves the worldwide programming languages community. The APLAS series is sponsored by the Asian Association for Foundation of Software (AAFS), which has recently been founded by Asian researchers in cooperation with many researchers from Europe and the USA. The past formal APLAS symposiums were successfully held in Sydney (2006, Australia), Tsukuba (2005, Japan), Taipei (2004, Taiwan) and Beijing (2003, China) after three informal workshops held in Shanghai (2002, China), Daejeon (2001, Korea) and Singapore (2000). Proceedings of the past symposiums were published in Springer-Verlag's LNCS 2895, 3302, 3780, and 4279. Conference Location ------------------- APLAS'07 will be held at Kent Ridge Guild House, National University of Singapore. Singapore is a dynamic city rich in contrast and color where you'll find a harmonious blend of culture, cuisine, arts and architecture. A bridge between the East and the West for centuries, Singapore, located in the heart of fascinating Southeast Asia, continues to embrace tradition and modernity today. Brimming with unbridled energy and bursting with exciting events, the city offers countless unique, memorable experiences waiting to be discovered. Registration ------------ The early registration deadline is set on 28Sept07. The registration fees will cover conference proceeding, banquet dinner, and lunches/teas. Deadline Full Fees Student Fees early 28Sep07 S$600 S$400 online 23Nov07 S$650 S$425 on-site 29Nov07 S$700 S$450 Payment can be made with credit cards. Exchange rate (subject to fluctuation) is approx. US$1 = S$1.53 Online registration can be made at: http://www.comp.nus.edu.sg/~aplas07/local.html#registration Accommodation ------------- A special rate S$155 per nite (excluding taxes but inclusive of daily breakfast) is applicable to attendees of APLAS 2007 at Rendezvous Hotel Singapore: http://www.rendezvoushotels.com/singapore/ The hotel is located in city center. A free daily shuttle bus will be provided between this hotel and the conference site (at NUS) during the conference period. Our block of rooms is guaranteed till 28Sept07, so advanced booking is encouraged as some rooms may be released after this date. For reservation, please use a special form that can be found at: http://www.comp.nus.edu.sg/~aplas07/Hotel.APLAS07.pdf We have also reserved a limited number of cheaper twin/double shared rooms (S$280 for 4-nights) on NUS campus. Priority will be given to students and poster participants. Deadline for application is 20Sep07. Details will be given on our web in early Sept. Poster Session -------------- APLAS07 will include a poster session. Submission deadline is 14 Sept 2007. For details, please see: http://www.comp.nus.edu.sg/~aplas07/posters.html Conference Program ------------------ 29 Nov (Thu) ------------ 915- 930 Opening note 930-1030 Invited Talk X10: Programming Parallel Machines, Productively Vijay Saraswat (IBM TJ Watson Research Lab) 1100-1230 Session 1 The Nuggetizer: Abstracting Away Higher-Orderness for Program Verification Paritosh Shroff (Johns Hopkins University), Christian Skalka (University of Vermont) and Scott F. Smith (Johns Hopkins University) Local Reasoning for Storable Locks and Threads Alexey Gotsman (University of Cambridge), Josh Berdine (Microsoft Research), Byron Cook (Microsoft Research), Noam Rinetzky (Tel Aviv University) and Mooly Sagiv (Tel Aviv University) Monadic, Prompt Lazy Assertions in Haskell Frank Huch (CAU Kiel) and Olaf Chitil (University of Kent) 1345-1515 Session 2 Translation Correctness for First-Order Object-Oriented Pattern Matching Burak Emir (EPFL Lausanne), Qin Ma (OFFIS) and Martin Odersky (EPFL Lausanne) Persistent Oberon: A Programming Language with Integrated Persistence Luc Blaser (ETH Zurich) More Typed Assembly Languages for Confidentiality Dachuan Yu (DoCoMo Communication Laboratories USA) 1515-1630 Poster Session 1630-1730 Session 3 A Novel Test Case Generation Method for Prolog Programs Based on Call Patterns Semantics Lingzhong Zhao (Guilin University of Electronic Technology), Tianlong Gu (Guilin University of Electronic Technology), Junyan Qian (Guilin University of Electronic Technology) and Guoyong Cai (Guilin University of Electronic Technology) On a Tighter Integration of Functional and Logic Programming Frank Huch (CAU Kiel) and Bernd Brassel (CAU Kiel) 1800-2000 Reception 30 Nov (Fri) ------------ 930-1030 Invited Talk Scalable Simulation of Biological Signaling Networks Vincent Danos (University of Paris VII & CNRS) 1100-1230 Session 4 Timed, Distributed, Probabilistic, Typed Processes Martin Berger (Imperial College London) and Nobuko Yoshida (Imperial College London) A Probabilistic Applied Pi-Calculus Jean Goubault-Larrecq (ENS Cachan), Catuscia Palamidessi (Ecole Polytechnique) and Angelo Troina (ENS Cachan & Ecole Polytechnique) Type-Based Verification of Correspondence Assertions for Communication Protocols Daisuke Kikuchi (Tohoku University) and Naoki Kobayashi (Tohoku University) 1400-1530 Session 5 Deriving Compilers and Virtual Machines for a Multi-Level Language Atsushi Igarashi (Kyoto University) and Masashi Iwaki (Kyoto University) Finally Tagless, Partially Evaluated (Tagless Staged Interpreters for Simpler Typed Languages) Jacques Carette (McMaster University), Oleg Kiselyov (FNMOC) and Chung-chieh Shan (Rutgers University) Polymorphic Delimited Continuations Kenichi Asai (Ochanomizu University) and Yukiyoshi Kameyama (University of Tsukuba) 1600-1730 Session 6 Adjunct Elimination in Context Logic for Trees Cristiano Calcagno (Imperial College London), Thomas Dinsdale-Young (Imperial College London) and Philippa Gardner (Imperial College London) Positive Arithmetic without Exchange is a Subclassical Logic Stefano Berardi (University of Torino) and Makoto Tatsuta (National Institute of Informatics, Japan) Mixed Inductive/Coinductive Types and Strong Normalization Andreas Abel (University of Munich) 1900-2100 Banquet 1 Dec (Sat) ------------ 930-1030 Invited Talk Static and Dynamic Analysis : Better Together Sriram Rajamani (Microsoft Research India) 1100-1230 Session 7 The Semantics of "Semantic Patches" in Coccinelle: Program Transformation for the Working Programmer Neil Jones (University of Copenhagen) and Rene Rydhof Hansen (University of Copenhagen) An Efficient SSA-based Algorithm for Complete Global Value Numbering Jiu-Tao Nie (Peking University) and Xu Cheng (Peking University) A Systematic Approach to Probabilistic Pointer Analysis Alessandra Di Pierro (University of Verona), Chris Hankin (Imperial College London) and Herbert Wiklicky (Imperial College London) 1400-1530 Session 8 Complete Lattices and Up-to Techniques Damien Pous (ENS Lyon) A Trace Based Bisimulation for the Spi Calculus: An Extended Abstract Alwen Tiu (Australian National University) CCS with Replication in the Chomsky Hierarchy: The Expressive Power of Divergence Frank Valencia (Ecole Polytechnique), Cinzia Di Giusto (University of Bologna), Jesus Aranda (Ecole Polytechnique) and Mogens Nielsen (University of Aarhus) 1600-1700 Session 9 Call-by-Name and Call-by-Value in Normal Modal Logic Yoshihiko Kakutani (University of Tokyo) Call-by-Value is Dual to Call-by-Name, Extended Daisuke Kimura (National Institute of Informatics, Japan) 1700-1715 Closing note Organization ------------- GENERAL CHAIR Joxan Jaffar (National University of Singapore, Singapore) PROGRAM CHAIR Zhong Shao (Yale University, USA) PROGRAM COMMITTEE Lars Birkedal (IT University of Copenhagen, Denmark) Martin Hofmann (Univ of Munich, Germany) Kohei Honda (Queen Mary, University of London, UK) Atsushi Igarashi (Kyoto University, Japan) Suresh Jagannathan (Purdue University, USA) Annie Liu (State University of New York at Stony Brook, USA) Shin-Cheng Mu (Academia Sinica, Taiwan) Henrik Nilsson (University of Nottingham, UK) Michael Norrish (NICTA, Australia) Jens Palsberg (University of California, Los Angeles, USA) G. Ramalingam (Microsoft Research, India) Zhendong Su (University of California, Davis, USA) Martin Sulzmann (National University of Singapore, Singapore) Eijiro Sumii (Tohoku University, Japan) Jerome Vouillon (CNRS, France) Kwangkeun Yi (Seoul National University, Korea) Jian Zhang (Chinese Academy of Sciences, China) POSTER SESSION CHAIR Eijiro Sumii (Tohoku University, Japan) LOCAL ARRANGEMENT CHAIR Wei-Ngan Chin (National University of Singapore, Singapore) From wavexx at users.sf.net Mon Sep 3 02:42:32 2007 From: wavexx at users.sf.net (Yuri D'Elia) Date: Mon Sep 3 02:33:27 2007 Subject: [Haskell-cafe] Re: Haskell as an extension language References: <837db430709021625ye53068fo357f775324f465dc@mail.gmail.com> Message-ID: In article <837db430709021625ye53068fo357f775324f465dc@mail.gmail.com>, "Hugh Perkins" wrote: > However, using Swig etc to join Python to C++ takes a significant > amount of time, and one needs project members now to learn two > languages. That's a non-issue in my context. The first real problem is wasting time generating glue code. The second problem is interrupting the current work to correct the bindings, or the underlying code itself. The ability to correct, inspect and debug all the code at runtime without ever stopping almost outweighs the language capabilities or syntax. If elegance weren't an issue ;), I would solely use lisp, or maybe some scheme, or maybe even CINT. > Then I discovered a different language (not Haskell) that combined the > ease of Python with the speed of C++. It's really a big advantage. Is that something originally coming from digital mars? The list of languages that argue to have that target performance is quite long... ;) From amc4 at doc.ic.ac.uk Mon Sep 3 02:46:17 2007 From: amc4 at doc.ic.ac.uk (Andrew Cheadle) Date: Mon Sep 3 02:36:45 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <46DB0CB6.4020800@telenet.be> References: <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> <46DB0CB6.4020800@telenet.be> Message-ID: <46DBADB9.8050800@doc.ic.ac.uk> It's fairly correct and up-to-date although I note that the constraint example 'send more money' given is stated as 'Prolog' when it really uses ECLiPSe Prolog constraint syntax (alldifferent/1, labelling/1 and '#' integer constraints): If you're really interested in constraint based languages then have a look at ECLiPSe (yes shameless plug and I'm biased ;-): http://www.eclipse-clp.org and in particular the language tutorial: http://www.eclipse-clp.org/doc/tutorial/index.html ECLiPSe is robust and mature enough for industrial application development, most notably by Cisco and CrossCore Optimization. Incidentally, we've often seen a lot of traffic on here about Sudoku solvers and I've always wanted to post the ECLiPSe solution (neat when you consider the length of the sudoku/2 predicate ;-) : % ECLiPSe sample code - Sudoku problem % % This is a puzzle, originating from Japan, where you have a % 9x9 grid, consisting of 9 3x3 sub-grids. The challenge is % to fill the grid with numbers from 1 to 9 such that every row, % every column, and every 3x3 sub-grid contains the digits 1 to 9. % Some of these numbers are given, which is the way different % instances of the problem are made. The solution is usually unique. % % Compile this file with ECLiPSe and call e.g. % :- solve(1). % % Author: Joachim Schimpf, IC-Parc % :- lib(ic). :- import alldifferent/1 from ic_global. solve(ProblemName) :- problem(ProblemName, Board), print_board(Board), sudoku(3, Board), print_board(Board). sudoku(N, Board) :- N2 is N*N, dim(Board, [N2,N2]), Board[1..N2,1..N2] :: 1..N2, ( for(I,1,N2), param(Board,N2) do Row is Board[I,1..N2], alldifferent(Row), Col is Board[1..N2,I], alldifferent(Col) ), ( multifor([I,J],1,N2,N), param(Board,N) do ( multifor([K,L],0,N-1), param(Board,I,J), foreach(X,SubSquare) do X is Board[I+K,J+L] ), alldifferent(SubSquare) ), term_variables(Board, Vars), labeling(Vars). print_board(Board) :- dim(Board, [N,N]), ( for(I,1,N), param(Board,N) do ( for(J,1,N), param(Board,I) do X is Board[I,J], ( var(X) -> write(" _") ; printf(" %2d", [X]) ) ), nl ), nl. %---------------------------------------------------------------------- % Sample data %---------------------------------------------------------------------- problem(1, []( [](_, _, 2, _, _, 5, _, 7, 9), [](1, _, 5, _, _, 3, _, _, _), [](_, _, _, _, _, _, 6, _, _), [](_, 1, _, 4, _, _, 9, _, _), [](_, 9, _, _, _, _, _, 8, _), [](_, _, 4, _, _, 9, _, 1, _), [](_, _, 9, _, _, _, _, _, _), [](_, _, _, 1, _, _, 3, _, 6), [](6, 8, _, 3, _, _, 4, _, _))). Cheers Andy Peter Verswyvelen wrote: > Jerzy Karczmarczuk wrote > > Perhaps somebody can say more about constraint languages which replaced > > Yes please! Of example, how correct is > http://en.wikipedia.org/wiki/Constraint_programming? > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- ********************************************************************* * Andrew Cheadle email: a.cheadle@doc.ic.ac.uk * * Department of Computing http://www.doc.ic.ac.uk/~amc4/ * * Imperial College London * ********************************************************************* From ajb at spamcop.net Mon Sep 3 02:49:20 2007 From: ajb at spamcop.net (ajb@spamcop.net) Date: Mon Sep 3 02:39:55 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <1188739463.2061.17.camel@localhost> References: <46D6FB5C.7090103@btinternet.com> <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <1188739463.2061.17.camel@localhost> Message-ID: <20070903024920.v8f655zqgw480ww4@webmail.spamcop.net> G'day all. Quoting Bill Wood : > As to whether Prolog is "dead" or not, it depends on your definition of > "dead". Three years ago (not ten!) I made my living maintaining and > developing a large application written in Prolog. Back when I was doing logic programming, 10 or so years ago, we used to chuckle at papers which referred to analyses which claimed to be fast "even on large 1000-line programs". I'm sure this isn't the case for you, but a typical Prolog programmer's idea of "large" is very different from a typical COBOL programmer's. > As a result code was being perpetually tuned toward less > non-determinism. You know what the limit is? Functional programming! Did you look at Mercury? Cheers, Andrew Bromage From ajb at spamcop.net Mon Sep 3 02:51:42 2007 From: ajb at spamcop.net (ajb@spamcop.net) Date: Mon Sep 3 02:42:15 2007 Subject: [Haskell-cafe] Haskell as an extension language In-Reply-To: <837db430709021625ye53068fo357f775324f465dc@mail.gmail.com> References: <837db430709021625ye53068fo357f775324f465dc@mail.gmail.com> Message-ID: <20070903025142.0hwmpz9r8kkwww4o@webmail.spamcop.net> G'day all. Quoting Hugh Perkins : > However, using Swig etc to join Python to C++ takes a significant > amount of time, [...] Supposedly, Boost.Python is pretty good. > Then I discovered a different language (not Haskell) that combined the > ease of Python with the speed of C++. The suspense is killing me! Cheers, Andrew Bromage From william.wood3 at comcast.net Mon Sep 3 02:50:18 2007 From: william.wood3 at comcast.net (Bill Wood) Date: Mon Sep 3 02:43:08 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <46DBADB9.8050800@doc.ic.ac.uk> References: <625b74080708301041g76b2664dp59eec01057d16f00@mail.gmail.com> <46D73311.1070006@btinternet.com> <625b74080708301438ra50b898pac6c875c797f866a@mail.gmail.com> <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> <46DB0CB6.4020800@telenet.be> <46DBADB9.8050800@doc.ic.ac.uk> Message-ID: <1188802218.9098.2.camel@localhost> On Mon, 2007-09-03 at 07:46 +0100, Andrew Cheadle wrote: . . . > Incidentally, we've often seen a lot of traffic on here about Sudoku > solvers and I've always wanted to post the ECLiPSe solution > (neat when you consider the length of the sudoku/2 predicate ;-) : Reasonably quick, too -- 50 sudokus in ca. 0.1 sec. (I did a Project Euler problem that required solving 50 sudokus with ECLiPSe). -- Bill Wood From jerzy.karczmarczuk at info.unicaen.fr Mon Sep 3 03:12:49 2007 From: jerzy.karczmarczuk at info.unicaen.fr (jerzy.karczmarczuk@info.unicaen.fr) Date: Mon Sep 3 03:02:45 2007 Subject: [Haskell-cafe] Learn Prolog... In-Reply-To: <837db430709021742l1236f224q13093171495ff57d@mail.gmail.com> References: <46DA9D34.9010604@btinternet.com> <46DAC1BF.104@btinternet.com> <837db430709020752o8aba7bdm1c7c1e6f9178c130@mail.gmail.com> <118877550