Re: [Haskell-cafe] Data.List.Split
Hi I should have said that, on the other hand, with stream fusion enabled, (concat . map) outperforms (concatMap) :) That can only be a bug in stream fusion - concatMap should always be prefered! Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
On 15 Dec 2008, at 03:27, Don Stewart wrote: Could you attach it to the web page, http://haskell.org/haskellwiki/Haskell_logos/New_logo_ideas I've stuck a contender up there too. Bob ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)
2008/12/12 Sean Leather leat...@cs.uu.nl: On Fri, Dec 12, 2008 at 13:22, Thomas Schilling wrote: The fromJust error is a bug, of course, however, the underlying problem is a bit more difficult: Haddock doesn't generate any code, it only typechecks. If the code uses Template Haskell, however, the typechecker will have to run Haskell code and potentially this code will have to come from a module of the same package. If the code indeed comes from the same package, fixing the fromJust error will just lead to GHCi linker error, since Haddock didn't generate any code for these. Thanks for enlightening us, Thomas. Here are a couple of solutions and non-solutions: [...] Any other? What about the eventual (maybe never?) solution of collecting comments and types for Haddock after splicing in code? This is more long term, perhaps, but in the end ideal if it can be made to work. This is what Haddock does, actually. It works when the spliced-in code comes from another package (although this causes another problem, currently), and we should make it work also for your case where the code comes from the same package. With some improvements to the GHC API (and Haddock), we should be able to fix this. David ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
On 15 dec 2008, at 03:31, Derek Elkins wrote: On Mon, 2008-12-15 at 02:57 +0100, Eelco Lempsink wrote: I'm not a graphic designer, but that doesn't prevent me giving a try. By the way, the font used (Kautiva) is not free. You might recognize it from Tupil's logo ;) Someone would pay for that font? It literally hurts my eyes. Oh, I'm terribly sorry, I didn't mean to cause any harm. To sooth your eyes, I created another variation, which also features a tagline that, in my opinion, captures more closely the gist of the impression Haskell makes on most programmers. inline: haskell-logo-funny.png This one is dedicated to you, Derek. Good luck with your eyes. -- Regards, Eelco Lempsink PGP.sig Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)
2008/12/12 Duncan Coutts duncan.cou...@worc.ox.ac.uk: Let's see what David thinks. If he thinks is possible to fix these kinds of things where haddock is not covering the whole GHC AST (at least to the degree where it can ignore bits it does not understand). If that's not realistic in the short term then we probably should introduce some haddock version macro so that people can workaround it. Haddock already tries to filter out declarations that it can't (or shouldn't) handle. I think that works well, although it's possible it can be improved. If we find a case where more filtering is needed, it's an easy fix to make. In this case, we can't filter out the TH declarations (since the code might then not compile), but we can perhaps fix the root-cause in the short-term (I'm not sure about that, but I hope so). So let's wait with the flag until we find something that can't be filtered out and for which we don't have a short-term fix? David ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] Re: Help : A problem with IO
you probably got it pointed out in haskell-beginners, but in case not: On Thu, Nov 27, 2008 at 7:10 PM, abdullah abdul Khadir abdullah.ak2...@gmail.com wrote: a) I need to put a do after else for more than one instruction (?) No, the do thingy is a syntactic sugar for chaining warm, fuzzy (the preffered wannabe-joke-term for the presumably scary term monads/monadic) operations. it allows you to write in classical imperative/sequential style instead of chaining operations manually (using the and = operators, which the do notation translates into anyway). lookup some monad tutorials/docs. you are right in that if there is only one operation, no transformation is needed, so the do is unnecessary. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
Something incorporating λ∀ perhaps martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Multi-parameter type class woes
2008/12/15 Mario Blazevic mblaze...@stilo.com Alexander Dunlap wrote: The problem is that y is not mentioned in the signature of wrapper. When you call wrapper x, there could be many different instances of Container x y with the same x, so GHC doesn't know which version to call. I guess I see it now. However, if the explicit 'Container x y =' context couldn't fix the y to use for instantiation of Container x y, I don't see any way to fix it. And if there is no way to call wrapper in any context, the class declaration itself is illegal and GHC should have reported the error much sooner. Should I create a ticket? Please do not create a ticket. Such a typeclass is legitimate, but not useful alone or with functional dependencies. It is useful with Type Families though, so celebrate! Thomas - START CODE {-# LANGUAGE TypeFamilies, MultiParamTypeClasses, FlexibleInstances #-} import Data.Maybe class Container x where type Contains x wrapper :: x - Bool unwrap :: x - Contains x rewrap :: Contains x - x liftWrap :: Container x = (Contains x - Contains x) - x - x liftWrap f x = (if wrapper x then rewrap . f . unwrap else id) x instance Container (Maybe x) where type Contains (Maybe x) = x wrapper = isJust unwrap = fromJust rewrap = Just main = print (liftWrap (succ :: Int - Int) (Just 1 :: Maybe Int)) - ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Multi-parameter type class woes
On Mon, Dec 15, 2008 at 2:15 PM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: 2008/12/15 Mario Blazevic mblaze...@stilo.com Alexander Dunlap wrote: The problem is that y is not mentioned in the signature of wrapper. When you call wrapper x, there could be many different instances of Container x y with the same x, so GHC doesn't know which version to call. I guess I see it now. However, if the explicit 'Container x y =' context couldn't fix the y to use for instantiation of Container x y, I don't see any way to fix it. And if there is no way to call wrapper in any context, the class declaration itself is illegal and GHC should have reported the error much sooner. Should I create a ticket? Please do not create a ticket. Such a typeclass is legitimate, but not useful alone or with functional dependencies. It is useful with Type Families though, so celebrate! Thomas Ok, now I get to laugh at myself. Caught up in the type family fun, I didn't even notice I obliterated the MPTC issue that started the whole discussion. Slowing down to think, I can't find an example where the original MPTC is any good and it should thus receive a compile time error. Perhaps someone will come along and give a legitimate example. Thomas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Threads not running under GHC 6.10?
Gwern Branwen wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 So, the Hint library was recently updated and I was editing Mueval to run with (i386) 6.10, when I discovered that for some reason, DoS'ing expressions were succeeding in rendering my machine unusable. Eventually, I discovered that my watchdog thread didn't seem to be running. But with +RTS -N2 -RTS all my tests did pass! Here's a simple example of what I mean; the following is basically a very lightly adapted version of the actual Mueval code: - import Control.Concurrent (forkIO, killThread, myThreadId, threadDelay, throwTo, yield, ThreadId) import System.Posix.Signals (sigXCPU, installHandler, Handler(CatchOnce)) import Control.OldException (Exception(ErrorCall)) main :: IO () main = do tid ThreadId - IO () watchDog tout tid = do installHandler sigXCPU (CatchOnce $ throwTo tid $ ErrorCall Time limit exceeded.) Nothing forkIO $ do threadDelay (tout * 10) -- Time's up. It's a good day to die. throwTo tid (ErrorCall Time limit exceeded) yield -- give the other thread a chance killThread tid -- Die now, srsly. error Time expired return () -- Never reached. Either we error out in -- watchDog, or the evaluation thread finishes. This particular example illustrates a bug in 6.10.1 that we've since fixed: http://hackage.haskell.org/trac/ghc/ticket/2783 However in general you can still write expressions that don't allocate anything (e.g. nfib 1000), and your watchdog thread won't get a chance to run unless there's a spare CPU available (+RTS -N2). Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
On Sun, 14 Dec 2008, Don Stewart wrote: I noticed a new haskell logo idea on a tshirt today, http://image.spreadshirt.net/image-server/image/configuration/13215127/producttypecolor/2/type/png Simple, clean and *pure*. Instead of the we got lots going on of the current logo. Call me conservative, but I like the current logo more than the new suggestions. Why isn't it shown big on the welcome page of haskell.org? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
Looks, good, actually among the top of the ones I like, should we not have some kind of voting mechanism for selecting a logo? And also some kind of last date for when entries are accepted.. Of course this requires a call for logos and so forth. 2008/12/15 Jeff Heard jefferson.r.he...@gmail.com: My entry... 2008/12/15 Martin DeMello martindeme...@gmail.com: Something incorporating λ∀ perhaps martin ___ 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 -- Patience is the last resort for those unable to take action ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
So far this one is still the best, although the kerning between the s and the k seems off, so that would need fixing first. In terms of slogan purely functional, lazy with class, or lazy. pure. functional. look ok. The rest, not so much. 2008/12/14 Don Stewart d...@galois.com: I noticed a new haskell logo idea on a tshirt today, http://image.spreadshirt.net/image-server/image/configuration/13215127/producttypecolor/2/type/png Simple, clean and *pure*. Instead of the we got lots going on of the current logo. Any graphic designers want to try some variations on this theme of purity? A new year, and a new mature logo... -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Push the envelope. Watch it bend. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Multi-parameter type class woes
Alexander Dunlap wrote: On Sun, Dec 14, 2008 at 8:10 PM, Mario Blažević mblaze...@stilo.com wrote: I'll take a swing at this one: instance Container (Maybe x) [x] where wrapper = isNothing . . . That isn't a sensible definition of 'wrapper', but I believe without trying to compile it is completely legal. Which wrapper do you use? You /don't/ have a different matching Container instance, but without the functional dependency you /might/, and ghc barfs. But liftWrap doesn't require any particular instance, it's a generic function accepting any pair of types for which there is an instance of Container. Instance selection (as I understand it) shouldn't come into play until one applies liftWrap to a particular type, and indeed it does cause problems there: note the type annotations on the last line. That part I understand and accept, or at least have learned to live with. The problem is that y is not mentioned in the signature of wrapper. When you call wrapper x, there could be many different instances of Container x y with the same x, so GHC doesn't know which version to call. I guess I see it now. However, if the explicit 'Container x y =' context couldn't fix the y to use for instantiation of Container x y, I don't see any way to fix it. And if there is no way to call wrapper in any context, the class declaration itself is illegal and GHC should have reported the error much sooner. Should I create a ticket? You can fix this problem either by adding a functional dependency or by splitting wrapper out into its own class (Wrapper x, e.g.) so all of the type variables in the class head are mentioned in its type and the instance can be determined by the call. Thanks for asking this question, by the way. I had known about this issue but had never really realized why it happened. Now that I have thought about it, I understand it too. :) Hope that helps, Alex ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
One more concept. attachment: haskell_infinitylambda_logo.svgattachment: haskell_infinitylambda.svgattachment: haskell_infinitylambda.png___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
And anyone who does a version, place put it on the wiki. It'll be lost if you only post to the list. I propose we gather submissions and vote on the best for a new logo in 2009. -- Don nominolo: So far this one is still the best, although the kerning between the s and the k seems off, so that would need fixing first. In terms of slogan purely functional, lazy with class, or lazy. pure. functional. look ok. The rest, not so much. 2008/12/14 Don Stewart d...@galois.com: I noticed a new haskell logo idea on a tshirt today, http://image.spreadshirt.net/image-server/image/configuration/13215127/producttypecolor/2/type/png Simple, clean and *pure*. Instead of the we got lots going on of the current logo. Any graphic designers want to try some variations on this theme of purity? A new year, and a new mature logo... -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Push the envelope. Watch it bend. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
On 15 Dec 2008, at 12:43, Henning Thielemann wrote: On Sun, 14 Dec 2008, Don Stewart wrote: I noticed a new haskell logo idea on a tshirt today, http://image.spreadshirt.net/image-server/image/configuration/13215127/producttypecolor/2/type/png Simple, clean and *pure*. Instead of the we got lots going on of the current logo. Call me conservative, but I like the current logo more than the new suggestions. Why isn't it shown big on the welcome page of haskell.org? Are you referring to this logo? inline: Haskell.png In which case, it is shown on Haskell.org, unless there's another logo that I don't know about? Personally, this logo I find cluttered, and complicated, which I suspect conveys something to people thinking about using Haskell. Bob___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Missing comment highlighting in vim syntax script
On 14 dec 2008, at 19:04, Claus Reinke wrote: The Haskell syntax script for vim mentions this mailing list as the maintainer. Perhaps one of you could fix this bug. Comments on the same line as import declarations don't get highlighted: I don't know how this list-as-maintainer idea is going to work, but the fix seems straightforward: find the line in $VIMRUNTIME/ syntax/haskell.vim that says syn match hsImport \import\.*he=s+6 contains=hsImportMod and change it to syn match hsImport \import\.*he=s+6 contains=hsImportMod,hsLineComment,hsBlockComment See :help syn-contains. Good fix. Have also modified my copy and forwarded the patch to the vim maintainer. With kind regards, Arthur van Leeuwen. -- Arthur van Leeuwen arthu...@cs.uu.nl ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo? - Haskell logo as a stamp!
On Mon, 15 Dec 2008, Don Stewart wrote: And anyone who does a version, place put it on the wiki. It'll be lost if you only post to the list. I propose we gather submissions and vote on the best for a new logo in 2009. Whatever logo someone prefers: I have written a program using HPDF which creates stamps for the German post (see http://www.internetmarke.de/) with custom images: http://code.haskell.org/~thielema/internetmarke/ It needs a bit generalization, though, and will then be uploaded to Hackage, of course. So a dedicated Haskell stamp is close to German Haskell users! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ICFP09 Call for Papers
Call for Papers ICFP 2009: International Conference on Functional Programming Edinburgh, Scotland, 31 August - 2 September 2009 http://www.cs.nott.ac.uk/~gmh/icfp09.html ** Submission deadline: 2 March 2009 ** (submission deadline is earlier than usual) ICFP 2009 seeks original papers on the art and science of functional programming. Submissions are invited on all topics from principles to practice, from foundations to features, from abstraction to application. The scope includes all languages that encourage functional programming, including both purely applicative and imperative languages, as well as languages with objects or concurrency. Particular topics of interest include * Language Design: type systems; concurrency and distribution; modules; components and composition; metaprogramming; relations to object-oriented or logic programming; interoperability * Implementation: abstract machines; compilation; compile-time and run-time optimization; memory management; multi-threading; exploiting parallel hardware; interfaces to foreign functions, services, components or low-level machine resources * Software-Development Techniques: algorithms and data structures; design patterns; specification; verification; validation; proof assistants; debugging; testing; tracing; profiling * Foundations: formal semantics; lambda calculus; rewriting; type theory; monads; continuations; control; state; effects * Transformation and Analysis: abstract interpretation; partial evaluation; program transformation; program calculation; program proof * Applications and Domain-Specific Languages: symbolic computing; formal-methods tools; artificial intelligence; systems programming; distributed-systems and web programming; hardware design; databases; XML processing; scientific and numerical computing; graphical user interfaces; multimedia programming; scripting; system administration; security; education * Functional Pearls: elegant, instructive, and fun essays on functional programming The conference also solicits Experience Reports, which are short papers that provide evidence that functional programming really works or describe obstacles that have kept it from working in a particular application. What's different this year? ~~~ * The conference dates and the submission deadline are about one month earlier than usual. * Special 'Call for Experience Reports' page, suitable as a target for posts on blogs and social networks to reach practitioners who wouldn't normally think about submitting to a conference. If you have a blog, etc., please help by pointing your readers to: http://web.cecs.pdx.edu/~apt/icfp09_cfer.html Instructions for authors By Monday, 2 March 2009, 20:00 UTC, submit an abstract of at most 300 words and a full paper of at most 12 pages (4 pages for an Experience Report), including bibliography and figures. The deadline will be strictly enforced and papers exceeding the page limits will be summarily rejected. Authors have the option to attach supplementary material to a submission, on the understanding that reviewers may choose not to look at it. A submission will be evaluated according to its relevance, correctness, significance, originality, and clarity. It should explain its contributions in both general and technical terms, clearly identifying what has been accomplished, explaining why it is significant, and comparing it with previous work. The technical content should be accessible to a broad audience. Functional Pearls and Experience Reports are separate categories of papers that need not report original research results and must be marked as such at the time of submission. Detailed guidelines on both categories are below. Each submission must adhere to SIGPLAN's republication policy, as explained on the web. Violation risks summary rejection of the offending submission. Proceedings will be published by ACM Press. Authors of accepted submissions are expected to transfer the copyright to ACM. Presentations will be videotaped and released online if the presenter consents by signing an additional permission form at the time of the presentation. Released videos will be included along with the conference proceedings in the ACM Digital Library and may also be placed on a host such as YouTube or Google Video. Formatting: ~~~ Submissions must be in PDF format printable in black and white on US Letter sized paper and interpretable by Ghostscript. If this requirement is a hardship, make contact with the program chair at least one week before the deadline. ICFP proceedings are printed in black and white. It is permissible to include color in a submission, but you risk annoying
Re: [Haskell-cafe] Time for a new logo?
If there is someone interested in playing around with the logo Don posted, I made a gimp-version out of it. http://frosch03.de/haskell/Haskell.xcf http://frosch03.de/haskell/Haskell.png -- Matthias ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
Could you upload it to the logo contest page: http://haskell.org/haskellwiki/Haskell_logos/New_logo_ideas jefferson.r.heard: My entry... 2008/12/15 Martin DeMello martindeme...@gmail.com: Something incorporating λ∀ perhaps martin ___ 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
[Haskell-cafe] haskell compiler never comes back
Haskellians, The simple-minded and smallish code sample at this linkhttp://paste.pocoo.org/show/95503/causes the compiler to go off into never-never land. Any clues would be greatly appreciated. Best wishes, --greg -- L.G. Meredith Managing Partner Biosimilarity LLC 806 55th St NE Seattle, WA 98105 +1 206.650.3740 http://biosimilarity.blogspot.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Data.List.Split
On Mon, 2008-12-15 at 08:40 +, Neil Mitchell wrote: That can only be a bug in stream fusion - concatMap should always be prefered! Yes, but it is unclear from the article whether the concatMap (w/ stream fusion enabled) is Data.List.Stream's concatMap or the Prelude's concatMap. It's only a bug in the former case :) - George signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
Don Stewart wrote: I noticed a new haskell logo idea on a tshirt today, http://image.spreadshirt.net/image-server/image/configuration/13215127/producttypecolor/2/type/png Simple, clean and *pure*. Instead of the we got lots going on of the current logo. Any graphic designers want to try some variations on this theme of purity? A new year, and a new mature logo... Well overdue, IMHO. I showed the current logo to Mr C++ (who, obviously, is slightly biased). To him, apparently, the current logo says Haskell is all about arcane and obscure mathematical constructs. In fact, we think that complicated mathematics is so good that we stuffed our logo full of it. If you don't like hard math, don't even bother trying to learn this language. Obviously, that's a rather negative image to be projecting. And obviously, his opinion is biased. To me, the logo just looks a) rather cluttered, and b) home-made. It doesn't have that professional glitter to it. (I have no idea how to fix that though - maybe ask a professional??) I see lots of people posting various logos, but they all seem to consist essentially of a lambda and the word Haskell. I guess it depends on what you want from a logo. Is our logo going to be just a lambda symbol in a specific typeface with specific colours? Or do we want something more particular? (Looking at what other languages have... well Ruby has a gemstone. Duh. And Python has two snakes nicely stylised. Oh well!) But yeah, certainly I think having a neat T-shirt to wear would be fun! (Note that the lambda was the symbol for the LGBT folks though!) (Actually, just noticing... Ruby's front page says Hello World is trivial - here it is! We can do that too, eh?) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: haskell compiler never comes back
Haskellians, An even simpler version http://paste.pocoo.org/show/95518/ that reveals the issue. i'm astounded that the compiler literally just hangs. Best wishes, --greg On Mon, Dec 15, 2008 at 12:23 PM, Greg Meredith lgreg.mered...@biosimilarity.com wrote: Haskellians, The simple-minded and smallish code sample at this linkhttp://paste.pocoo.org/show/95503/causes the compiler to go off into never-never land. Any clues would be greatly appreciated. Best wishes, --greg -- L.G. Meredith Managing Partner Biosimilarity LLC 806 55th St NE Seattle, WA 98105 +1 206.650.3740 http://biosimilarity.blogspot.com -- L.G. Meredith Managing Partner Biosimilarity LLC 806 55th St NE Seattle, WA 98105 +1 206.650.3740 http://biosimilarity.blogspot.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: haskell compiler never comes back
George, Thanks for the response. If i take out the AllowUndecidableInstances i get no complaints and the compiler hangs. See thishttp://paste.pocoo.org/show/95523/. Thus, i can find no observable difference for this flag in this particular code sample. Best wishes, --greg On Mon, Dec 15, 2008 at 2:34 PM, George Pollard por...@porg.es wrote: This is precisely what AllowUndecidableInstances allows; the type checking becomes possibly non-terminating. It should *eventually* terminate because the stack depth is restricted. - George -- L.G. Meredith Managing Partner Biosimilarity LLC 806 55th St NE Seattle, WA 98105 +1 206.650.3740 http://biosimilarity.blogspot.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: haskell compiler never comes back
Am Montag, 15. Dezember 2008 23:16 schrieb Greg Meredith: Haskellians, An even simpler version http://paste.pocoo.org/show/95518/ that reveals the issue. i'm astounded that the compiler literally just hangs. Best wishes, --greg On Mon, Dec 15, 2008 at 12:23 PM, Greg Meredith lgreg.mered...@biosimilarity.com wrote: Haskellians, The simple-minded and smallish code sample at this linkhttp://paste.pocoo.org/show/95503/causes the compiler to go off into never-never land. Any clues would be greatly appreciated. Best wishes, --greg I can't confirm it, with 6.8.3: $ ghc -O2 --make Monoidal.hs [1 of 1] Compiling Monoidal ( Monoidal.hs, Monoidal.o ) Monoidal.hs:110:11: Couldn't match expected type `i1' against inferred type `Isomorpism (HFTensorExpr a i) a' `i1' is a rigid type variable bound by the instance declaration at Monoidal.hs:103:42 In the expression: (PutIn (\ a - (HFTLVal a))) In the third argument of `HFTExpr', namely `[(PutIn (\ a - (HFTLVal a)))]' In the expression: (HFTExpr (HFTLVal a) (HFTRVal b) [(PutIn (\ a - (HFTLVal a)))] [(PutIn (\ b - (HFTRVal b)))]) $ and the earlier version: $ ghc -O2 --make Monoidal2.hs [1 of 1] Compiling Monoidal2( Monoidal2.hs, Monoidal2.o ) Monoidal2.hs:105:18: Couldn't match expected type `HFTensorExpr a i' against inferred type `[i1] - [i1] - HFTensorExpr a i1' In the expression: HFTExpr (HFTLVal a) (HFTRVal b) In the definition of `tMult': a tMult b = HFTExpr (HFTLVal a) (HFTRVal b) In the definition for method `tMult' Monoidal2.hs:122:10: Couldn't match expected type `[]' against inferred type `++ msa' Expected type: [i] Inferred type: ++ msa msb In the third argument of `HFTExpr', namely `((Shuffle (\ (HFTExpr (HFTExpr u v msu msv) w msuv msw) - (tAssoc (HFTExpr (HFTExpr u v msu msv) w msuv msw :: msa ++ msb)' In the expression: (HFTExpr (HFTExpr a b msa msb) c ((Shuffle (\ (HFTExpr (HFTExpr u v msu msv) w msuv msw) - (tAssoc (HFTExpr (HFTExpr u v msu msv) w msuv msw :: msa ++ msb) msc) Monoidal2.hs:139:10: Couldn't match expected type `[]' against inferred type `++ msl' Expected type: [i] Inferred type: ++ msl msr In the third argument of `HFTExpr', namely `((Shuffle (\ (HFTExpr (HFTExpr a b msa msb) c msab msc) - (tAssoc (HFTExpr (HFTExpr a b msa msb) c msab msc :: msl ++ msr)' In the expression: (HFTExpr (HFTExpr l r msl msr) (HFTRVal b) ((Shuffle (\ (HFTExpr (HFTExpr a b msa msb) c msab msc) - (tAssoc (HFTExpr (HFTExpr a b msa msb) c msab msc :: msl ++ msr) [(PutIn (\ b - (HFTRVal b)))]) Monoidal2.hs:150:11: Couldn't match expected type `i1' against inferred type `Isomorpism (HFTensorExpr a i) a' `i1' is a rigid type variable bound by the instance declaration at Monoidal2.hs:103:42 In the expression: (PutIn (\ a - (HFTRVal a))) In the third argument of `HFTExpr', namely `[(PutIn (\ a - (HFTRVal a)))]' In the expression: (HFTExpr (HFTLVal a) (HFTRVal b) [(PutIn (\ a - (HFTRVal a)))] [(PutIn (\ b - (HFTRVal b)))]) $ No hang, which compiler version did you use? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: haskell compiler never comes back
Daniel, Thanks. i'm using GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude :l monoidal.hs [1 of 1] Compiling Monoidal ( monoidal.hs, interpreted ) C-c C-cInterrupted. :q Best wishes, --greg On Mon, Dec 15, 2008 at 2:50 PM, Daniel Fischer daniel.is.fisc...@web.dewrote: Am Montag, 15. Dezember 2008 23:16 schrieb Greg Meredith: Haskellians, An even simpler version http://paste.pocoo.org/show/95518/ that reveals the issue. i'm astounded that the compiler literally just hangs. Best wishes, --greg On Mon, Dec 15, 2008 at 12:23 PM, Greg Meredith lgreg.mered...@biosimilarity.com wrote: Haskellians, The simple-minded and smallish code sample at this linkhttp://paste.pocoo.org/show/95503/causes the compiler to go off into never-never land. Any clues would be greatly appreciated. Best wishes, --greg I can't confirm it, with 6.8.3: $ ghc -O2 --make Monoidal.hs [1 of 1] Compiling Monoidal ( Monoidal.hs, Monoidal.o ) Monoidal.hs:110:11: Couldn't match expected type `i1' against inferred type `Isomorpism (HFTensorExpr a i) a' `i1' is a rigid type variable bound by the instance declaration at Monoidal.hs:103:42 In the expression: (PutIn (\ a - (HFTLVal a))) In the third argument of `HFTExpr', namely `[(PutIn (\ a - (HFTLVal a)))]' In the expression: (HFTExpr (HFTLVal a) (HFTRVal b) [(PutIn (\ a - (HFTLVal a)))] [(PutIn (\ b - (HFTRVal b)))]) $ and the earlier version: $ ghc -O2 --make Monoidal2.hs [1 of 1] Compiling Monoidal2( Monoidal2.hs, Monoidal2.o ) Monoidal2.hs:105:18: Couldn't match expected type `HFTensorExpr a i' against inferred type `[i1] - [i1] - HFTensorExpr a i1' In the expression: HFTExpr (HFTLVal a) (HFTRVal b) In the definition of `tMult': a tMult b = HFTExpr (HFTLVal a) (HFTRVal b) In the definition for method `tMult' Monoidal2.hs:122:10: Couldn't match expected type `[]' against inferred type `++ msa' Expected type: [i] Inferred type: ++ msa msb In the third argument of `HFTExpr', namely `((Shuffle (\ (HFTExpr (HFTExpr u v msu msv) w msuv msw) - (tAssoc (HFTExpr (HFTExpr u v msu msv) w msuv msw :: msa ++ msb)' In the expression: (HFTExpr (HFTExpr a b msa msb) c ((Shuffle (\ (HFTExpr (HFTExpr u v msu msv) w msuv msw) - (tAssoc (HFTExpr (HFTExpr u v msu msv) w msuv msw :: msa ++ msb) msc) Monoidal2.hs:139:10: Couldn't match expected type `[]' against inferred type `++ msl' Expected type: [i] Inferred type: ++ msl msr In the third argument of `HFTExpr', namely `((Shuffle (\ (HFTExpr (HFTExpr a b msa msb) c msab msc) - (tAssoc (HFTExpr (HFTExpr a b msa msb) c msab msc :: msl ++ msr)' In the expression: (HFTExpr (HFTExpr l r msl msr) (HFTRVal b) ((Shuffle (\ (HFTExpr (HFTExpr a b msa msb) c msab msc) - (tAssoc (HFTExpr (HFTExpr a b msa msb) c msab msc :: msl ++ msr) [(PutIn (\ b - (HFTRVal b)))]) Monoidal2.hs:150:11: Couldn't match expected type `i1' against inferred type `Isomorpism (HFTensorExpr a i) a' `i1' is a rigid type variable bound by the instance declaration at Monoidal2.hs:103:42 In the expression: (PutIn (\ a - (HFTRVal a))) In the third argument of `HFTExpr', namely `[(PutIn (\ a - (HFTRVal a)))]' In the expression: (HFTExpr (HFTLVal a) (HFTRVal b) [(PutIn (\ a - (HFTRVal a)))] [(PutIn (\ b - (HFTRVal b)))]) $ No hang, which compiler version did you use? -- L.G. Meredith Managing Partner Biosimilarity LLC 806 55th St NE Seattle, WA 98105 +1 206.650.3740 http://biosimilarity.blogspot.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: haskell compiler never comes back
Daniel, BTW, if i comment out the version of PutIn that calls HF{L,R}Val and put in the unit, instead, i see the complaint you're seeing. i'll upgrade ghc. Best wishes, --greg On Mon, Dec 15, 2008 at 2:49 PM, Greg Meredith lgreg.mered...@biosimilarity.com wrote: Daniel, Thanks. i'm using GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude :l monoidal.hs [1 of 1] Compiling Monoidal ( monoidal.hs, interpreted ) C-c C-cInterrupted. :q Best wishes, --greg On Mon, Dec 15, 2008 at 2:50 PM, Daniel Fischer daniel.is.fisc...@web.dewrote: Am Montag, 15. Dezember 2008 23:16 schrieb Greg Meredith: Haskellians, An even simpler version http://paste.pocoo.org/show/95518/ that reveals the issue. i'm astounded that the compiler literally just hangs. Best wishes, --greg On Mon, Dec 15, 2008 at 12:23 PM, Greg Meredith lgreg.mered...@biosimilarity.com wrote: Haskellians, The simple-minded and smallish code sample at this linkhttp://paste.pocoo.org/show/95503/causes the compiler to go off into never-never land. Any clues would be greatly appreciated. Best wishes, --greg I can't confirm it, with 6.8.3: $ ghc -O2 --make Monoidal.hs [1 of 1] Compiling Monoidal ( Monoidal.hs, Monoidal.o ) Monoidal.hs:110:11: Couldn't match expected type `i1' against inferred type `Isomorpism (HFTensorExpr a i) a' `i1' is a rigid type variable bound by the instance declaration at Monoidal.hs:103:42 In the expression: (PutIn (\ a - (HFTLVal a))) In the third argument of `HFTExpr', namely `[(PutIn (\ a - (HFTLVal a)))]' In the expression: (HFTExpr (HFTLVal a) (HFTRVal b) [(PutIn (\ a - (HFTLVal a)))] [(PutIn (\ b - (HFTRVal b)))]) $ and the earlier version: $ ghc -O2 --make Monoidal2.hs [1 of 1] Compiling Monoidal2( Monoidal2.hs, Monoidal2.o ) Monoidal2.hs:105:18: Couldn't match expected type `HFTensorExpr a i' against inferred type `[i1] - [i1] - HFTensorExpr a i1' In the expression: HFTExpr (HFTLVal a) (HFTRVal b) In the definition of `tMult': a tMult b = HFTExpr (HFTLVal a) (HFTRVal b) In the definition for method `tMult' Monoidal2.hs:122:10: Couldn't match expected type `[]' against inferred type `++ msa' Expected type: [i] Inferred type: ++ msa msb In the third argument of `HFTExpr', namely `((Shuffle (\ (HFTExpr (HFTExpr u v msu msv) w msuv msw) - (tAssoc (HFTExpr (HFTExpr u v msu msv) w msuv msw :: msa ++ msb)' In the expression: (HFTExpr (HFTExpr a b msa msb) c ((Shuffle (\ (HFTExpr (HFTExpr u v msu msv) w msuv msw) - (tAssoc (HFTExpr (HFTExpr u v msu msv) w msuv msw :: msa ++ msb) msc) Monoidal2.hs:139:10: Couldn't match expected type `[]' against inferred type `++ msl' Expected type: [i] Inferred type: ++ msl msr In the third argument of `HFTExpr', namely `((Shuffle (\ (HFTExpr (HFTExpr a b msa msb) c msab msc) - (tAssoc (HFTExpr (HFTExpr a b msa msb) c msab msc :: msl ++ msr)' In the expression: (HFTExpr (HFTExpr l r msl msr) (HFTRVal b) ((Shuffle (\ (HFTExpr (HFTExpr a b msa msb) c msab msc) - (tAssoc (HFTExpr (HFTExpr a b msa msb) c msab msc :: msl ++ msr) [(PutIn (\ b - (HFTRVal b)))]) Monoidal2.hs:150:11: Couldn't match expected type `i1' against inferred type `Isomorpism (HFTensorExpr a i) a' `i1' is a rigid type variable bound by the instance declaration at Monoidal2.hs:103:42 In the expression: (PutIn (\ a - (HFTRVal a))) In the third argument of `HFTExpr', namely `[(PutIn (\ a - (HFTRVal a)))]' In the expression: (HFTExpr (HFTLVal a) (HFTRVal b) [(PutIn (\ a - (HFTRVal a)))] [(PutIn (\ b - (HFTRVal b)))]) $ No hang, which compiler version did you use? -- L.G. Meredith Managing Partner Biosimilarity LLC 806 55th St NE Seattle, WA 98105 +1 206.650.3740 http://biosimilarity.blogspot.com -- L.G. Meredith Managing Partner Biosimilarity LLC 806 55th St NE Seattle, WA 98105 +1 206.650.3740 http://biosimilarity.blogspot.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Time for a new logo?
Don Stewart wrote: I noticed a new haskell logo idea on a tshirt today, http://image.spreadshirt.net/image-server/image/configuration/13215127/producttypecolor/2/type/png Simple, clean and *pure*. While lambda in a circle is quite powerful, it's also quite similar to the logo for the rather popular game Half-Life (especially if orange is used). I'm not sure if this is relevant. http://images.google.com/images?q=half+life+logo -Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
mgg: Don Stewart wrote: I noticed a new haskell logo idea on a tshirt today, http://image.spreadshirt.net/image-server/image/configuration/13215127/producttypecolor/2/type/png Simple, clean and *pure*. While lambda in a circle is quite powerful, it's also quite similar to the logo for the rather popular game Half-Life (especially if orange is used). I'm not sure if this is relevant. http://images.google.com/images?q=half+life+logo Haskell and Scheme have been using lambda in a circle for 20+ years, also... -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: haskell compiler never comes back
Am Montag, 15. Dezember 2008 23:49 schrieb Greg Meredith: Daniel, Thanks. i'm using GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Indeed, 6.8.2 hangs here, too. Loading package base ... linking ... done. Prelude :l monoidal.hs [1 of 1] Compiling Monoidal ( monoidal.hs, interpreted ) C-c C-cInterrupted. :q Best wishes, --greg Cheers, Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to think about this? (profiling)
This behaviour by Haskell seems to go against my intuition, I'm sure I just need an update of my intuition ;-) I wanted to improve on the following little example code: foo :: Int - Int foo 0 = 0 foo 1 = 1 foo 2 = 2 foo n = foo (n - 1) + foo (n - 2) + foo (n - 3) This is obviously going to run into problems for large values of `n` so I introduced a state to keep intermediate results in: foo :: Int - State (UArray Int Int) Int foo 0 = return 0 foo 1 = return 1 foo 2 = return 2 foo n = do c - get if (c ! n) /= -1 then return $ c ! n else do r - liftM3 (\ a b c - a + b + c) (foo $ n - 1) (foo $ n - 2) (foo $ n - 3) modify (\ s - s // [(n, r)]) return r Then I added a convenience function and called it like this: createArray :: Int - UArray Int Int createArray n = array (0, n) (zip [0..n] (repeat (-1))) main = do (n:_) - liftM (map read) getArgs print $ evalState (foo n) (createArray n) Then I thought that this still looks pretty deeply recursive, but if I call the function for increasing values of `n` then I'll simply build up the state, sort of like doing a for-loop in an imperative language. I could then end it with a call to `foo n` and be done. I replaced `main` by: main = do (n:_) - liftM (map read) getArgs print $ evalState (mapM_ foo [0..n] foo n) (createArray n) Then I started profiling and found out that the latter version both uses more memory and makes far more calls to `foo`. That's not what I expected! (I suspect there's something about laziness I'm missing.) Anyway, I ran it with `n=35` and got foo n : 202,048 bytes , foo entries 100 mapM_ foo [0..n] foo n : 236,312 , foo entries 135 + 1 How should I think about this in order to predict this behaviour in the future? /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus Haskell is an even 'redder' pill than Lisp or Scheme. -- PaulPotts signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: haskell compiler never comes back
So I retract that email ;) signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
Alvaro's infinity lambda is awesome! The fancy treatments -- shadows, reflections, and the funny haskell font can all go, but the infinity lambda is distinctive, conceptually clear, and conveys the notion that we're not just the lambda calculus, but the lambda calculus to the power of our type system. Speaking of which, maybe the lambda cube could be the basis for a logo? --S ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to think about this? (profiling)
2008/12/16 Magnus Therning mag...@therning.org: This behaviour by Haskell seems to go against my intuition, I'm sure I just need an update of my intuition ;-) I wanted to improve on the following little example code: foo :: Int - Int foo 0 = 0 foo 1 = 1 foo 2 = 2 foo n = foo (n - 1) + foo (n - 2) + foo (n - 3) This is obviously going to run into problems for large values of `n` so I introduced a state to keep intermediate results in: foo :: Int - State (UArray Int Int) Int foo 0 = return 0 foo 1 = return 1 foo 2 = return 2 foo n = do c - get if (c ! n) /= -1 then return $ c ! n else do r - liftM3 (\ a b c - a + b + c) (foo $ n - 1) (foo $ n - 2) (foo $ n - 3) modify (\ s - s // [(n, r)]) return r Then I added a convenience function and called it like this: createArray :: Int - UArray Int Int createArray n = array (0, n) (zip [0..n] (repeat (-1))) main = do (n:_) - liftM (map read) getArgs print $ evalState (foo n) (createArray n) Then I thought that this still looks pretty deeply recursive, but if I call the function for increasing values of `n` then I'll simply build up the state, sort of like doing a for-loop in an imperative language. I could then end it with a call to `foo n` and be done. I replaced `main` by: main = do (n:_) - liftM (map read) getArgs print $ evalState (mapM_ foo [0..n] foo n) (createArray n) Then I started profiling and found out that the latter version both uses more memory and makes far more calls to `foo`. That's not what I expected! (I suspect there's something about laziness I'm missing.) Anyway, I ran it with `n=35` and got foo n : 202,048 bytes , foo entries 100 mapM_ foo [0..n] foo n : 236,312 , foo entries 135 + 1 How should I think about this in order to predict this behaviour in the future? Immutable arrays are duplicated every time you write to them. Making lots of small updates is going to be /very/ expensive. You have the right idea, though. Saving intermediate results is the right thing to do but arrays aren't the right way to do it. In this case, a lazy list will perform much better. ack n = ackList !! n where ackList = 0:1:2:zipWith3 (\a b c - a+b+c) ackList (drop 1 ackList) (drop 2 ackList) -- Cheers, Lemmih ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
On Mon, 2008-12-15 at 18:25 -0500, Sterling Clover wrote: Alvaro's infinity lambda is awesome! The fancy treatments -- shadows, reflections, and the funny haskell font can all go, but the infinity lambda is distinctive, conceptually clear, and conveys the notion that we're not just the lambda calculus, but the lambda calculus to the power of our type system. Speaking of which, maybe the lambda cube could be the basis for a logo? Haskell sits in the middle of one of the faces of the lambda cube, possibly even a bit in the volume, though I don't think so. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Time for a new logo?
okay, I want a t-shirt like this (but with all the greek letters and formatting) back: \t. 2^-t kg is equally[or: sometimes] bothered by math front: \gbtq is [sometimes] bothered by acronyms :-) or, sometimes likes each of them :-) -Isaac ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Multi-parameter type class woes
2008/12/15 Mario Blazevic mblaze...@stilo.com: Alexander Dunlap wrote: On Sun, Dec 14, 2008 at 8:10 PM, Mario Blažević mblaze...@stilo.com wrote: I'll take a swing at this one: instance Container (Maybe x) [x] where wrapper = isNothing . . . That isn't a sensible definition of 'wrapper', but I believe without trying to compile it is completely legal. Which wrapper do you use? You /don't/ have a different matching Container instance, but without the functional dependency you /might/, and ghc barfs. But liftWrap doesn't require any particular instance, it's a generic function accepting any pair of types for which there is an instance of Container. Instance selection (as I understand it) shouldn't come into play until one applies liftWrap to a particular type, and indeed it does cause problems there: note the type annotations on the last line. That part I understand and accept, or at least have learned to live with. The problem is that y is not mentioned in the signature of wrapper. When you call wrapper x, there could be many different instances of Container x y with the same x, so GHC doesn't know which version to call. I guess I see it now. However, if the explicit 'Container x y =' context couldn't fix the y to use for instantiation of Container x y, I don't see any way to fix it. And if there is no way to call wrapper in any context, the class declaration itself is illegal and GHC should have reported the error much sooner. Should I create a ticket? You can fix this problem either by adding a functional dependency or by splitting wrapper out into its own class (Wrapper x, e.g.) so all of the type variables in the class head are mentioned in its type and the instance can be determined by the call. Thanks for asking this question, by the way. I had known about this issue but had never really realized why it happened. Now that I have thought about it, I understand it too. :) Hope that helps, Alex I think that http://www.haskell.org/pipermail/haskell-cafe/2008-April/041461.html may be relevant. It's a design decision. Alex ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Minimal complete definitions
Good afternoon Café, I've written a little bit of code to calculate minimal complete definitions for a class given which of its functions use which other functions. As an example: doDependencies ord = ([],[[=],[compare]]) doDependencies num = ([plus,times,abs,signum,fromInteger],[[minus],[negate]]) The first part of the pair is those functions which must *always* be implemented, the second part is a list of possible minimal complete definitions available for the provided list. This can help catch mistakes; a comment in the GHC source for GHC.Classes notes that compare must be implemented using (=) and not () in order to give the minimal complete definition (= OR compare). If we use the incorrect () then my code calculates the MCD as: doDependencies wrongOrd = ([],[[],[,=,compare],[compare]]) That is, the MCD is ( OR ( AND = AND compare) OR compare). Now I have two questions: 1) Is my code correct? ;) 2) Could this be incorporated into GHC in order to detect when someone hasn't provided a sufficient definition for a class? As an example, it could detect this: ~$ cat test2.hs data Die d = Die d instance Eq (Die d) where main = do let i = Die stack overflow print (i == i) ~$ ghc -Wall test2.hs --make ~$ ./test2 Stack space overflow: current size 8388608 bytes. Use `+RTS -Ksize' to increase it. Given the following: doDependencies [(==, Just [/=]),(/=, Just [==])] = ([],[[/=],[==]]) GHC could warn that either (==) or (/=) must be implemented. Thanks, - George signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Minimal complete definitions
Code might help :P import qualified Data.Set as Set import Data.Set (Set) import Data.List (partition,delete) import Data.Maybe (isJust,fromJust) -- A snippet for working out minimal complete definitions. num = [ (plus,Nothing), (times,Nothing), (abs,Nothing), (minus,Just [negate]), (negate,Just [minus]), (signum,Nothing), (fromInteger,Nothing) ] ord = [ (compare,Just [=]), (,Just [compare]), (=,Just [compare]), (,Just [compare]), (=,Just [compare]), (max,Just [=]), (min,Just [=]) ] -- a nice example from a comment in GHC's GHC.Classes wrongOrd = [ (compare,Just []), (,Just [compare]), (=,Just [compare]), (,Just [compare]), (=,Just [compare]), (max,Just [=]), (min,Just [=]) ] -- given a list of: -- (thing, depends upon) -- * depends upon can be Nothing if no implementation is defined (i.e. -- you *always* have to implement it -- * depends upon can be Just [] if the implementation depends on nothing else -- * otherwise the depends upon is Just [a] where it lists the things it depends upon -- -- returns: -- (a list of what you must always implement, and lists of minimal dependencies) -- doDependencies :: [(a, Maybe [a])] - (a,[[a]]) doDependencies xs = (mustImplementNames,Set.toList . Set.fromList $ map (Set.toList . Set.fromList) $ doDependencies' maybeImplement'') where (maybeImplement,mustImplement) = partition (isJust . snd) xs mustImplementNames = map fst mustImplement maybeImplement' = map (\(x,y)-(x,fromJust y)) maybeImplement maybeImplement'' = foldr eliminateDepends maybeImplement' mustImplementNames eliminateDepends :: (Ord a, Eq a) = a - [(a,[a])] - [(a,[a])] eliminateDepends x xs | null removeUs = stillHere | otherwise = foldr eliminateDepends stillHere (map fst removeUs) where (removeUs,stillHere) = partition (null . snd) $ map (\(it,depends) - (it, delete x depends)) xs doDependencies' :: (Ord a, Eq a) = [(a,[a])] - [[a]] doDependencies' eqs = dd eqs [] where dd [] solution = [solution] dd eqs solution = [concat $ dd (eliminateDepends dependency eqs) (dependency:solution) |dependency-rhs] where rhs = concatMap snd eqs signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Minimal complete definitions
Sorry about the triple-post, but I forgot to note it only goes to one 'depth' of OR; in reality the MCD for wrongOrd should be ( OR ((=) AND (compare OR )) OR compare). This requires a slightly more complicated type than [[a]] :) signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Multi-parameter type class woes
I think that http://www.haskell.org/pipermail/haskell-cafe/2008-April/041461.html may be relevant. It's a design decision. Thanks for the link. I've read through the thread, but rather than try to figure out if it's the same issue and whether it's a design decision or a historical accident, I've decided to create a ticket (#2885) and let GHC developers decide if it's valid or not. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe