Re: [Haskell-cafe] Bidirectional programming in Haskell
Artyom Shalkhakov wrote: Hello, Are there any libraries for bidirectional [1] programming in Haskell? Any related work? On Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bff-0.1 The underlying research: http://wwwtcs.inf.tu-dresden.de/~voigt/popl09-2.pdf A web interface for playing with the library: http://linux.tcs.inf.tu-dresden.de/~bff/cgi-bin/bff.cgi All I've found is a paper There and back again: arrows for invertible programming, which I couldn't find the full text of. http://www.st.cs.ru.nl/papers/2005/alia2005-biarrowsHaskellWorkshop.pdf Ciao, Janis. -- Dr. Janis Voigtlaender http://wwwtcs.inf.tu-dresden.de/~voigt/ mailto:vo...@tcs.inf.tu-dresden.de ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Bidirectional programming in Haskell
Hi, On Tue May 26 01:21:28 EDT 2009, Artyom Shalkhakov wrote: Are there any libraries for bidirectional [1] programming in Haskell? Any related work? Some of the early work in the PSD project (closely related to the lenses) were developed in Haskell, http://www.iis.sinica.edu.tw/~scm/2007/inv/ It is not in active maintenance now, but if you are interested in doing something with it, I'd be happy to help. :) Ref: [1] S-C. Mu, Z. Hu and M. Takeichi, An injective language for reversible computation. In Mathematics of Program Construction 2004, LNCS 3125, pp. 289-313, July 2004. [2] Z. Hu, S-C. Mu and M. Takeichi, A programmable editor for developing structured documents based on bidirectional transformations. In Partial Evaluation and Semantics-Based Program Manipulation, pp. 178-189. August 2004 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Anglohaskell?
Sounds fun! I have no time to organise it, but someone should. It really isn't that hard! Thanks Neil On Mon, May 25, 2009 at 4:47 PM, Philippa Cowderoy fli...@flippac.org wrote: Is anyone up for Anglohaskell this year? Perhaps more importantly, is anyone willing to step forward to run it? I can lend a hand, having organised and to some extent meta-organised in previous years, but I'm not sure I have spare time to do the same kind of job as I did in 2007. For those who're new or don't remember, http://www.haskell.org/haskellwiki/AngloHaskell contains links to info from previous years - the idea's a get-together with lots of talks from hobbyist to academic, and plenty of chat. -- Philippa Cowderoy fli...@flippac.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: Haskell Communities and Activities Report (16th ed., May 2009)
On behalf of the many, many contributors, I am pleased to announce that the Haskell Communities and Activities Report (16th edition, May 2009) http://www.haskell.org/communities/ is now available from the Haskell Communities home page in PDF and HTML formats. Many thanks go to all the people that contributed to this report, both directly, by sending in descriptions, and indirectly, by doing all the interesting things that are reported. I hope you will find it as interesting a read as I did. If you have not encountered the Haskell Communities and Activities Reports before, you may like to know that the first of these reports was published in November 2001. Their goal is to improve the communication between the increasingly diverse groups, projects, and individuals working on, with, or inspired by Haskell. The idea behind these reports is simple: Every six months, a call goes out to all of you enjoying Haskell to contribute brief summaries of your own area of work. Many of you respond (eagerly, unprompted, and sometimes in time for the actual deadline ;-) to the call. The editor collects all the contributions into a single report and feeds that back to the community. When I try for the next update, six months from now, you might want to report on your own work, project, research area or group as well. So, please put the following into your diaries now: End of October 2009: target deadline for contributions to the November 2009 edition of the HCA Report Unfortunately, many Haskellers working on interesting projects are so busy with their work that they seem to have lost the time to follow the Haskell related mailing lists and newsgroups, and have trouble even finding time to report on their work. If you are a member, user or friend of a project so burdened, please find someone willing to make time to report and ask them to register with the editor for a simple e-mail reminder in October (you could point me to them as well, and I can then politely ask if they want to contribute, but it might work better if you do the initial asking). Of course, they will still have to find the ten to fifteen minutes to draw up their report, but maybe we can increase our coverage of all that is going on in the community. Feel free to circulate this announcement further in order to reach people who might otherwise not see it. Enjoy! Janis Voigtlaender hcar at haskell.org -- Dr. Janis Voigtlaender http://wwwtcs.inf.tu-dresden.de/~voigt/ mailto:vo...@tcs.inf.tu-dresden.de ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANN: New repository and trac for haskell-src-exts
Hi Niklas, Do you want people to cc bugs they want to vote for - like the GHC people do? Thanks Neil On Tue, May 26, 2009 at 12:56 AM, Niklas Broberg niklas.brob...@gmail.com wrote: Hi all, In preparation for my GSoC project, I've set up some new infrastructure for the haskell-src-exts package. Instead of residing with the HSP packages, it's now old enough to be allowed to live on its own. The new repository is darcs get http://code.haskell.org/haskell-src-exts I've also finally set up a bug tracker for all things big and small, found at http://trac.haskell.org/haskell-src-exts I've added all issues from my old TODO list, but I'm sure there's more stuff that I've missed. Please help me by reporting anything you come across, or by requesting new and cool features. Cheers, /Niklas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] No VerboseCheck in QuickCheck 2?
Hi, I don't think I am familiar enough with QuickCheck 2. But there seems to be no verboseCheck like function, and sample and sample' is useful to printing test cases. ghci sample (arbitrary :: Gen Int) 1 0 1 -2 -2 -5 -16 -9 -57 -115 -94 ghci sample (arbitrary :: Gen (Int,Int)) (0,1) (-1,-1) (1,2) (3,-4) (-4,5) (11,-9) (-2,8) (18,17) (-63,-32) (-117,-71) (195,-198) ghci f - fmap head $ sample' (arbitrary :: Gen (Int - Maybe Int)) ghci map f [1..10] [Nothing,Just (-1),Just 1,Nothing,Nothing,Just 1,Nothing,Nothing,Just 1,Just 1] Thanks, Hashimoto On 2009/05/26, at 11:54, Shin-Cheng Mu wrote: Hi, I believe this must have been raised before but I did some searching to no avail, so please allow me.. It seems that verboseCheck is gone in QuickCheck 2. In QuickCheck 2, how do we print the test cases, specify the number of tests, or the sizes of test cases, etc.? Thank you very much.. sincerely, Shin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell programmer s in São Carlos - SP - Brazil?
Is there already any mailing list or group in Portuguese? I would like that if it were a list for Portuguese speakers, no matter they are from Portugal or Moçambique. Maurício Hey, we have enough people for a São Paulo Haskell User Group. Anyone else interested? Best regards, Daniel Yokomizo 2009/5/21 Fernando Henrique Sanches fernandohsanc...@gmail.com: São Caetano, SP, Brazil - right next to São Paulo. UFABC Student. Fernando Henrique Sanches 2009/5/19 Maurício briqueabra...@yahoo.com Anybody else around here? Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] the problem of design by negation
On Tue, 26 May 2009, Richard O'Keefe wrote: I have one of Brian Marick's (www.exampler.com) stickers on my door. It reads to be less wrong than yesterday Two quotes I often give my students: Brethren, I beseech you in the bowels of Christ, consider it _possible_ that you _may_ be wrong. Oliver Cromwell Fear most of all to _remain_ in error. Me, deliberately misquoting Kierkegaard, quoting Socrates. I changed 'be' to 'remain'. Along similar lines, Esther Dyson's .sig says Always make new mistakes! Tony. -- f.anthony.n.finch d...@dotat.at http://dotat.at/ GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS. MODERATE OR GOOD. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell programmers in São Carlo s - SP - Brazil?
I don't think there's one, but I would subscribe to it. -- []s, Andrei Formiga 2009/5/26 Maurício briqueabra...@yahoo.com: Is there already any mailing list or group in Portuguese? I would like that if it were a list for Portuguese speakers, no matter they are from Portugal or Moçambique. Maurício Hey, we have enough people for a São Paulo Haskell User Group. Anyone else interested? Best regards, Daniel Yokomizo 2009/5/21 Fernando Henrique Sanches fernandohsanc...@gmail.com: São Caetano, SP, Brazil - right next to São Paulo. UFABC Student. Fernando Henrique Sanches 2009/5/19 Maurício briqueabra...@yahoo.com Anybody else around here? Best, Maurício ___ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Anglohaskell?
I agree, I'd love to see this happen. Like everyone else, I don't have much time, but can do grunt work if there's any to be done, and will happily support anyone who does take up the mantel. Cheers, Sam -Original Message- From: haskell-cafe-boun...@haskell.org on behalf of Neil Mitchell Sent: Tue 26/05/2009 09:20 To: Philippa Cowderoy Cc: Haskell cafe Subject: Re: [Haskell-cafe] Anglohaskell? Sounds fun! I have no time to organise it, but someone should. It really isn't that hard! Thanks Neil On Mon, May 25, 2009 at 4:47 PM, Philippa Cowderoy fli...@flippac.org wrote: Is anyone up for Anglohaskell this year? Perhaps more importantly, is anyone willing to step forward to run it? I can lend a hand, having organised and to some extent meta-organised in previous years, but I'm not sure I have spare time to do the same kind of job as I did in 2007. For those who're new or don't remember, http://www.haskell.org/haskellwiki/AngloHaskell contains links to info from previous years - the idea's a get-together with lots of talks from hobbyist to academic, and plenty of chat. -- Philippa Cowderoy fli...@flippac.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell programmers in São Carlos - SP - Brazil?
On Tue, May 26, 2009 at 12:42:12PM -0300, Andrei Formiga wrote: I don't think there's one, but I would subscribe to it. I would as well, but what would we gain with it? Wouldn't it rot because every message one of us wanted to post was general enough to just post on haskell-cafe? Would it be able to attract Portuguese-speaking people that aren't fluent English speakers? I'm not being pessimistic, just a thought. :) Cheers, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANN: New repository and trac for haskell-src-exts
Do you want people to cc bugs they want to vote for - like the GHC people do? Absolutely. Seeing the relative interest in various features would definitely be helpful in steering my (and others') efforts. /Niklas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] May all logos be freely used?
Hello, What's the status of the logos on http://www.haskell.org/logos/results.html I'd like to use one or more in an about message in a Haskell program. Is this allowed, and if so, are there any conditions? I've just looked at them again, and it's a really fine collection, I think. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] May all logos be freely used?
From http://haskell.org/haskellwiki/Haskell_logos/New_logo_ideas : Please submit your entries here, and attach your name to them please. To be eligible, they will need to be visible on this page (e.g. uploaded, or link to the image). The image should be freely available (a suitable freely distributable license). Entries not displayed here won't be eligible. And the wiki license: By contributing to HaskellWiki, you license your contribution under this license: Permission is hereby granted, free of charge, to any person obtaining this work (the Work), to deal in the Work without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Work, and to permit persons to whom the Work is furnished to do so. THE WORK IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS IN THE WORK. Contributions since 2006-01-14 05:15 UTC are available under the above license. So at least any logos on the wiki should be usable under that license. --Max On Tue, May 26, 2009 at 6:31 PM, Hans van Thiel hthiel.c...@zonnet.nl wrote: Hello, What's the status of the logos on http://www.haskell.org/logos/results.html I'd like to use one or more in an about message in a Haskell program. Is this allowed, and if so, are there any conditions? I've just looked at them again, and it's a really fine collection, I think. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] The Computer Language Benchmarks Game: pidigits
On Mon May 25 16:18:29 EDT 2009, Arnaud Payement wrote: ... I thought it is better to show Haskell as one would naturally write it. One would naturally first write it in C ? :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A problem with par and modules boundaries...
On Mon, 2009-05-25 at 09:40 -0400, Mario Blazevic wrote: $diff main.simpl imported.simpl ... 223c232 a_s1rs [ALWAYS Just L] :: GHC.Integer.Internals.Integer --- a_s1sV [ALWAYS Just S] :: GHC.Integer.Internals.Integer ... Good find! Does this S vs. L difference have anything to do with strictness and laziness? Yes. So, I think we should open a ghc but report with all the details, particularly the example's source, the ghc version and that highlight of that strictness difference. I have logged the ticket at http://hackage.haskell.org/trac/ghc/ticket/3259 Thanks for being so persistent Mario! Simon has diagnosed the bug. It's really rather subtle. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haskell programmers in São Carlos - SP - Brazil?
I would as well, but what would we gain with it? Wouldn't it rot because every message one of us wanted to post was general enough to just post on haskell-cafe? Would it be able to attract Portuguese-speaking people that aren't fluent English speakers? I'm not being pessimistic, just a thought. :) Of course, this was in my mind too. But I think we could have more general discussion groups in Portuguese, now that there's a standard ortography :) I think it's worth a shot. At least there are many students who do not speak good english, and even for those who use english all time most of us will always be able to write deeper thoughts in Portuguese than in English. I'll check with the guys at: http://haskell.org/mailman/listinfo If it doesn't suceed, we'll just erase it. Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Purely logical programming language
There are a number of ways to marry purely functional programming languages with IO. To name just two possibilities: Clean uses linear types, threading exactly one World through functions, Haskell uses Monads. The model in Prolog, however, looks more like the model used in most strict functional languages. It uses impure predicates to affect the outside world. Do you know of any attempt to do for logic programming what Monads did for functional programming? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to implement this? A case for scoped record labels?
On Tue, May 26, 2009 at 4:32 AM, wren ng thornton w...@freegeek.org wrote: One alternative is to use Haskell's support for ad-hoc overloading. Define a typeclass for each selector (or group of selectors that must always occur together) which is polymorphic in the record type. [...] It's not pretty, but it gets the job done. Many people decry this as improper use of typeclasses though (and rightly so). Yes. I was experimenting a little with type classes and the more granular I defined them the more I got the feeling of producing a hack. But as you said, it would get the job done and I will probably give it a try. A better approach would probably be to use GADTs or the new data families which give a sort of dual of typeclasses (typeclasses give a small set of functions for a large set of types; GADTs give a large set of functions for a small set of types[0]). Someone more familiar with those approaches should give those versions. Interesting, but I fail to see how this might be applied to the problem at hand. I played with associated types and they are quite neat. But I would still be working with type classes, so how would this be different from the first approach. W.r.t. GADTs I understood these as to provide a way to be more specific about the return type of constructor functions. But my problem is mostly a scope issue, isn't it? If you want to be able to set the fields as well as read them then the classes should be more like lenses than projectors. I am fine with selectors for now. But thanks for the references. Also take a look at hptotoc[4], the Haskell implementation of Google's Protocol Buffers which has many similar problems to your Bayeaux protocol. In general, protocols designed for OO are difficult to translate into non-OO languages. From what I saw by briefly scanning the contents it seems to me the problem is again solved with the type class approach you mentioned in the beginning. I wonder if I am completely off here, but I am surprised that there is no progress on the scoped labels front. The Haskell wiki mentioned that the status quo is due to a missing optimum in the design space, but the same can be said about generic programming in Haskell and yet, GHC ships with Scrap your boilerplate. So we have to resort to type classes hacks instead of a proper solution. OTOH I might not have understood the relevance of GADTs for this problem and it is a non-issue but prima facie it doesn't seem to be. Anyway, many thanks for your thoughtful reply. Best regards, nt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Purely logical programming language
On Tue, May 26, 2009 at 09:10:10PM +0200, Matthias Görgens wrote: The model in Prolog, however, looks more like the model used in most strict functional languages. It uses impure predicates to affect the outside world. Do you know of any attempt to do for logic programming what Monads did for functional programming? Traditionally Prolog programmers have used chained state variables: foo(X,S0,SOut) :- bar(X,S0,S1), baz(X,Y,S1,S2), quux(X,Y,S2,SOut). This is kind of like using a state monad on top of Prolog's built-in nondeterminism monad. There's even syntactic sugar for this, just like Haskell programmers have the do-syntax: foo(X) -- bar(X), baz(X,Y), quux(X,Y). Although Prolog isn't pure, Mercury, its derivative, is (mostly). In Mercury, the IO state (kind of like RealWorld) is threaded through state variables and Mercury's mode checking makes sure that there will always be only one result from IO predicates. Mercury also has type classes and other Haskellisms, so if you're interested in doing Prolog the Haskell way, you should definitely have a look at it. Lauri ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Purely logical programming language
Mercury also has type classes and other Haskellisms, so if you're interested in doing Prolog the Haskell way, you should definitely have a look at it. Thanks. I'll have a look. (I also just found Mercury on my own: After I posed my original question, I tried another web search, and found what I was looking for. I haven't read the articles, yet, so I am grateful for your summary.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Purely logical programming language
Hi, On 26.05.2009, at 21:24, Lauri Alanko wrote: Mercury also has type classes and other Haskellisms, so if you're interested in doing Prolog the Haskell way, you should definitely have a look at it. I have to admit that I am not very familiar with Mercury. But if you are looking for doing Prolog the Haskell way advertiseyou can also have a look at Curry/advertise. Curry is a lazy functional logic programming language that has a Haskell like syntax (http://www.curry-language.org/ ). Besides standard functional features it provides non-determinism and narrowing. In contrast to Haskell overlapping rules in function definitions induce non-determinism. For example the following function non-deterministically inserts an element at each position of a list. insert :: a - [a] - [a] insert x xs = x : xs insert x (y:ys) = y : insert x ys From the side-effects point of view Curry is very boring as it does not provide type classes but there is one monad namely the IO monad for doing side effects. Cheers, Jan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How does GHC's implementation of par work?
This is related to the long thread on a bug in cross-module strictness analysis for the lazy function in GHC. Simon posted a response to that bug ( http://hackage.haskell.org/trac/ghc/ticket/3259 ), which shows the Haskell source for GHC's par function: {-# INLINE par #-} par :: a - b - b par x y = case (par# x) of { _ - lazy y } While I understand that in GHC Core, case always reduces its argument to WHNF, this isn't true of Haskell in general. What causes par# to get executed? Does GHC overload case for unboxed return values to force the evaluation of the scrutinee even if its return value isn't used? -- ryan On Tue, May 26, 2009 at 10:29 AM, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote: On Mon, 2009-05-25 at 09:40 -0400, Mario Blazevic wrote: $diff main.simpl imported.simpl ... 223c232 a_s1rs [ALWAYS Just L] :: GHC.Integer.Internals.Integer --- a_s1sV [ALWAYS Just S] :: GHC.Integer.Internals.Integer ... Good find! Does this S vs. L difference have anything to do with strictness and laziness? Yes. So, I think we should open a ghc but report with all the details, particularly the example's source, the ghc version and that highlight of that strictness difference. I have logged the ticket at http://hackage.haskell.org/trac/ghc/ticket/3259 Thanks for being so persistent Mario! Simon has diagnosed the bug. It's really rather subtle. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Purely logical programming language
On Tue, 26 May 2009, Jan Christiansen wrote: Hi, On 26.05.2009, at 21:24, Lauri Alanko wrote: Mercury also has type classes and other Haskellisms, so if you're interested in doing Prolog the Haskell way, you should definitely have a look at it. I have to admit that I am not very familiar with Mercury. But if you are looking for doing Prolog the Haskell way advertiseyou can also have a look at Curry/advertise. Curry is a lazy functional logic programming language that has a Haskell like syntax (http://www.curry-language.org/). You forgot to mention, that you will give a talk about Curry soon, where Matthias might want to attend: http://iba-cg.de/hal4.html :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] [wxHaskell] ghc-pkg: /usr/local/lib/imports doesn't exist ...
Hello, I'm installing wxhaskell from darcs, almost all found good, but after make # runghc Setup.lhs install the last lines this is: cat config/wxcore.pkg | sed -e s|\${wxhlibdir}|/usr/local/lib| | ghc-pkg update - Reading package info from stdin ... done. ghc-pkg: /usr/local/lib/imports doesn't exist or isn't a directory (use --force to override) make: *** [wxcore-register] Error 1 I don't know solve this, I'm using linux ubuntu-jaunty with ghc-6.10.1 and wxGTK-2.8.10 thanks, --benjo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to implement this? A case for scoped record labels?
ntu...@googlemail.com wrote: wren ng thornton wrote: A better approach would probably be to use GADTs or the new data families which give a sort of dual of typeclasses (typeclasses give a small set of functions for a large set of types; GADTs give a large set of functions for a small set of types[0]). Someone more familiar with those approaches should give those versions. Interesting, but I fail to see how this might be applied to the problem at hand. I played with associated types and they are quite neat. But I would still be working with type classes, so how would this be different from the first approach. W.r.t. GADTs I understood these as to provide a way to be more specific about the return type of constructor functions. But my problem is mostly a scope issue, isn't it? I'm not familiar enough with the state of the art here to feel comfortable suggesting an implementation; hence leaving it to someone else. Technically GADTs are just for being more specific about the return types of constructor functions, but this is vastly more powerful than it may seem. For instance, GADTs can be combined with phantom types to great effect, e.g. for type checking dependent-like types. GADTs can easily cover record selectors that apply to all constructors, and selectors that apply to one constructor (or a set of constructors producing the same type). If the family of selector sets forms a nice tree hierarchy, you can use phantom type constructors and type variables to express subtrees of that hierarchy as types, e.g. data Name m data Successful m ... data Bayeaux mesg where HandshakeRequest :: ... - Bayeaux (Name ...) HandshakeResponse :: ... - Bayeaux (Name (Successful ...)) ... name :: Bayeaux (Name m) - String name (HandshakeRequest ...) = ... name (HandshakeResponse ...) = ... ... successful :: Bayeaux (Name (Successful m)) name (HandshakeResponse ...) = ... ... I don't know if the Bayeaux protocol is amenable to this or not. And I'm sure there's a prettier way to do it anyhow. By using multiple phantom types you can encode any subset relation on selector sets that can be described by a tree-ordered space. If the subset relation is DAGy, then things get ugly again. You'll probably have to use typeclasses in some form or another eventually, the question is how much you rely on ad-hoc overloading vs how structured you can make things by using other techniques. I wonder if I am completely off here, but I am surprised that there is no progress on the scoped labels front. The Haskell wiki mentioned that the status quo is due to a missing optimum in the design space, but the same can be said about generic programming in Haskell and yet, GHC ships with Scrap your boilerplate. So we have to resort to type classes hacks instead of a proper solution. OTOH I might not have understood the relevance of GADTs for this problem and it is a non-issue but prima facie it doesn't seem to be. The missing optimum is a big problem leading to the status quo. I think another issue is that noone is currently working on alternatives[1][2]. For SYB and the other generics stuff, people are actively working on it so there's more desire to make the options widely available, hoping that a clear winner will emerge. Without active competition to weed out competitors, offering multiple options fragments the community. The monad transformer libraries seem to be in this quandary now. There was a lot of research a while back and there are lots of options out there, but people default to mtl for compatibility reasons and there hasn't been a strong campaign for one of the competitors to conquer mindshare and take over (though a small one is beginning now that the HP is here). [1] I have a handful of ideas I've been kicking around, but I can't say that I've actually been working on any of them. [2] If anyone *is* actively working in this area, I'd be curious to hear about it :) -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Design in Haskell?
Are there any suggestions of wikis, books or particularly well-architected and readable projects I could look at to about learn larger-scale design in Haskell? I've recently found Brent Yorgey's The Typeclassopedia very helpful. You can find it in The Monad.Reader Issue 13. It's similar to Design Patterns in that it lays out all the basic patterns (type classes in this case) and shows how to properly use each one. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Purely logical programming language
Henning Thielemann wrote: On Tue, 26 May 2009, Jan Christiansen wrote: Hi, On 26.05.2009, at 21:24, Lauri Alanko wrote: Mercury also has type classes and other Haskellisms, so if you're interested in doing Prolog the Haskell way, you should definitely have a look at it. I have to admit that I am not very familiar with Mercury. But if you are looking for doing Prolog the Haskell way advertiseyou can also have a look at Curry/advertise. Curry is a lazy functional logic programming language that has a Haskell like syntax (http://www.curry-language.org/). You forgot to mention, that you will give a talk about Curry soon, where Matthias might want to attend: http://iba-cg.de/hal4.html :-) By the way, did Curry solved the problem of how to deal with IO and backtracking issues? (where and where not should IO happen kind of a thing) I haven't used Curry that much but I remember that there was an issue of IO and non-determinism. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I love purity, but it's killing me.
Hi Tom, I've been working on another code-generating graphics compiler, generating GPU code. As always, I run into the problem of efficient common subexpression elimination. In Pan, Vertigo Pajama, I used lazy memoization, using stable pointers and weak references, to avoid the worst-case-exponential behavior you mention below. I'm now using a bottom-up CSE method that's slower and more complicated than I'm going for. What's your latest wisdom about CSE in DSELs? Thanks, - Conal On Thu, Feb 7, 2008 at 11:33 PM, Tom Hawkins tomahawk...@gmail.com wrote: I've been programming with Haskell for a few years and love it. One of my favorite applications of Haskell is using for domain specific languages. However, after designing a handful of DSLs, I continue to hit what appears to be a fundamental hurdle -- or at least I have yet to find an adequate solution. My DSLs invariably define a datatype to capture expressions; something like this: data Expression = Add Expression Expression | Sub Expression Expression | Variable String | Constant Int deriving Eq Using the datatype Expression, it is easy to mass a collections of functions to help assemble complex expressions, which leads to very concise programs in the DSL. The problem comes when I want to generate efficient code from an Expression (ie. to C or some other target language). The method I use invovles converting the tree of subexpressions into an acyclic graphic to eliminate common subexpressions. The nodes are then topologically ordered and assigned an instruction, or statement for each node. For example: let a = Add (Constant 10) (Variable i1) b = Sub (Variable i2) (Constant 2) c = Add a b would compile to a C program that may look like this: a = 10 + i1; b = i2 - 2; c = a + b; The process of converting an expression tree to a graph uses either Eq or Ord (either derived or a custom instance) to search and build a set of unique nodes to be ordered for execution. In this case a, then b, then c. The problem is expressions often have shared, equivalent subnodes, which dramatically grows the size of the tree. For example: let d = Add c c e = Add d d-- e now as 16 leaf nodes. As these trees grow in size, the equality comparison in graph construction quickly becomes the bottleneck for DSL compilation. What's worse, the phase transition from tractable to intractable is very sharp. In one of my DSL programs, I made a seemingly small change, and compilation time went from milliseconds to not-in-a-million-years. Prior to Haskell, I wrote a few DSLs in OCaml. I didn't have this problem in OCaml because each let expression was mutable, and I could use the physical equality operator to perform fast comparisons. Unfortunately, I have grown to love Haskell's type system and its lack of side effects, and could never go back. Is there anything that can be done to dramatically speed up comparisons, or is there a better approach I can take to extract common subexpressions? I should point out I have an opportunity to get Haskell on a real industrial application. But if I can't solve this problem, I may have to resort to far less eloquent languages. :-( Thanks for any and all help. -Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Lazy Parsing
Hi all, is it possible to do lazy parsing with Parsec? I understand that one can do that with polyparse, don't know about uulib, but I happen to be already somewhat familiar with Parsec, so before I do switch to polyparse I rather make sure I actually have to. The files it has to parse is anywhere from 500 MB to 5 GB. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to implement this? A case for scoped record labels?
I wonder if I am completely off here, but I am surprised that there is no progress on the scoped labels front. The Haskell wiki mentioned that the status quo is due to a missing optimum in the design space, but the same can be said about generic programming in Haskell and yet, GHC ships with Scrap your boilerplate. So we have to resort to type classes hacks instead of a proper solution. There are various implementations of extensible records available. HList may have the best-supported versions and the most experience, but essentially, they are simple enough to define that some packages ship with their own variants (as long as there is no agreement on the future of the language extensions needed to implement these libraries, there won't be any standard library). See the links on the Haskell wiki [1], though there are also newer entries on the GHC trac wiki [2,3]. The Haskell wiki page also points to my old first class labels proposal, which included a small example implementation based on Daan's scoped labels (there was a more recent implementation of Data.Record which noone seemed interested in, and the fairly new Data.Label suggestion offers a workaround for the lack of first class labels, see [4] for unsupported experimental versions of both). The various accessor packages and generators might be a more lightweight/portable alternative. In particular, they also cover the case of nested accessors. And, going back to your original problem, there is an intermediate stage between data BayeuxMessage = HandshakeRequest { channel :: String , ... } | HandshakeResponse { channel :: String, successful :: Bool, ... } | ... and data HandshakeRequest = HandshakeRequest { channel :: String , ... } data HandshakeResponse = HandshakeResponse { channel :: String, successful :: Bool, ... } ... data BayeuxMessage = HSReq HandshakeRequest | HSRes HandshakeResponse ... namely data HandshakeRequest = HandshakeRequest { ... } data HandshakeResponse = HandshakeResponse { successful :: Bool, ... } ... data BayeuxMessage = HSReq{ channel :: String, request :: HandshakeRequest } | HSRes{ channel :: String, response :: HandshakeResponse } ... Generally, you'll often want to use labelled fields with parameterized types, eg data NamedRecord a = Record { name :: a, ... } type StringNamedRecord = Record String type IntNamedRecord = Record Int and, no, I don't suggest to encoded types in names, this is just an abstract example;-) Mostly, don't feel bound to a single upfront design, refactor your initial code until it better fits your needs, as you discover them. Hth, Claus [1] http://www.haskell.org/haskellwiki/Extensible_record [2] http://hackage.haskell.org/trac/ghc/wiki/ExtensibleRecords [3] http://hackage.haskell.org/trac/ghc/ticket/1872 [4] http://community.haskell.org/~claus/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] trying to understand space leaks....
In Section 2.5 of Generalizing Monads to Arrows paper (linkhttp://www.cs.chalmers.se/%7Erjmh/Papers/arrows.ps) John Huges talks about the space leak inherit in monadic implementation of backtracking parsers. newtype Parser s a = P( [s] = Maybe (a, [s])) instance MonadPlus Parser where P a mplus P b = P (\s - case a s of Just (x, s') - Just (x, s') Nothing - b s) The problem (as I understand it) is that to implement the backtracking, the monad plus implementation needs to keep the state (the computation that returns the next token) around in case the parser fails (so that it can be passed to the other side of mplus).I am having hard time to understand... a)what exactly gets saved on the heap between the mplus calls? b)I am assuming the computation to get the next character for parsing to be an IO Char type computation, in that case, what would be the size of the heap buffer that is kept around in case the computation result needs to be reused? c) Assuming Pa in the above code reads n tokens from the input stream then fails, how does the run time returns the same token to the P b? Thanks, Daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I love purity, but it's killing me.
Conal Elliott wrote: Hi Tom, I've been working on another code-generating graphics compiler, generating GPU code. As always, I run into the problem of efficient common subexpression elimination. In Pan, Vertigo Pajama, I used lazy memoization, using stable pointers and weak references, to avoid the worst-case-exponential behavior you mention below. I'm now using a bottom-up CSE method that's slower and more complicated than I'm going for. What's your latest wisdom about CSE in DSELs? Thanks, - Conal One common trick that Tom didn't seem to mention in the 2008-02-07T23:33 post is hash cons'ing. Given a perfect hash function, traverse the term bottom-up storing each (hash,subterm) pair in a memo table and replacing the subterm by its hash. Once that's done, equality checks are trivial, and the memotable can be converted to SSA rather easily. This works best if you amortize the memoization by doing it with smart constructors, so that you don't need to worry about the exponential duplication of work for expressions with DAGy structure sharing in the Haskell. Since it's stateful, that means the smart constructors may need to be in an appropriate monad/applicative for passing the memo table around (some hash functions may not need to store the table explicitly). Maybe this is the too-slow too-complex solution you're using already? -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I love purity, but it's killing me.
On Tue, May 26, 2009 at 6:49 PM, Conal Elliott co...@conal.net wrote: Hi Tom, I've been working on another code-generating graphics compiler, generating GPU code. As always, I run into the problem of efficient common subexpression elimination. In Pan, Vertigo Pajama, I used lazy memoization, using stable pointers and weak references, to avoid the worst-case-exponential behavior you mention below. I'm now using a bottom-up CSE method that's slower and more complicated than I'm going for. What's your latest wisdom about CSE in DSELs? I wasn't able to find a solution that offered both performance and elegance, so I changed the fundamental operation of the DSL (in this case, atom). When atom was still a hardware description language, the compiler would combine several user defined expressions together resulting in very wide and deep expression trees, resulting in the same problem you are observing. But when I switch the target of atom from HDL to C, the compiler no longer needed to perform the same expression expansion. And since the user defined expressions are generally shallow -- at least in the case of my applications -- atom is able to get away with exhaustive equality comparison (deriving Eq). Sorry I can't be of more help. -Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How does GHC's implementation of par work?
2009/5/26 Ryan Ingram ryani.s...@gmail.com: What causes par# to get executed? Does GHC overload case for unboxed return values to force the evaluation of the scrutinee even if its return value isn't used? As you noted, the type of par is a - Int#. Furthermore, the only possible evaluation semantics for unboxed types in GHC's intermediate language is strict. This means that your case expression has to evaluate the scrutinee eagerly. Indeed, consider the following program (which looks even lazier than your example): let x :: Int# = error boom! in 10 This will diverge in either Haskell or Core, because both languages promise that if have an unlifted thing in your environment /it really has been evaluated/. SPJ and I recently wrote a paper [1] proposing an intermediate language for GHC that would allow Core to express thunks of unlifted types, but even so I don't think we would actually want to change the semantics of bindings of unlifted types in Haskell. Cheers, Max [1] http://www.cl.cam.ac.uk/~mb566/papers/tacc-hs09.pdf ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] trying to understand space leaks....
On Tue, May 26, 2009 at 5:03 PM, Daryoush Mehrtash dmehrt...@gmail.com wrote: newtype Parser s a = P( [s] - Maybe (a, [s])) (fixed typo) instance MonadPlus Parser where P a mplus P b = P (\s - case a s of Just (x, s') - Just (x, s') Nothing - b s) a)what exactly gets saved on the heap between the mplus calls? Two things: (1) Values in the input stream that a parses before failing. Beforehand, it might just be a thunk that generates the list lazily in some fashion. (2) The state of the closure b; if parser a fails, we need to be able to run b; that could use an arbitrary amount of space depending on what data it keeps alive. b)I am assuming the computation to get the next character for parsing to be an IO Char type computation, in that case, what would be the size of the heap buffer that is kept around in case the computation result needs to be reused? Nope, no IO involved; just look at the types: P :: ([s] - Maybe (a,[s])) - Parser s a (Parser s a) is just a function that takes a list of s, and possibly returns a value of type a and another list [s] (of the remaining tokens, one hopes) It's up to the caller of the parsing function to provide the token stream [s] somehow. c) Assuming Pa in the above code reads n tokens from the input stream then fails, how does the run time returns the same token to the P b? It just passes the same stream to both. No mutability means no danger :) -- ryan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Design in Haskell?
On Wed, May 27, 2009 at 6:50 AM, Michael Steele mikesteel...@gmail.com wrote: I've recently found Brent Yorgey's The Typeclassopedia very helpful. You can find it in The Monad.Reader Issue 13. It's great, thank you Michael. lee ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How does GHC's implementation of par work?
I saw your paper on LtU last week. Here's an extra plug: I really enjoyed it. When can we expect to see Strict Core replacing System Fc? :) -- ryan On Tue, May 26, 2009 at 5:32 PM, Max Bolingbroke batterseapo...@hotmail.com wrote: 2009/5/26 Ryan Ingram ryani.s...@gmail.com: What causes par# to get executed? Does GHC overload case for unboxed return values to force the evaluation of the scrutinee even if its return value isn't used? As you noted, the type of par is a - Int#. Furthermore, the only possible evaluation semantics for unboxed types in GHC's intermediate language is strict. This means that your case expression has to evaluate the scrutinee eagerly. Indeed, consider the following program (which looks even lazier than your example): let x :: Int# = error boom! in 10 This will diverge in either Haskell or Core, because both languages promise that if have an unlifted thing in your environment /it really has been evaluated/. SPJ and I recently wrote a paper [1] proposing an intermediate language for GHC that would allow Core to express thunks of unlifted types, but even so I don't think we would actually want to change the semantics of bindings of unlifted types in Haskell. Cheers, Max [1] http://www.cl.cam.ac.uk/~mb566/papers/tacc-hs09.pdf ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Design in Haskell?
If you are coming from Object Oriented background, I think, the best book to read is the Paul Hudak's Haskell School of Expression. It goes through a design of a game application. The book is also available on line in google books. daryoush On Mon, May 25, 2009 at 1:22 AM, Dan danielkc...@gmail.com wrote: Hi, When I was learning to program in imperative languages like Java, there were plenty of resources to learn from about how to design large programs. Ideas like the GoF Design Patterns gave useful models that one could then scale up. Are there such resources for Haskell? As I'm learning the language, I'm finding it quite nice to write short programs (e.g. projecteuler, Haskell Road, etc.) But when I try to write something a bit larger, I find I'm tripping over myself and having a hard time organizing the code coherently. Are there any suggestions of wikis, books or particularly well-architected and readable projects I could look at to about learn larger-scale design in Haskell? Cheers, - Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Bidirectional programming in Haskell
Hi, 2009/5/26 Janis Voigtlaender vo...@tcs.inf.tu-dresden.de: On Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bff-0.1 The underlying research: http://wwwtcs.inf.tu-dresden.de/~voigt/popl09-2.pdf A web interface for playing with the library: http://linux.tcs.inf.tu-dresden.de/~bff/cgi-bin/bff.cgi Thanks for the links, I'm off for tinkering... Cheers, Artyom Shalkhakov. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe