Re: [Haskell-cafe] How to do the permutation and combination thing?
Casey Hawthorne cas...@istar.ca writes: For example, I have this: list1 = [a, b, c] list2 = [d, e, f] list3 = [g, h, i] Think in abstract terms what you want to accomplish. A bit more specifically, let's say the input is a list of lists, and you want to produce all combinations of drawing one element from each of the input lists¹: perms :: [[a]] - [[a]] You need to consider two cases, when the input is empty, and when the input contains at least one list of elements: perms (l:ls) = ... perms [] = ... The second case shouldn't be so hard. Now, if you pretend that 'perms' is already implemented, then you can use it to generate all permutations for the tail of the input list. The first case boils down to combining the first input list with all permutations of the rest of the lists: perms (l:ls) = ... l ... perms ls Does this help? -k ¹ Using tuples is harder to generalize for length, but nicer typewise, since you'd get something like 'perms :: ([a],[b],..[x]) - [(a,b,..,x)] -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] generalized newtype deriving allows the definition of otherwise undefinable functions
Am Donnerstag, 11. März 2010 00:37:18 schrieb wren ng thornton: Wolfgang Jeltsch wrote: Hello, some time ago, it was pointed out that generalized newtype deriving could be used to circumvent module borders. Now, I found out that generalized newtype deriving can even be used to define functions that would be impossible to define otherwise. To me, this is surprising since I thought that generalized newtype deriving was only intended to save the programmer from writing boilerplate code, not to extend expressiveness. Let's dig down and figure out the problem. When you annotate the type Wrapped a with deriving (Iso a) what are you saying? You're saying that the compiler should derive an instance (Iso a (Wrapped a)). Well, that instance gives you the method instance conv :: forall f. f a - f (Wrapped a). The funny thing is that the only implementation for ---something like--- that type would be fmap Wrap. If the parameter of f is contravariant then we would need a “contraMap”, not an fmap. Example: newtype CoFun a b = CoFun (b - a) class ContraFunctor f where contraMap :: (a - b) - f b - f a instance ContraFunctor (CoFun a) where contraMap f (CoFun g) = CoFun (g . f) coFun :: CoFun Int Char coFun = CoFun ord directlyConverted :: CoFun Int (Wrapped Char) directlyConverted = conv coFun manuallyConverted :: CoFun Int (Wrapped Char) manuallyConverted = contraMap unwrap coFun Here, unwrap is the inverse of Wrap. Let us look at the Set example from John Meacham. Set is a (covariant) functor, not a contravariant functor. However, it isn’t a functor from and to the category of Haskell types and functions but the category of types of class Ord and Ord homomorphisms (functions that respect ordering). The problem in John Meacham’s Set example is that Down doesn’t preserve ordering. If conv is used with a newtype wrapper constructor that does preserve ordering, this is the same as applying Set.map or Set.mapMonotonic. Best wishes, Wolfgang ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)
Note that foldl' has a ' to indicate that it's not the same as foldl exactly. I would propose that sum' exist as well as sum, and that sum be lazy. Well, meaningful identifier names is nice, but I think here we have a case of the code smell type info embedded in the name. Strictness of a function should be expressed in the function's type instead. But that seems impossible with Haskell at the moment. (At best, we can express strictness of constructors?) Hence we have underspecified behaviour: Prelude Data.List :t foldl' foldl' :: (a - b - a) - a - [b] - a Prelude Data.List :t foldl foldl :: (a - b - a) - a - [b] - a and need to resort to the awkward workaround via naming conventions. Of course Haskell implementations do have some kind of strictness information (e.g., in ghc interface files), so it's not impossible to define some kind of annotation system. Although I did not check what the compiler's strictness info is for foldl and fold' - and what was actually needed (at the source level). The current textual definition (Data.List API docs: foldl' = a strict version of foldl) is not too precise, either. Well, I guess there's a huge design space. But it's a huge problem (describing/controlling the behaviour of lazy programs). Best - J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)
On Fri, Mar 12, 2010 at 10:29 AM, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote: Well, meaningful identifier names is nice, but I think here we have a case of the code smell type info embedded in the name. Strictness of a function should be expressed in the function's type instead. But that seems impossible with Haskell at the moment. (At best, we can express strictness of constructors?) Hence we have underspecified behaviour: Prelude Data.List :t foldl' foldl' :: (a - b - a) - a - [b] - a Prelude Data.List :t foldl foldl :: (a - b - a) - a - [b] - a Even if we had a syntax to express that the function is strict, wouldn't we still need two distinct function names for the strict and lazy case ? In that case, some sort of convention on naming is nice, because if I want to change a function to its strict version, I know there's a good chance it's the one that ends with a ' David. and need to resort to the awkward workaround via naming conventions. Of course Haskell implementations do have some kind of strictness information (e.g., in ghc interface files), so it's not impossible to define some kind of annotation system. Although I did not check what the compiler's strictness info is for foldl and fold' - and what was actually needed (at the source level). The current textual definition (Data.List API docs: foldl' = a strict version of foldl) is not too precise, either. Well, I guess there's a huge design space. But it's a huge problem (describing/controlling the behaviour of lazy programs). Best - J.W. ___ 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] Hackaton: A roof to stay
Hello, im planing on going to the hackaton, but the prices in Zurich are unusually high for my tight budget, so i was wondering if there is anyone here that lives there and would allow me to sleep on their couch or on the floor during the hackaton. Is there ? Thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackaton: A roof to stay
Forwarding this to the hackathon mailing list as most people going to ZuriHac (including some locals) are on that list. On Fri, Mar 12, 2010 at 11:09 AM, Hugo Gomes mr.hugo.go...@gmail.comwrote: Hello, im planing on going to the hackaton, but the prices in Zurich are unusually high for my tight budget, so i was wondering if there is anyone here that lives there and would allow me to sleep on their couch or on the floor during the hackaton. Is there ? Thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: If wishes were horses...
Johannes Waldmann waldm...@imn.htwk-leipzig.de writes: Well, meaningful identifier names is nice, but I think here we have a case of the code smell type info embedded in the name. Strictness of a function should be expressed in the function's type instead. I've stumbled into this sentiment before, and it's one of those I must be dumb because everybody else takes this for granted-issues.¹ Are there any explanation of how/why this is a type issue? To me it appears natural to use the same higher order functions (say, foldr) with strict operations or lazy ones. OTOH, I can't off-hand think of a reasonable use for foldl or foldr', so you're probably right they should be separated. Prelude Data.List :t foldl' foldl' :: (a - b - a) - a - [b] - a Prelude Data.List :t foldl foldl :: (a - b - a) - a - [b] - a What should the type look like? If memory serves, Clean allows bangs in type signatures, something like: foldl' :: (a - b - a) - !a - [b] - a but I thought it just added a seq under the hood, much like bang patterns like foldl' f !z xs = ... do in Haskell, so it's not like !a is a separate type. Or? Let me explore a bit here. In deference to the time-honored if ill-advised tradition of abusing the apostrophe, let a' be the type a, but strictly evaluated. Perhaps things could look something like: foldl' :: (a' - b' - a) - a' - b (+) :: a' - a' - a -- strict (:) :: a - [a] - [a] -- non-strict foldl' (+) 0 [1..10] -- okay foldl' (flip (:)) [] [1..10] -- illegal Would something like this work? It seems to me that strictness doesn't apply to result types (x `seq` x === x), and you need to track the relationship between a and a', since you probably want to allow a lazy value as e.g. the second parameter of foldl'. I'm sure this has been discussed to death ages ago, is there a simple overview I might understand that discusses or summarizes the issue? -k ¹ As opposed to the everybody else must be dumb, because they disagree with me-issues. Perhaps I can work out my IQ from the ratio? -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)
David Virebayre dav.vire+haskell at gmail.com writes: Even if we had a syntax to express that the function is strict, wouldn't we still need two distinct function names for the strict and lazy case ? OK, I'd like to register a code smell for: hierarchical/systematic structure inside identifier names; suggested refactoring: use hierarchy/structure provided by the language, in this case, something like: Data.List.Strict.fold, Data.List.Lazy.fold Or - if we had static overloading, and strictness info in the type, then we wouldn't need different names. Can of worms ... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: If wishes were horses...
Ketil Malde ketil at malde.org writes: Prelude Data.List :t foldl foldl :: (a - b - a) - a - [b] - a What should the type look like? Good question - and in my posting I tried to avoid the impression that I have an answer, because I really haven't. My suggestion was that some of the annotations that are currently hidden in ghc interface files, could perhaps be lifted to source level (so the programmer can write down the properties she expects). Perhaps an analogy could be mode annotations for Prolog? I agree that this must have been discussed before, and I'd appreciate some pointers. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)
wren I wish Haskell allowed ! to occur (non-initially) in alphanum_' wren identifiers as well as in symbolic ones. Then we could be more wren consistent about having ! mean strictness BTW, does something in haskell syntax prevent '?' from appearing at the end of identifiers ? It is a nice way to name predicates. -- Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)
Am Freitag 12 März 2010 12:14:06 schrieb Paul R: wren I wish Haskell allowed ! to occur (non-initially) in alphanum_' wren identifiers as well as in symbolic ones. Then we could be more wren consistent about having ! mean strictness BTW, does something in haskell syntax prevent '?' from appearing at the end of identifiers ? Yes, http://haskell.org/onlinereport/lexemes.html#sect2 uniSymbol- any Unicode symbol or punctuation Punctuation characters are symbols (as far as the lexical syntax is concerned), hence can't appear in varids, only in varsyms (operators). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)
On Fri, Mar 12, 2010 at 12:01 PM, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote: David Virebayre dav.vire+haskell at gmail.com writes: in this case, something like: Data.List.Strict.fold, Data.List.Lazy.fold But then if you need both version, you will have to import them qualified, which I don't like much. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal and LLVM bindings
Do you happen to use template haskell? It looks like the interpreter is trying to load llvm, which is currently not supported. That doesn't explain why it works with ghc --make though. Do you do anything special in your .cabal file? I do use template haskell for deriving binary instances for some data types and getting proper version tags. But shouldn't touch llvm parts at all. The cabal file is as basic as it gets. If I drop template-haskell (and with it pretty large part of my program) cabal does not complain. LLVM library does not in general work in ghci, but how does this affect cabal? Simple work-around is to make a monolithic .so/dylib out of LLVM and modify LLVM bindings package to use that instead of linking to .a files. (Either by hand or using svn version on llvm that supports ./configure --enable-shared). This is rather lot of work though. Ville On 11 March 2010 12:30, Ville Tirronen alea...@gmail.com wrote: Hi! I'm trying to get cabal build my toy compiler, which is based on llvm bindings on hackage. Everything is fine with ghc --make, but with cabal install I get: Loading package llvm-0.7.1.1 ... command line: can't load .so/.DLL for: LLVMSystem (dlopen(libLLVMSystem.dylib, 9): image not found) cabal: Error: some packages failed to install: QV-0.1 failed during the building phase. The exception was: ExitFailure 1 This is done on os x 10.5.8, if that has any relevance. Anyone got any hints on how to proceed with this? Ville Tirronen ___ 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
[Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)
David Virebayre dav.vire+haskell at gmail.com writes: But then if you need both version, you will have to import them qualified, which I don't like much. solution: type directed name resolution: * either in the language, http://hackage.haskell.org/trac/haskell-prime/wiki/TypeDirectedNameResolution * or, failing that, simulated by a helpful (type and module aware) IDE. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to do the permutation and combination thing?
Hi, Give a try to this library: http://hackage.haskell.org/package/permutation You can construct the combinations with list of indices and then apply it to your sets. []s Victor On Fri, Mar 12, 2010 at 5:16 AM, Ketil Malde ke...@malde.org wrote: Casey Hawthorne cas...@istar.ca writes: For example, I have this: list1 = [a, b, c] list2 = [d, e, f] list3 = [g, h, i] Think in abstract terms what you want to accomplish. A bit more specifically, let's say the input is a list of lists, and you want to produce all combinations of drawing one element from each of the input lists¹: perms :: [[a]] - [[a]] You need to consider two cases, when the input is empty, and when the input contains at least one list of elements: perms (l:ls) = ... perms [] = ... The second case shouldn't be so hard. Now, if you pretend that 'perms' is already implemented, then you can use it to generate all permutations for the tail of the input list. The first case boils down to combining the first input list with all permutations of the rest of the lists: perms (l:ls) = ... l ... perms ls Does this help? -k ¹ Using tuples is harder to generalize for length, but nicer typewise, since you'd get something like 'perms :: ([a],[b],..[x]) - [(a,b,..,x)] -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- GNU/Linux user #446397 - http://counter.li.org ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: If wishes were horses...
On Fri, 12 Mar 2010, Johannes Waldmann wrote: Ketil Malde ketil at malde.org writes: Prelude Data.List :t foldl foldl :: (a - b - a) - a - [b] - a What should the type look like? Good question - and in my posting I tried to avoid the impression that I have an answer, because I really haven't. foldl' :: Seq a = (a - b - a) - a - [b] - a ? I don't think that foldl' is really what we want, since we cannot control the depth of strictness. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: If wishes were horses...
On 12 March 2010 10:38, Ketil Malde ke...@malde.org wrote: What should the type look like? If memory serves, Clean allows bangs in type signatures, something like: foldl' :: (a - b - a) - !a - [b] - a but I thought it just added a seq under the hood, Thats my understanding too. I did look briefly at this, and I *think* its pretty straightforward to have a system of segregated strict and non-strict types, with a type constructor ! which unlifts a non-strict type to a strict one. In this system, the choice of whether to build a thunk at a let binding / application site is made based on the kind of the bound thing. You have a kind system like: k ::= * | ! | k - k (* is standard lifted types, ! is unlifted type) And then the type constructor ! has kind * - !. You have to allow the (-) to have several kinds (a bit of a wart): (-) :: * - * Lazy argument, result is enclosed in a thunk at the call site (unless at focus of evaluation) (-) :: * - ! Lazy argument, result is evaluated eagerly at the call site (-) :: ! - * Strict argument, result is enclosed in a thunk at the call site (unless at focus of evaluation) (-) :: ! - ! Strict argument, result is evaluated eagerly at the call site You can then write signatures like this: eq :: !a - !a - Bool But what do the type quantifiers look like? The only reasonable answer is: eq :: forall (a :: *). !a - !a - Bool Quantifying over type variables of kind * would have to be the default to retain backwards compatibility. This is a bit annoying you will only be able to instantiate any polymorphic Haskell function at lazy types, unless you explicitly wrote it with the strict type signature explicitly. So you need e.g. a strict and a non-strict identity function. This seems to really be necessary because in general the code generated for the two alternatives won't be the same, so to get true strictness polymorphism you need 2^n copies of the code, where n is the number of type variables in the signature. There are probably some tricks you can play to ameliorate this blow up (strictness dictionaries anyone?) but it looks hard. Nonetheless, I think a system with segregated strict/non-strict types could be workable and interesting. I heard tell that JHC may have some prior art in this area.. Cheers, Max ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Cabal dependency hell
On Thu, Mar 11, 2010 at 08:54:15AM -0800, Rogan Creswick wrote: (c) fix the unpacked version, and increment the version number by adding a new level of detail (so, 3.1.0 becomes 3.1.0.1). This version number never leaves my system -- it only exists to keep my cabal/ghc-pkg consistent! A decent approach, except if the library in question is a core package to the compiler or a library that those packages depend on. I suffered some vast destruction doing the above to the Win32 package. Apparently packages like directory depends on this, breaking GHC irrecoverably if you try to propagate fixes. I managed to limp along for a bit with constraints, but ended up wiping the whole install and installing a clean one. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)
On Mar 12, 2010, at 06:01 , Johannes Waldmann wrote: in this case, something like: Data.List.Strict.fold, Data.List.Lazy.fold Or - if we had static overloading, and strictness info in the type, then we wouldn't need different names. Can of worms ... Doesn't help if strictness needs to be controlled at use sites and not at the type level (which is the usual case). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon universityKF8NH 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
[Haskell-cafe] Google Summer of Code 2010.
It is that time of year again; the Google Summer of Code is upon us! *Sign Up Information* If you are a student and want to sign up to make $4,500 for hacking on the code you love over the summer or are willing to help out as a mentor, now is the time to act. Please sign up by adding your name to the list at: http://hackage.haskell.org/trac/summer-of-code/wiki/People2010 I have extracted an initial list of interested mentors from Malcolm's earlier inquiry to the cafe and have submitted our initial application to Google. A strong list of potential mentors and students will help bolster our case. Our main wiki entry for the Summer of Code 2010 is now online: http://hackage.haskell.org/trac/summer-of-code/wiki/Soc2010 If you are interested in applying as a student, here are some guidelines: http://hackage.haskell.org/trac/summer-of-code/wiki/StudApply2010 The official deadline for student applications with Google is April 7th, but if you are interested please add your name to the People2010 page above, as soon as possible. *Interested in helping out, but not sure how? * There are a number of ideas that we've been collecting for projects available through the trac http://hackage.haskell.org/trac/summer-of-code/report/1 and which have been collecting over time in a reddit: http://www.reddit.com/r/haskell_proposals/top/ While the reddit is a great place to discuss proposals, we had to choose one mechanism to supply Google with our ideas officially, so please submit proposals http://hackage.haskell.org/trac/summer-of-code/newticket to the trac if you can think of something you like to work on, or which would be an appropriately beneficial project for a summer worth of work. *Helping Out Darcs * Haskell.org is going to continue to act as an umbrella organization covering darcs http://darcs.net/ for the Summer of Code once more. If you are interested in helping them out, they also have a page full of project ideas as well: http://wiki.darcs.net/GoogleSummerOfCode Again, please submit proposalshttp://hackage.haskell.org/trac/summer-of-code/newticketas tickets to the trac if you can think of something you'd like to work on. *More Information* Here are a bunch of relevant links that may be able to answer your questions: Google's Summer of Code Homepage http://socghop.appspot.com/ Google's Summer of Code 2010 FAQhttp://socghop.appspot.com/document/show/gsoc_program/google/gsoc2010/faqs Google's Summer of Code 2010 Timelinehttp://socghop.appspot.com/document/show/gsoc_program/google/gsoc2010/timeline Google's Summer of Code Wiki Knowledge Basehttp://code.google.com/p/google-summer-of-code/wiki/WikiStart Of course, you can always feel free to email me ekm...@gmail.com or inquire on irc.freenode.net #haskell-soc or with the darcs folks over on #darcs for more information. If you don't have an IRC client, you can get there from: http://webchat.freenode.net Thank you all very much and we look forward to another successful Summer of Code! -Edward Kmett ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] [Haskell.org Google Summer of Code] trac signup issues
It has come to my attention that there is an issue with creating accounts on the summer-of-code trac at the moment. We're diligently working on getting the right people involved to get this fixed. In the meantime, if you want to sign up as a student or mentor for this year's summer of code, please email me with your name and desired contact email address, and I'll make sure your name winds up on the list. I apologize for the inconvenience. -Edward Kmett ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackaton: A roof to stay
im planing on going to the hackaton, but the prices in Zurich are unusually high for my tight budget, so i was wondering if there is anyone here that lives there and would allow me to sleep on their couch or on the floor during the hackaton. Is there ? Just a suggestion: Have you tried one of the couch surfing sites on the web? Matthias. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Upgrading to Haskell Platform
It should not be necessary to uninstall ghc, as hask plat and ghc are orthogonal by design. r Unless there is some gotcha I am unaware of, not being a mac user. You are aware that hask plat is beta though, right? You might be better served simply upgrading your cabal, and waiting for the all-in-one mac packager to be really shiny. You can grab cabal here, and after you have unzipped it run the bootstrap script which also downloads dependencies you might need. cheers. 2010/3/10 David Place d...@vidplace.com: Hi: I am running GHC 6.10.4 on Mac OSX 10.6.2. Somehow, I have a broken version of Cabal (1.6.0.3) installed. In order to fix it, I thought I should just upgrade to the Haskell Platform. Is it necessary to uninstall my current GHC first? If, so, how? Thanks you. Cheers, David ___ 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] Upgrading to Haskell Platform
grab cabal here I mean: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall 2010/3/12 Thomas Hartman tphya...@gmail.com: It should not be necessary to uninstall ghc, as hask plat and ghc are orthogonal by design. r Unless there is some gotcha I am unaware of, not being a mac user. You are aware that hask plat is beta though, right? You might be better served simply upgrading your cabal, and waiting for the all-in-one mac packager to be really shiny. You can grab cabal here, and after you have unzipped it run the bootstrap script which also downloads dependencies you might need. cheers. 2010/3/10 David Place d...@vidplace.com: Hi: I am running GHC 6.10.4 on Mac OSX 10.6.2. Somehow, I have a broken version of Cabal (1.6.0.3) installed. In order to fix it, I thought I should just upgrade to the Haskell Platform. Is it necessary to uninstall my current GHC first? If, so, how? Thanks you. Cheers, David ___ 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] How to do the permutation and combination thing?
There is also polyomino.f2s: http://www.polyomino.f2s.com/david/haskell/combinatorics.html Iirc correctly there is some stuff here that is not on hackage but probably could/should be. 2010/3/12 Victor Mateus Oliveira rhapso...@gmail.com: Hi, Give a try to this library: http://hackage.haskell.org/package/permutation You can construct the combinations with list of indices and then apply it to your sets. []s Victor On Fri, Mar 12, 2010 at 5:16 AM, Ketil Malde ke...@malde.org wrote: Casey Hawthorne cas...@istar.ca writes: For example, I have this: list1 = [a, b, c] list2 = [d, e, f] list3 = [g, h, i] Think in abstract terms what you want to accomplish. A bit more specifically, let's say the input is a list of lists, and you want to produce all combinations of drawing one element from each of the input lists¹: perms :: [[a]] - [[a]] You need to consider two cases, when the input is empty, and when the input contains at least one list of elements: perms (l:ls) = ... perms [] = ... The second case shouldn't be so hard. Now, if you pretend that 'perms' is already implemented, then you can use it to generate all permutations for the tail of the input list. The first case boils down to combining the first input list with all permutations of the rest of the lists: perms (l:ls) = ... l ... perms ls Does this help? -k ¹ Using tuples is harder to generalize for length, but nicer typewise, since you'd get something like 'perms :: ([a],[b],..[x]) - [(a,b,..,x)] -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- GNU/Linux user #446397 - http://counter.li.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] Can't cabal install darcs because hashed-storage needs 'System'
Hello. Short story: $ cabal install --global --constraint=old-time=1.0.0.3.1 --reinstall -v darcs /tmp/hashed-storage-0.4.71127/hashed-storage-0.4.7/Setup.hs:13:7: Could not find module `System': Use -v to see a list of the files searched for. This is using GHC 6.12.1, cabal-install 0.8.0 and Cabal 1.8.0.2 How do I get darcs installed? Longer story: I've been trying to install darcs 2.4 built against a patched version of old- time, 1.0.0.3.1 is effectively 1.0.0.4 just that it's patched locally because 1.0.0.4 hasn't been released to hackage yet. I ran into various problems with global vs. user packages, no version of base being valid and a few other bits and pieces. So I am trying a global install and have had to reinstall Cabal (and various other packages), presumably because it was built against old-time 1.0.0.3. Looking at the hashed-storage code it imports System (system, exitWith). Is that old base-3 code? The debug messages show: selecting base-3.0.3.2 (installed) and 4.2.0.0 (installed) and /usr/local/bin/ghc --make /tmp/hashed-storage-0.4.71127/hashed- storage-0.4.7/Setup.hs -o /tmp/hashed-storage-0.4.71127/hashed- storage-0.4.7/dist/setup/setup -odir /tmp/hashed-storage-0.4.71127/hashed- storage-0.4.7/dist/setup -hidir /tmp/hashed-storage-0.4.71127/hashed- storage-0.4.7/dist/setup -i -i/tmp/hashed-storage-0.4.71127/hashed- storage-0.4.7 -package Cabal-1.8.0.2 so I'm not really sure what version of base it's actually trying to compile hashed-storage against. Any further information I can provide? Thanks Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: attoparsec-iteratee v0.1
Hi all, I've just uploaded the first version of the attoparsec-iteratee library to Hackage: http://hackage.haskell.org/package/attoparsec-iteratee It takes applicative parsers written using attoparsec and automagically converts them to iteratees that can parse things from streams in O(1) space. and the combination is fast: a prototype HTTP server I'm working on uses this library and can handle as many as 13k reqs/sec on my Macbook. G -- Gregory Collins g...@gregorycollins.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] generalized newtype deriving allows the definition of otherwise undefinable functions
Wolfgang Jeltsch wrote: Am Donnerstag, 11. März 2010 00:37:18 schrieb wren ng thornton: Wolfgang Jeltsch wrote: Hello, some time ago, it was pointed out that generalized newtype deriving could be used to circumvent module borders. Now, I found out that generalized newtype deriving can even be used to define functions that would be impossible to define otherwise. To me, this is surprising since I thought that generalized newtype deriving was only intended to save the programmer from writing boilerplate code, not to extend expressiveness. Let's dig down and figure out the problem. When you annotate the type Wrapped a with deriving (Iso a) what are you saying? You're saying that the compiler should derive an instance (Iso a (Wrapped a)). Well, that instance gives you the method instance conv :: forall f. f a - f (Wrapped a). The funny thing is that the only implementation for ---something like--- that type would be fmap Wrap. If the parameter of f is contravariant then we would need a “contraMap”, not an fmap. Example: Right, but it's the same basic idea, just violating the (nonexistent?) ContraFunctor class instead of the Functor class. The underlying problem ---which is what I was trying to identify--- is that generalized newtype deriving is assuming that every tycon of kind *-* is a functor (i.e., co-/contravariant endofunctor on all of Hask), and it's that assumption which causes breakage. My conservative solution to disallow deriving methods where the newtype occurs beneath an unknown tycon would, I think, still work. The only difference is that in addition to considering all instances of Functor[1] as well known (as well as a few special cases: e.g., the first argument to (-) or (,)) we could consider all instances of ContraFunctor to be well known as well. That is, if there's an official version of that class. My solution is conservative in that it doesn't offer any support for GADTs or type families, which are the particular concern in the bug tracker ticket. The problem for them is the same one, only it's even more pertinent since some things given the kind *-* should really have a different kind like |*|-* since their argument is an index instead of a type--- which means they're _really_ not functors on Hask. Let us look at the Set example from John Meacham. Set is a (covariant) functor, not a contravariant functor. However, it isn’t a functor from and to the category of Haskell types and functions Right, which is why the assumption that kind *-* implies functorality is broken. Again, in some sense even the kind is wrong; it's something more like Ord-*, but that only underscores the point. [1] And Monad since Monad doesn't state the Functor requirement. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] mirroring patch tag
http://blog.patch-tag.com/2010/03/13/mirroring-patch-tag/ cheers, thomas. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: If wishes were horses...
Ketil Malde wrote: What should the type look like? If memory serves, Clean allows bangs in type signatures, something like: foldl' :: (a - b - a) - !a - [b] - a but I thought it just added a seq under the hood, much like bang patterns like foldl' f !z xs = ... do in Haskell, so it's not like !a is a separate type. Or? The usual approach I've seen is not to distinguish strict and lazy datatypes, but rather to distinguish strict and lazy functions, e.g. by having two different arrows: (-) for lazy functions and (!-) for strict ones.[1] There are reasonable reasons for wanting to distinguish strict/lazy datatypes instead, though that's usually called distinguishing lifted vs unlifted types, which has different effects on the semantics. I don't recall which approach Clean uses. Would something like this work? It seems to me that strictness doesn't apply to result types Which is one benefit of the two arrows version: there's no way to talk about making the result strict. and you need to track the relationship between a and a', since you probably want to allow a lazy value as e.g. the second parameter of foldl'. Usually, if you're going to be distinguishing lifted and unlifted types then you'll want to be able to say that the unlifted values can always be coerced into the corresponding lifted type. Whether that involves subtyping, autoboxing, etc. will depend on the compiler and the language. [1] Actually, just having two is insufficiently expressive. What you actually want is to make the (-) type constructor take three arguments: the parameter type, the return type, and an index belonging to the set {Strict,Lazy}. That way you can use type variables to unify strictness behaviors of higher-order functions with their function arguments (i.e., the HOF is strict or lazy in various arguments depending on the strictness properties of the functional arguments). -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: direct-plugins-1.0
For some time I have relied on Dons's Plugins package, which was perhaps something of a mistake as it's kind of messy inside and I don't think it's maintained. With the upgrade to GHC 6.12, it broke for me, and I wasn't able to get it fixed. But I was able to write my own subset of its functionality. I don't do most of the things that Plugins does - in fact I export only a single function, load - but I think it might be useful to somebody, so I've decided to release it. direct-plugins: Lightweight replacement for Plugins, specific to GHC http://hackage.haskell.org/package/direct-plugins This is my first post to this list; I hope it's appropriate. Please let me know if not. -- Dan Knapp An infallible method of conciliating a tiger is to allow oneself to be devoured. (Konrad Adenauer) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: direct-plugins-1.0
dankna: For some time I have relied on Dons's Plugins package, which was perhaps something of a mistake as it's kind of messy inside and I don't think it's maintained. With the upgrade to GHC 6.12, it broke for me, and I wasn't able to get it fixed. But I was able to write my own subset of its functionality. I don't do most of the things that Plugins does - in fact I export only a single function, load - but I think it might be useful to somebody, so I've decided to release it. direct-plugins: Lightweight replacement for Plugins, specific to GHC http://hackage.haskell.org/package/direct-plugins This is my first post to this list; I hope it's appropriate. Please let me know if not. Good work. I have very little time to maintain hs-plugins, as I'm not using it, so I'm glad you took a look at this. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe