[Haskell-cafe] about logical computation
hi, friends I am a Haskell newbie however i like it very much. After starting learn haskell, i donot find the corresponding "&", "|" , "~", "<<", ">>" logical computation of C language. Sincerely! -- z_axis 2008-09-29 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about logical computation
Hello z_axis, Monday, September 29, 2008, 11:22:22 AM, you wrote: > hi, friends > I am a Haskell newbie however i like it very much. After starting > learn haskell, i donot find the corresponding "&", "|" , "~", "<<", > ">>" logical computation of C language. import Data.Bits just its exports: module Data.Bits ( Bits( (.&.), (.|.), xor, -- :: a -> a -> a complement,-- :: a -> a shift, -- :: a -> Int -> a rotate,-- :: a -> Int -> a bit, -- :: Int -> a setBit,-- :: a -> Int -> a clearBit, -- :: a -> Int -> a complementBit, -- :: a -> Int -> a testBit, -- :: a -> Int -> Bool bitSize, -- :: a -> Int isSigned, -- :: a -> Bool shiftL, shiftR,-- :: a -> Int -> a rotateL, rotateR -- :: a -> Int -> a ) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] TH error
Hi Tim, You seem to be duplicating the functionality of Data.Derive to some extent: http://www.cs.york.ac.uk/~ndm/derive/ You might find it easier to use that tool, and if it doesn't meet your needs send in a patch :-) Thanks Neil > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Tim Newsham > Sent: 27 September 2008 3:34 am > To: haskell-cafe@haskell.org > Subject: [Haskell-cafe] TH error > > I'm goofing with TH and I have my program mostly done: > > http://hpaste.org/10713 > > If I have the "$(deriveBinary ''MyData)" line commented out > it prints out what looks to me like correct code. I can even > paste it into a program and it compiles. However, when the > line isn't commented out I get an error I don't understand: > > test.hs:1:0: > Illegal data constructor name: `x' > When splicing generated code into the program > > There are two places in my code I use "x" in splices that > could be causing the problem: > > g <- [| getWord8 >>= \x -> $(caseE [| x |] gcases') |] and >put x = $(caseE [| x |] (map return ps)) |] > > but I don't understand why these might be causing errors (if > they are indeed the cause). Using -ddump-splices doesn't > help since it seems to hit the error before dumping splices. > > What's going on here? > > Tim Newsham > http://www.thenewsh.com/~newsham/ > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] about logical computation
> > hi, friends > > I am a Haskell newbie however i like it very much. After starting > > learn haskell, i donot find the corresponding "&", "|" , "~", "<<", > > ">>" logical computation of C language. > > import Data.Bits > > just its exports: > Perhaps you might like a *bit* more documentation than that: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Bits.html Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] 'par' - why has it the type a -> b -> b ?
What is the reason for implementing parallelism with 'par :: a -> b -> b'? Analogy to 'seq'? I thought parallelism would be introduced most naturally by a function which does two computations in parallel and puts together their results after completion. Say par2 :: (a -> b -> c) -> (a -> b -> c) to be used like par2 (+) expensiveComputationA expensiveComputationB I assume that par2 can be implemented this way: par2 f x y = f x (par x y) ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Re: Haddock + Hoogle == Javadoc on steroids
Hi Simon, > http://joyful.com/repos/darcs-sm/api-doc is a mashup of > haddock, hoogle and hscolour (and darcsweb, darcs-graph - see > http://joyful.com/repos). I can see the Haddock information, but not the Hoogle/HsColour mashup. I'm using Firefox 3. Am I missing something? How do you get started with a Hoogle query? > had time to work on this, currently I hard-code the target in > hoogle and munge the haddock output slightly (see recent > patch in darcs-unstable). I believe you emailed me privately with a question about pointing at haddock documentation from Hoogle. I'm currently a bit out of sync with emails as I've just moved house, don't yet have internet, and can't check my gmail account from work. The answer, from what I can remember of the question, is: "How do I get Hoogle to point at a particular documentation repo?" The answer is to add a line similar to: @haddock http://hackage.haskell.org/packages/archive/Cabal/latest/doc/html/ to the Text file you get out of haddock --hoogle. You can also add an @hackage url, which is treated as the home page of the package. Thanks Neil == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hmm, what license to use?
"Bit Connor" <[EMAIL PROTECTED]> writes: > I believe that it's wrong to use a license to try to enforce such > cooperation. Look what happened with KHTML when Apple started using > it for their Safari web browser. I haven't followed this in detail, but I think that, even when a company is reluctant to cooporate, it is better to have their code available than not. Also, using the LGPL rather than BSD is a clear signal that contributions are expected for the library, BSD condones making proprietary forks. > The FSF advises only to use LGPL in rare cases as a tactic to ensure > greater freedom further down the line. They advise to use GPL instead, as a crowbar to force any applications using the library to be GPL as well. -k -- 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: Version 0.4.3 of happs-tutorial is a HAppS job board, done in HAppS.
Someone on reddit pointed out that many firewalls block 5001 so I moved to vanilla http port 80. http://www.happstutorial.com 2008/9/29 Thomas Hartman <[EMAIL PROTECTED]>: > Hello, world. > > In Version 4 of the ongoing self-demoing HAppS Tutorial, we implement > a HAppS job board using HAppS. > > demo: http://happstutorial.com:5001 > > install: sudo cabal install happs-tutorial > > darcs head: darcs get http://code.haskell.org/happs-tutorial > > There aren't any new lessons compared to the last release, but the > code is much cleaner, and... well... the web site actually does > something. > > Coming soon, lessons on form processing and HAppS State. > > Enjoy! > > Thomas. > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: 'par' - why has it the type a -> b -> b ?
Henning Thielemann <[EMAIL PROTECTED]> wrote: par2 :: (a -> b -> c) -> a -> b -> c > > par2 f x y = > >f x (par x y) ($!):: (a -> b) -> a -> b f $! x = x `seq` f x It's terseness vs. maximum composability. I don't even want to think about implementing seq in terms of $!, makes my brain twist. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hmm, what license to use?
On Mon, Sep 29, 2008 at 4:06 AM, Michael Giagnocavo <[EMAIL PROTECTED]> wrote: >>Goal 2 (The "open source" angle): Developers who use the library >>should have to contribute their modifications of the library back to >>the community. I believe that it's wrong to use a license to try to >>enforce such cooperation. Look what happened with KHTML when Apple >>started using it for their Safari web browser. Even though KHTML was > > Well, the MPL helps out with this Goal 2 by requiring that you document all > modifications (they recommend providing diffs). > http://www.mozilla.org/MPL/MPL-1.1.html#section-3.3 > However, because of this clause (and others), the MPL is incompatible with the GPL: http://www.gnu.org/philosophy/license-list.html#MPL http://www.tomhull.com/ocston/docs/mozgpl.html If it's not obvious why GPL compatibility is an important thing then the second link above provides some explanation. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: 'par' - why has it the type a -> b -> b ?
> par2 :: (a -> b -> c) -> a -> b -> c > > > par2 f x y = > > >f x (par x y) Here is the dual: 'par' implemented in terms of parallel application: a `par` b = par2 (\x y-> y) a b > ($!):: (a -> b) -> a -> b > f $! x = x `seq` f x > > It's terseness vs. maximum composability. I don't even want to think > about implementing seq in terms of $!, makes my brain twist. It's not so difficult. (And you may see some similarity with the above defn of par.) a `seq` b = (\x y-> y) $! a b Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Code.haskell.org down
Hi, For me, it seems that code.haskell.org is down. Is this the case for other people as well? It seems code.haskell.org regularly looses connectivity for me :-( Thanks Neil == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code.haskell.org down
On Mon, Sep 29, 2008 at 4:02 PM, Mitchell, Neil <[EMAIL PROTECTED]> wrote: > Hi, > > For me, it seems that code.haskell.org is down. Is this the case for > other people as well? > > It seems code.haskell.org regularly looses connectivity for me :-( > > Thanks > > Neil http://downforeveryoneorjustme.com/code.haskell.org sez: > It's just you. code.haskell.org is up. which I can confirm from independent investigation ;-) (Seriously though, the above site is a great tool for such circumstances.) D ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Code.haskell.org down
Hi > http://downforeveryoneorjustme.com/code.haskell.org sez: > > > It's just you. code.haskell.org is up. Now its up for me as well. It's a little annoying that code.haskell.org seems so flakey. > (Seriously though, the above site is a great tool for such > circumstances.) That is a great site, I'll bookmark it. Thanks Neil == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Code.haskell.org down
"Dougal Stanton" <[EMAIL PROTECTED]> wrote: > (Seriously though, the above site is a great tool for such > circumstances.) > I like this one: http://downforeveryoneorjustme.com/downforeveryoneorjustme.com -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] not able to compile Happy GLR examples
(posted on 9/23/08 on haskell-beginners, no response was received) I'm unable to compile the GLR examples (in the 'glr' directory) provided with Happy, version 1.16. I'm using ghc version 6.6.1. I've looked at the version of Happy currently in darcs and the part of the examples that seems to be causing the problem has not been updated there, either. This Happy seems out of date because it uses the flag "-package data"; my searching indicates that the 'data' package is old. Other errors remained after I removed the flag. Would someone please verify the error? Also, does anyone know of or have a GLR example that works? Thank you for reading or helping. Brian Msg sent via CableONE.net MyMail - http://www.cableone.net___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: 'par' - why has it the type a -> b -> b ?
Malcolm Wallace <[EMAIL PROTECTED]> wrote: > (\x y -> y) *shudder* I just can't stand such things. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: Graphalyze-0.1
I'd like to announce the initial release of my graph-theoretic analysis library, Graphalyze [1], the darcs repo for which is also available [2]. This is a pre-release of the library that I'm writing for my mathematics honours thesis, "Graph-Theoretic Analysis of the Relationships in Discrete Data". I'll also be releasing a tool that uses this library to analyse the structure of Haskell code, that I'm tentatively calling SourceGraph. As it stands, the library has a number of algorithms included, some of which I've developed from scratch (e.g. clique finder), and others are implementations of published algorithms (mainly the two clustering algorithms). The code is meant to be more readable than efficient, and I wanted to explore ways of developing algorithms that match more closely the way graphs work (which makes FGL a much nicer fit than matrix-based or list-based graph data structures). This library is only a pre-release, as whilst everything in there works (at least it does for me), I'd like to get some feedback from the community, especially since this is my first ever released solo piece of code (I've coded assignments, and worked on projects with others, but have never released anything that I've been solely responsible for before). In particular, have I written the .cabal file correctly? Also, I'd like advice on something else: the part of the library that I'd like to develop still is the reporting framework. The end goal of the library is for the user to specify which algorithms they want applied to their data, and then the library produces a document with the results. This document is _not_ meant to be machine readable. As such, I can think of three options: 1) Plain text, with graphs either in seperate image files (using graphviz) or else as plaintext (FGL's show function). 2) Generate LaTeX code. 3) Generate Pandoc [3] compatible Markdown, and let the user convert it into whatever format they prefer. I'm not a big fan of option 1), as it is probably the most unreadable in general. I'd like to use Pandoc, as it is theoretically possible to convert it to numerous other filetypes, however with inline linking there's still no way (at least I can find) to have images scaled to the correct size automatically. So unless I pre-scale the images, using option 3) and then converting to PDF via LaTex generation of the Markdown sources is probably out. As such, what would you all prefer to read as a documentation-style report of your software? 1) A PDF via LaTeX, which has the advantage of being printable and all in one file 2) HTML via Pandoc, which lets you have the images linked separately from the document, and thus no need to shrink them down (they can stay at the natively generated size, and thus easier to zoom in, etc.). Finally, I'll be giving my honours talk on this next Monday. So if you're in Brisbane on 6 October and interested, it'll be on at 2PM at the University of Queensland (where as part of it I'll be explaining to mathematicians why Haskell is a great language to use for mathematics... or at least trying to!). [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Graphalyze [2] http://code.haskell.org/Graphalyze/ [3] http://johnmacfarlane.net/pandoc -- Ivan Lazar Miljenovic [EMAIL PROTECTED] IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Code.haskell.org down
It was down for me as well, right after Neil's message and it has happened before as well.I wonder why the interruptions. hugo On Mon, Sep 29, 2008 at 4:34 PM, Achim Schneider <[EMAIL PROTECTED]> wrote: > "Dougal Stanton" <[EMAIL PROTECTED]> wrote: > > > (Seriously though, the above site is a great tool for such > > circumstances.) > > > I like this one: > > http://downforeveryoneorjustme.com/downforeveryoneorjustme.com > > -- > (c) this sig last receiving data processing entity. Inspect headers > for copyright history. All rights reserved. Copying, hiring, renting, > performance and/or broadcasting of this signature prohibited. > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- www.di.uminho.pt/~hpacheco ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Code.haskell.org down
On Mon, Sep 29, 2008 at 04:02:06PM +0100, Mitchell, Neil wrote: > > For me, it seems that code.haskell.org is down. Is this the case for > other people as well? > > It seems code.haskell.org regularly looses connectivity for me :-( Thanks for the heads-up. On http://community.haskell.org/mrtg/localhost_venet0-day.png it looks like Apache had been unhappy since about 8:30 EDT. I've now restarted it. Not sure what caused the problem. Thanks Ian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: 'par' - why has it the type a -> b -> b ?
> > (\x y -> y) > > *shudder* > > I just can't stand such things. > What is it that you can't stand? Would you prefer "flip const"? Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Version 0.4.3 of happs-tutorial is a HAppS job board, done in HAppS.
This is looking very useful. Thanks! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The container problem
Andrew Coppin wrote: Seriously, that sounded like gibberish. Please don't say that. I think we are too polite to rudeness. While we shouldn't condemn people to "RTFM", we shouldn't tolerate people calling us "gibberish" either. I mean unless we say something objectively gibberish. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock + Hoogle == Javadoc on steroids
Hi Neil.. my apologies, my nightly cron script clobbered it. Please try now, same url: http://joyful.com/repos/darcs-sm/api-doc You should see three panes with hoogle in the lower left. The answer is to add a line similar to: @haddock http://hackage.haskell.org/packages/archive/Cabal/latest/doc/html/ to the Text file you get out of haddock --hoogle. You can also add an @hackage url, which is treated as the home page of the package. Aha, I had not detected that at all. Thanks for the tip. Also thanks to you and the haddock & hscolour authors for such fine tools. -Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] not able to compile Happy GLR examples
> with Happy, version 1.16. I'm using ghc version 6.6.1. I've looked at the Just looking at the GHC version number: perhaps update to 6.8.3 would help? Best regards Christopher Skrzętnicki ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: 'par' - why has it the type a -> b -> b ?
On Mon, 2008-09-29 at 17:59 +0200, Achim Schneider wrote: > Malcolm Wallace <[EMAIL PROTECTED]> wrote: > > > (\x y -> y) > > *shudder* > > I just can't stand such things. Then call it `flip const'. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haddock + Hoogle == Javadoc on steroids
> > Hi Neil.. my apologies, my nightly cron script clobbered it. Please try > now, same url: http://joyful.com/repos/darcs-sm/api-doc > It seems the "Contents" link embeds the outer frame into the right-hand side inner frame. Otherwise, it looks nice! Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: 'par' - why has it the type a -> b -> b ?
"Sean Leather" <[EMAIL PROTECTED]> wrote: > > > (\x y -> y) > > > > *shudder* > > > > I just can't stand such things. > > > > What is it that you can't stand? Would you prefer "flip const"? > It's the missing "x" on the right side. Makes my internal C compiler ache. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Version 0.4.3 of happs-tutorial is a HAppS job board, done in HAppS.
The executable needs the templates in the same directory to work correctly. Copy the happs-tutorial.tar.gz file from whereever cabal put it -- probably somewhere under .cabal if you're on linux. Untar it, cd into the directory, compile and run in there. Should work. I'll revise the tutorial instructions to make this clearer, thanks for the feedback. Thomas. 2008/9/29 Anton Tayanovskyy <[EMAIL PROTECTED]>: > Hello Thomas, > > After doing > > sudo cabal install happs-tutorial > > I got HappS to build which is really a great improvement (about a year > ago I could not build HappS). It also installed happs-tutorial > executable. > > Now, the executable runs, but when I try to access the server over HTTP, I > get: > > IO Error: Just "templates/base.st" -- does not exist > > Also, on my system I can't locate base.st nor hackInGhci.sh mentioned > in the online tutorial. Actually, I somehow fail to make sense of this > page: > > http://www.happstutorial.com/tutorial/run-tutorial-locally > > After the Cabal install, I'm lost. Maybe it's just me not seeing > something obvious, but in that case it still gives you a good sample > of your target audience, us webmonkeys :) > > If that helps, I'm on Fedora 9, GHC 8.3. > > Thanks. > > > --Anton > > > On Mon, Sep 29, 2008 at 5:25 PM, Thomas Hartman <[EMAIL PROTECTED]> wrote: >> Someone on reddit pointed out that many firewalls block 5001 so I >> moved to vanilla http port 80. >> >> http://www.happstutorial.com >> >> >> >> 2008/9/29 Thomas Hartman <[EMAIL PROTECTED]>: >>> Hello, world. >>> >>> In Version 4 of the ongoing self-demoing HAppS Tutorial, we implement >>> a HAppS job board using HAppS. >>> >>> demo: http://happstutorial.com:5001 >>> >>> install: sudo cabal install happs-tutorial >>> >>> darcs head: darcs get http://code.haskell.org/happs-tutorial >>> >>> There aren't any new lessons compared to the last release, but the >>> code is much cleaner, and... well... the web site actually does >>> something. >>> >>> Coming soon, lessons on form processing and HAppS State. >>> >>> Enjoy! >>> >>> Thomas. >>> >> ___ >> 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] Re: 'par' - why has it the type a -> b -> b ?
On Mon, 2008-09-29 at 19:50 +0200, Achim Schneider wrote: > "Sean Leather" <[EMAIL PROTECTED]> wrote: > > > > > (\x y -> y) > > > > > > *shudder* > > > > > > I just can't stand such things. > > > > > > > What is it that you can't stand? Would you prefer "flip const"? > > > It's the missing "x" on the right side. Makes my internal C compiler > ache. (\ _ y -> y) Or fix your internal C compiler. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: 'par' - why has it the type a -> b -> b ?
Jonathan Cast <[EMAIL PROTECTED]> wrote: > On Mon, 2008-09-29 at 19:50 +0200, Achim Schneider wrote: > > "Sean Leather" <[EMAIL PROTECTED]> wrote: > > > > > > > (\x y -> y) > > > > > > > > *shudder* > > > > > > > > I just can't stand such things. > > > > > > > > > > What is it that you can't stand? Would you prefer "flip const"? > > > > > It's the missing "x" on the right side. Makes my internal C compiler > > ache. > > (\ _ y -> y) > Still begs for a rewrite at the call-site... oh wait, that won't work. PS: I should tell claws that my inbox "Haskell Cafe" has no associated email account. Would stop me from replying off-list. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: 'par' - why has it the type a -> b -> b ?
On Mon, 2008-09-29 at 20:34 +0200, Achim Schneider wrote: > Jonathan Cast <[EMAIL PROTECTED]> wrote: > > > On Mon, 2008-09-29 at 19:50 +0200, Achim Schneider wrote: > > > "Sean Leather" <[EMAIL PROTECTED]> wrote: > > > > > > > > > (\x y -> y) > > > > > > > > > > *shudder* > > > > > > > > > > I just can't stand such things. > > > > > > > > > > > > > What is it that you can't stand? Would you prefer "flip const"? > > > > > > > It's the missing "x" on the right side. Makes my internal C compiler > > > ache. > > > > (\ _ y -> y) > > > Still begs for a rewrite at the call-site... oh wait, that won't work. And I still think you should fix your internal C compiler. This sort of thing can be taken to excess (see Fudgets :), but in moderation it's a perfectly fine *Haskell* idiom. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: 'par' - why has it the type a -> b -> b ?
On Mon, 29 Sep 2008, Sean Leather wrote: (\x y -> y) *shudder* I just can't stand such things. What is it that you can't stand? Would you prefer "flip const"? No, certainly "const id". :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haddock + Hoogle == Javadoc on steroids
Hi >> The answer is to add a line similar to: >> >> @haddock >> http://hackage.haskell.org/packages/archive/Cabal/latest/doc/html/ >> >> to the Text file you get out of haddock --hoogle. >> >> You can also add an @hackage url, which is treated as the home page of >> the package. > > Aha, I had not detected that at all. Thanks for the tip. Also thanks to you > and the haddock & hscolour authors for such fine tools. It's entirely undocumented, and not a great interface - my hope is that one day cabal will pass some --hoogle-extra flags or something to haddock, but I've not yet decided how packages should specify where they live - if you have any suggestions do let me know. For your example page, its very nice. Perhaps, for the bottom left Hoogle box, it would be easier if you used the code snipped: That way the interface should look a bit nicer, as you don't need such a large amount of space for a search box and you can format it the way you want. Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hmm, what license to use?
2008/9/29 Bit Connor <[EMAIL PROTECTED]>: [..] Basically it seems to me that you believe in the benevolence and enligtenment of companies. Something I don't. I believe you are right in splitting the LGPL into two different objectives, and you are right in saying that I really only care about getting changes back. > So in summary, if user freedom is important, then GPL is the way to > go. If it's about encouraging the submission of patches and > contributions, then the license won't help you, you simply have to > rely on the good will of people. (But BSD will allow for a larger > community) Well, I'm not convinced about this. I fail to see how your use of Apple is an example of this. Yes, they clearly didn't get it in the beginning, but now there seems to be a vibrant community around Webkit. Just as a point of comparison, did they do any better (in the beginning) with the BSD licensed code they use? I sure haven't heard anything along those lines anyways. /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Health effects
The other day, I sat down to eat a 2 Kg block of chocolate - one of those ones that's divided into lots of little squares. I proceeded to recursively subdivide it into smaller and smaller blocks, and then eat the individual squares in depth-first order. It was only after getting through 16 of the things that I stopped to notice that the whole bar just happens to have an exact power of two squares on it. And it was some time after *that* when I thought to myself "...woah, maybe do too much Haskell?" o_O Seriously, who recursively subdivides their food? I think I have something wrong with me... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] System.Process
Much hair-pulling resulted today when I attempted to perform a small task. The System.Process module provides the runCommand function. This takes a complete command line and returns a ProcessHandle. No problem there. The module also provides the runProcess function, which enables you to set environment variables and so forth. However... this doesn't take a complete command line. It takes a path to an executable and a list of parsed arguments. Herein lies the problem: I have a program that accepts complete commands from a file and executes them. It works perfectly. And now I'd just like to set an environment variable while each command runs... But alas no, the only way to do that is with runProcess, which expects me to parse the command line first. (Before anybody remarks that "words" will do this, consider the "echo" command, which treats whitespace meaningfully.) In the end I resorted to reading the source code for the module. After about 30 minutes of hacking, I got something which typechecks but throws a runtime exception. It appears that runCommand looks for binaries in the system search path, but the code I've concocted doesn't. (Despite being cut and pasted from the definition of runCommand.) The only thing I can think of is that the source code I'm looking at (GHC 6.8.3) is different from the version of the library I have (GHC 6.8.1). Anyway, the point I'm trying to get to is... would it be hard for however maintains this library to add a little more flexibility in what it can do please? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Health effects
Maybe I haven't done enough haskell, but enough lisp to NOT eat _2_ Kg of chocolate. Did you really think you would get those 2 Kg's down? /Gf On Mon, Sep 29, 2008 at 9:43 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote: > The other day, I sat down to eat a 2 Kg block of chocolate - one of those > ones that's divided into lots of little squares. I proceeded to recursively > subdivide it into smaller and smaller blocks, and then eat the individual > squares in depth-first order. It was only after getting through 16 of the > things that I stopped to notice that the whole bar just happens to have an > exact power of two squares on it. > > And it was some time after *that* when I thought to myself "...woah, maybe > do too much Haskell?" o_O > > Seriously, who recursively subdivides their food? I think I have something > wrong with me... > > ___ > 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] System.Process
On Sep 29, 2008, at 15:49 , Andrew Coppin wrote: Herein lies the problem: I have a program that accepts complete commands from a file and executes them. It works perfectly. And now I'd just like to set an environment variable while each command runs... But alas no, the only way to do that is with runProcess, which expects me to parse the command line first. (Before anybody remarks that "words" will do this, consider the "echo" command, which treats whitespace meaningfully.) env FOO=bar mycommand ... -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] System.Process
Brandon S. Allbery KF8NH wrote: On Sep 29, 2008, at 15:49 , Andrew Coppin wrote: Herein lies the problem: I have a program that accepts complete commands from a file and executes them. It works perfectly. And now I'd just like to set an environment variable while each command runs... But alas no, the only way to do that is with runProcess, which expects me to parse the command line first. (Before anybody remarks that "words" will do this, consider the "echo" command, which treats whitespace meaningfully.) env FOO=bar mycommand ... Does that work for Windows? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Health effects
Gianfranco Alongi wrote: Maybe I haven't done enough haskell, but enough lisp to NOT eat _2_ Kg of chocolate. Did you really think you would get those 2 Kg's down? Oh, no. The entire bar is 2 Kg, I wasn't actually planning to eat the whole thing! o_O My god, my pancreas would explode or something... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Health effects
Andrew Coppin wrote: The other day, I sat down to eat a 2 Kg block of chocolate - one of those ones that's divided into lots of little squares. I proceeded to recursively subdivide it into smaller and smaller blocks, and then eat the individual squares in depth-first order. It was only after getting through 16 of the things that I stopped to notice that the whole bar just happens to have an exact power of two squares on it. And it was some time after *that* when I thought to myself "...woah, maybe do too much Haskell?" o_O Seriously, who recursively subdivides their food? I think I have something wrong with me... You're not alone: http://xkcd.com/245/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] System.Process
On Sep 29, 2008, at 15:59 , Andrew Coppin wrote: Brandon S. Allbery KF8NH wrote: On Sep 29, 2008, at 15:49 , Andrew Coppin wrote: Herein lies the problem: I have a program that accepts complete commands from a file and executes them. It works perfectly. And now I'd just like to set an environment variable while each command runs... But alas no, the only way to do that is with runProcess, which expects me to parse the command line first. (Before anybody remarks that "words" will do this, consider the "echo" command, which treats whitespace meaningfully.) env FOO=bar mycommand ... Does that work for Windows? Only if on of the unix-simulation environments is installed. I wouldn't want to bet on such things working reliably cross-platform anyway; even if it works something like the same way, the variable names are usually different. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Health effects
On Mon, Sep 29, 2008 at 12:43 PM, Andrew Coppin <[EMAIL PROTECTED] > wrote: > The other day, I sat down to eat a 2 Kg block of chocolate - one of those > ones that's divided into lots of little squares. I proceeded to recursively > subdivide it into smaller and smaller blocks, and then eat the individual > squares in depth-first order. It was only after getting through 16 of the > things that I stopped to notice that the whole bar just happens to have an > exact power of two squares on it. > > And it was some time after *that* when I thought to myself "...woah, maybe > do too much Haskell?" o_O > > Seriously, who recursively subdivides their food? I think I have something > wrong with me... You may have applied divide and conquer but I suspect your updates were destructive. Are you sure it's too much Haskell that is the problem? :-) Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Health effects
Oh, yeah, I thought you really meant that you would force that "baby" down. :) Nice to hear that you wouldn't. Not even "lazy evaluation" would save you there 7-8 hours later. ;) /Gf On Mon, Sep 29, 2008 at 10:00 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote: > Gianfranco Alongi wrote: >> >> Maybe I haven't done enough haskell, but enough lisp to NOT eat _2_ Kg >> of chocolate. >> Did you really think you would get those 2 Kg's down? >> > > Oh, no. The entire bar is 2 Kg, I wasn't actually planning to eat the whole > thing! o_O My god, my pancreas would explode or something... > > ___ > 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] Health effects
Anton van Straaten wrote: You're not alone: http://xkcd.com/245/ Heh. Randel appears to have not heard of Haskell. He thinks _Lisp_ is the ultimate language. ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haddock + Hoogle == Javadoc on steroids
that one day cabal will pass some --hoogle-extra flags or something to haddock, but I've not yet decided how packages should specify where they live - if you have any suggestions do let me know. Will do.. I've yet to come to grips with cabal, still in makefile land as yet.. For your example page, its very nice. Perhaps, for the bottom left Hoogle box, it would be easier if you used the code snipped: Works well, thanks! I've also put it at the top of the haddock pane, so the third pane could be dropped ? Not sure which is better. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Health effects
Hallo, Andrew Coppin wrote: > Anton van Straaten wrote: >> You're not alone: >> >> http://xkcd.com/245/ > > Heh. Randel appears to have not heard of Haskell. He thinks _Lisp_ is > the ultimate language. ;-) > Well, at least he's close, let's wait till he finds out about Scheme. :-) Cheers, -alex http://www.ventonegro.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Health effects
On 9/29/08, Gianfranco Alongi <[EMAIL PROTECTED]> wrote: > Oh, yeah, I thought you really meant that you would force that "baby" down. :) > Nice to hear that you wouldn't. Not even "lazy evaluation" would save > you there 7-8 hours later. 2kg of chocolate 'thunks' to 'force' really might 'blow your stack' later on. Harr Harr :D ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] announcing darcs 2.1.0pre2
Eric Kow wrote: The second pre-release of darcs 2.1 (formerly known as 2.0.3) is now available at http://darcs.net/darcs-2.1.0pre2.tar.gz darcs 2.1.0pre2 is now available in Gentoo Linux, hard masked. Update your portage tree and unmask[1] it. Cheers, Lennart Kolmodin [1] http://gentoo-wiki.com/Masked#Hard_Masked ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hmm, what license to use?
magnus: > 2008/9/29 Bit Connor <[EMAIL PROTECTED]>: > [..] > > Basically it seems to me that you believe in the benevolence and > enligtenment of companies. Something I don't. I believe you are > right in splitting the LGPL into two different objectives, and you are > right in saying that I really only care about getting changes back. > > > So in summary, if user freedom is important, then GPL is the way to > > go. If it's about encouraging the submission of patches and > > contributions, then the license won't help you, you simply have to > > rely on the good will of people. (But BSD will allow for a larger > > community) > > Well, I'm not convinced about this. I fail to see how your use of > Apple is an example of this. Yes, they clearly didn't get it in the > beginning, but now there seems to be a vibrant community around > Webkit. Just as a point of comparison, did they do any better (in the > beginning) with the BSD licensed code they use? I sure haven't heard > anything along those lines anyways. > The big problem with the LGPL and Haskell is static linking. We can't use anything we wish to ship commercially that relies on LGPLd-statically linked-and-inlined Haskell code at the moment. So if you use LGPL for your Haskell libraries, all of which are currently statically linked and non-replaceable at runtime, it is unlikely any commercial Haskell house can use the code. Note that this *isn't* the case for C libraries, which are dynamically linked, like libgmp, which is just fine. This is why the OCaml guys use their untested LGPL+static linking exception, I guess. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Climbing up the shootout...
Simon Marlow ha scritto: Manlio Perillo wrote: Simon Marlow ha scritto: Manlio Perillo wrote: [...] We'd certainly support any efforts to add support for a more modern I/O multiplexing or asynchronous I/O back-end to the IO library. It's not too difficult, because the interface between the low-level I/O supplier and the rest of the IO library is rather small - just a few functions that read and write blocks of data in a blocking or non-blocking way. The blocking variants currently communicate with the I/O manager thread which does select() on behalf of the clients. There is some documentation that summarize the current status, and how all fits together? Sadly no, but the code is mostly restricted to a couple of modules (GHC.Handle and GHC.Conc). Ok. I' I'm also reading the "unify" paper. What I would like to do is to write a library for high efficient IO, using the code from Nginx (that is well written and reusable). What Nginx give us is: 1) Several modules for efficient event handling on all platform. There is also Windows support with IOCP, but the code is not public (but lately someone is porting Nginx to Windows, and I can always ask the author of Nginx to make his code public). 2) Support for SSL. 3) There is support for timeouts, using a red black tree. In Haskell timeouts are handled spwawing a thread with forkIO, but is this efficient? 4) Support for async DNS resolver. 5) Support for "sending" buffer chains. A buffer chain is "sent" with writev. In Haskell a ByteString has several chunks, so it can be efficiently "sent" using writev. 6) Support for file buffers. A file buffer is "sent" with sendfile, if available. There is no equivalent in Haskell. Since I have started to work with Nginx, I had the interest of reusing the Nginx code as a library/framework, but all the languages I knew did not have native support for microthreads (Python has greenlets, but it also already hase Twisted, so it is of little interest to implement yet another async framework). GHC seems the best platform to use, since it has microthreads, and Haskell language allow a "safe" use of OS threads. There are some benchmarks that tell you the use of a separate I/O manager thread is a good solution? Compared to what? I did measure the difference between doing this in Haskell code in the IO library (as with -threaded) against doing it in the RTS (without -threaded), Yes, this is what I meant. and the Haskell version won hands down, mainly because it only re-initiates the select() when it has to change the file handles in the set. Using epoll() instead of select() should be even better. Ok, thanks. In GHC there is only one IO manager thread? And forkIO can execute code in a separate OS thread, if necessary? Cheers, Simon Regards Manlio ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hmm, what license to use?
On Mon, 2008-09-29 at 14:39 -0700, Don Stewart wrote: > The big problem with the LGPL and Haskell is static linking. We can't > use anything we wish to ship commercially that relies on > LGPLd-statically linked-and-inlined Haskell code at the moment. > > So if you use LGPL for your Haskell libraries, all of which are > currently statically linked and non-replaceable at runtime, it is > unlikely any commercial Haskell house can use the code. > > Note that this *isn't* the case for C libraries, which are dynamically > linked, like libgmp, which is just fine. Yet another reason for getting dynamic linking / shared libs for Haskell packages working reliably on all platforms. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] 'par' - why has it the type a -> b -> b ?
Henning Thielemann wrote: > > What is the reason for implementing parallelism with 'par :: a -> b -> b'? > Analogy to 'seq'? I'd think it's actually easier to implement than par2 below; evaluating par x y "sparks" a thread evaluating x, and then returns y. The analogy to 'seq' is there, of course. > I thought parallelism would be introduced most naturally > by a function which does two computations in parallel and puts together > their results after completion. Say > >> par2 :: (a -> b -> c) -> (a -> b -> c) > > to be used like > >> par2 (+) expensiveComputationA expensiveComputationB > > I assume that par2 can be implemented this way: > >> par2 f x y = >>f x (par x y) For this to work, f has to evaluate its second argument before the first one, or the par will be useless. Try this: > par2 f x y = x `par` y `par` f x y (In complete analogy to using `seq` for enforcing strictness.) HTH, Bertram ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Red-Blue Stack
It won't be O(1) but this is how I would do it. It uses alternating lists of red and blue elements. It has to access at most three elements from this list for any one operation so as long as we don't have huge blocks of red or blue elements performance should be quite good. The worst case I can think of is if we have an extremely large number of one colour followed by a single element of the other then pop that single element off the stack. This would require two lists (before and after the single element) to be combined with ++, taking time linear to the size of the first list. Anyway, here's some code: module RBStack where data RBColour = Red | Blue deriving (Show, Eq) data RBStack a = RBStack { headColour :: RBColour, stackElems :: [[a]] } deriving (Show, Eq) otherCol :: RBColour -> RBColour otherCol Red = Blue otherCol Blue = Red empty :: RBStack a empty = RBStack Red [] push :: RBColour -> a -> RBStack a -> RBStack a push col val stack | null (stackElems stack) = RBStack col [[val]] | headColour stack == col = RBStack col ((val:e):es) | otherwise = RBStack col ([val]:e:es) where (e:es) = stackElems stack popColour :: RBColour -> RBStack a -> (Maybe a, RBStack a) popColour col stack | null (stackElems stack) = (Nothing, stack) | headColour stack == col = (Just (head e), if null (tail e) then (RBStack (otherCol col) es) else (RBStack col ((tail e):es))) | otherwise = if null es then (Nothing, empty) else let (f:fs) = es in (Just (head f), if null (tail f) then (if null fs then (RBStack (otherCol col) [e]) else (RBStack (otherCol col) ((e ++ (head fs)):(tail fs else RBStack (otherCol col) (e:(tail f):fs)) where (e:es) = stackElems stack pop :: RBStack a -> (Maybe (RBColour, a), RBStack a) pop stack | null (stackElems stack) = (Nothing, stack) | otherwise = (Just (col, head e), if null (tail e) then (RBStack (otherCol col) es) else (RBStack col ((tail e):es))) where (e:es) = stackElems stack col = headColour stack peek :: RBStack a -> Maybe (RBColour, a) peek = fst . pop ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Red-Blue Stack
There was a bug in there with popping the non-head colour off the stack. Updated code, please test thoroughly: module RBStack where data RBColour = Red | Blue deriving (Show, Eq) data RBStack a = RBStack { headColour :: RBColour, stackElems :: [[a]] } deriving (Show, Eq) otherCol :: RBColour -> RBColour otherCol Red = Blue otherCol Blue = Red empty :: RBStack a empty = RBStack Red [] push :: RBColour -> a -> RBStack a -> RBStack a push col val stack | null (stackElems stack) = RBStack col [[val]] | headColour stack == col = RBStack col ((val:e):es) | otherwise = RBStack col ([val]:e:es) where (e:es) = stackElems stack popColour :: RBColour -> RBStack a -> (Maybe a, RBStack a) popColour col stack | null (stackElems stack) = (Nothing, stack) | headColour stack == col = (Just (head e), if null (tail e) then (RBStack (otherCol col) es) else (RBStack col ((tail e):es))) | otherwise = if null es then (Nothing, stack) else let (f:fs) = es in (Just (head f), if null (tail f) then (if null fs then (RBStack (otherCol col) [e]) else (RBStack (otherCol col) ((e ++ (head fs)):(tail fs else RBStack (otherCol col) (e:(tail f):fs)) where (e:es) = stackElems stack pop :: RBStack a -> (Maybe (RBColour, a), RBStack a) pop stack | null (stackElems stack) = (Nothing, stack) | otherwise = (Just (col, head e), if null (tail e) then (RBStack (otherCol col) es) else (RBStack col ((tail e):es))) where (e:es) = stackElems stack col = headColour stack peek :: RBStack a -> Maybe (RBColour, a) peek = fst . pop ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] System.Process
On Tue, 30 Sep 2008 08:49:44 Andrew Coppin wrote: > Before anybody remarks that "words" will do this, consider the "echo" command, which treats whitespace meaningfully.) [EMAIL PROTECTED]:~/$ echo foo barbaz foo bar baz Echo doesn't receive special treatment. It joins its arguments with spaces. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Distributing Haskell binaries as OSX App Bundles
I wrote a command-line program recently for a friend in haskell. However, he's far away and not particularly computer literate. I sent him the raw binaries, but they came up with errors about not being able to find libgmp stuff. So then I thought I should probably be able to somehow distribute all the stuff together in a .app bundle. However, the only experience I have of doing this sort of stuff before is via xcode. What's the best way to go about this? It just occurred to me now that maybe cmake is the way to go? If you use the installer package version of GHC http://haskell.org/ghc/dist/6.8.3/chakravarty/GHC-6.8.3-i386.pkg GMP will automatically be linked statically. As far as creating app bundles, one way is to use xcode to to create the bundle structure and then have it call a conventional makefile based build system to do the actual build and install the binaries into the bundle structure. That's what I did to create the GHC.pkg. It might require some fiddling, though. Manuel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Total Functional Programming in Haskell
Hello, I recently had someone point me to this thread on LtU: http://lambda-the-ultimate.org/node/2003 The main paper in the article is this one: http://www.jucs.org/jucs_10_7/total_functional_programming/jucs_10_07_0751_0768_turner.pdf It leaves me with several questions: 1) Are there are existing Haskell-ish implementations of the total functional paradigm? 2) Could we restructure Haskell so that it comes in 3 layers, total functional core, lazy pure partial functional middle, and IO outer layer? The idea with #2 is that similar to how we use the type system to separate the purely functional from monadic, and in particular IO actions, can we make the inner most part of Haskell total? Furthermore, could we do this in a way that makes it easy to intermingle the three layers the way we can mingle pure Haskell with IO actions? Maybe instead of using (->) as the function constructor for total functions we use a different symbol, say (|->), and the compiler knows to use the more specialized semantics on those definitions. I'm not sure how make this work for values that are total functional versus values that are just pure (partial) functional. I'm also interested in hearing about the optimizations that would be possible when all your expressions are strongly normalizing. Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] state monad and continuation monads ...
Hello, I would like to read 1) pedagogical examples of State monad and the Continuation monad 2) library usage of these monads Regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] not able to compile Happy GLR examples
Thanks. I don't imagine that will help as the flag in the Happy source is (to my knowledge) outdated, indicating that it hasn't been touched in a while. On Mon Sep 29 19:05 , "Krzysztof Skrzętnicki" <[EMAIL PROTECTED]> sent: > with Happy, version 1.16. I'm using ghc version 6.6.1. I've looked at the Just looking at the GHC version number: perhaps update to 6.8.3 would help? Best regards Christopher Skrzętnicki Msg sent via CableONE.net MyMail - http://www.cableone.net___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell versus F#, OCaml, et. al. ...
Hello, Frank mode on ... ;^) In terms of functionality, where is Haskell superior vs inferior to ML, Caml, OCaml, F#, Erlang, etc.? E.g. in terms of library functionality? Regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hmm, what license to use?
Don Stewart <[EMAIL PROTECTED]> writes: > So if you use LGPL for your Haskell libraries, all of which are > currently statically linked and non-replaceable at runtime, it is > unlikely any commercial Haskell house can use the code. As already mentioned, you can ask the author nicely for a different license - BSD for instance. Or you can fix the dynamic linking issues in GHC, as Duncan points out. But you can also use it for *open source* software (which is non-proprietary, but may still be commercial). I think LGPL works nicely for open source software - unlike the GPL, which would force the entire program to be released under that license, there should be no problem shipping a BSD- or MPL-licensed program using an LGPL library, as long as source is available. -k -- 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] Haskell versus F#, OCaml, et. al. ...
vigalchin: >Hello, > > Frank mode on ... ;^) In terms of functionality, where is Haskell >superior vs inferior to ML, Caml, OCaml, F#, Erlang, etc.? E.g. in terms >of library functionality? > Without more information, all we can really do is an overview. There's almost 800 Haskell libraries on hackage.haskell.org (millions of lines of code). On average, 2 new libraries are released each day (though 12 new libs were released in the last 24 hours). That's 700 new libraries a year at the current rate. If I visit Arch Linux, I find, 602 Haskell libraries and tools,http://tinyurl.com/3jxlpl 21 OCaml libraries and tools, http://tinyurl.com/4fl485 7 Erlang libraries and tools, http://tinyurl.com/54oj7u 0 F# libraries and tools, http://tinyurl.com/4v53pl Of course, this is on Linux, and your distro may vary (and on Windows, F# gets to use all the .NET libraries), but you get the idea. One of the main themes that came out of the commercial users of FP meeting last week, http://cufp.galois.com was the need for languages to start building standard, blessed platforms of libraries, and to encourage reuse. Haskell was in the nice position of already having such a process underway, http://haskell.org/haskellwiki/Haskell_Platform Enjoy! -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell versus F#, OCaml, et. al. ...
thanks .. ... just trying to get an objective viewpoint and see where the "holes" are ... Vasili On Tue, Sep 30, 2008 at 1:46 AM, Don Stewart <[EMAIL PROTECTED]> wrote: > vigalchin: > >Hello, > > > > Frank mode on ... ;^) In terms of functionality, where is > Haskell > >superior vs inferior to ML, Caml, OCaml, F#, Erlang, etc.? E.g. in > terms > >of library functionality? > > > > Without more information, all we can really do is an overview. > > There's almost 800 Haskell libraries on hackage.haskell.org (millions of > lines of code). On average, 2 new libraries are released each day > (though 12 new libs were released in the last 24 hours). That's 700 new > libraries a year at the current rate. > > If I visit Arch Linux, I find, > >602 Haskell libraries and tools,http://tinyurl.com/3jxlpl > > 21 OCaml libraries and tools, http://tinyurl.com/4fl485 > > 7 Erlang libraries and tools, http://tinyurl.com/54oj7u > > 0 F# libraries and tools, http://tinyurl.com/4v53pl > > Of course, this is on Linux, and your distro may vary (and on Windows, > F# gets to use all the .NET libraries), but you get the idea. > > One of the main themes that came out of the commercial users of FP > meeting last week, > >http://cufp.galois.com > > was the need for languages to start building standard, blessed platforms > of libraries, and to encourage reuse. Haskell was in the nice position > of already having such a process underway, > >http://haskell.org/haskellwiki/Haskell_Platform > > Enjoy! > > -- Don > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe