Re: [Haskell-cafe] Small question

2007-08-11 Thread Stefan O'Rear
On Sat, Aug 11, 2007 at 12:06:23AM -0400, David Menendez wrote: On 8/10/07, Andrew Coppin [EMAIL PROTECTED] wrote: My program needs to make decisions based on a pair of boolean values. Encoding both values as a single algebraic data type means I have to keep taking it apart so I can work

Re: [Haskell-cafe] Explaining monads

2007-08-11 Thread David Menendez
On 8/10/07, Ronald Guida [EMAIL PROTECTED] wrote: Kim-Ee Yeoh wrote: Monads are undoubtedly more pervasive, and that could be because there aren't as many arrow and comonad tutorials, atomic ones or otherwise. Moreover, Comonad isn't even in the standard libraries (Hoogle returns no

Re: [Haskell-cafe] Explaining monads

2007-08-11 Thread Donald Bruce Stewart
ronguida: Monads are undoubtedly more pervasive, and that could be because there aren't as many arrow and comonad tutorials, atomic ones or otherwise. Moreover, Comonad isn't even in the standard libraries (Hoogle returns no results for it). When I searched for tutorials on monads, I

[Haskell-cafe] zip3, zip4 ... - zipn?

2007-08-11 Thread Frank Buss
Is it possible to write a function like this: zipn n list_1 list_2 list_3 ... list_n which implements zip3 for n=3, zip4 for n=4 etc.? Looks like variable number of arguments are possible, like printf shows, so a general zipn should be possible, too. If it is possible, why there are functions

Re: [Haskell-cafe] Explaining monads

2007-08-11 Thread Kim-Ee Yeoh
Ronald Guida wrote: Here's my interpretation of the table: -- Structure | Subject | Action| Verb | Result +--+++-- function| a | a-b

Re: [Haskell-cafe] Haskell vs GC'd imperative languages, threading, parallelizeability (is that a word? :-D )

2007-08-11 Thread Andrew Coppin
Spencer Janssen wrote: On Friday 10 August 2007 12:37:31 Andrew Coppin wrote: Stefan O'Rear wrote: Bool is 32 bits, but Don is using UArray. UArray is not parametric in the element type. Would be nice if it *could* somehow be parametric... but I have absolutely no idea how

Re: [Haskell-cafe] zip3, zip4 ... - zipn?

2007-08-11 Thread Joel Koerwer
Frank, The return type of zipn would have to depend on the number of arguments. If you are satisfied with all arguments having the same type, then you can use transpose: zipn list1 list2 .. listn = transpose [list1, list2, .. listn] Can we make a polyvariadic zipn that returns a [HList]? Seems

Re: [Haskell-cafe] zip3, zip4 ... - zipn?

2007-08-11 Thread Hugh Perkins
I was looking for something like this too. Note that Erlang can do this ;-) but Erlang is probably not so strongly typed, so it's easier to do? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] howto install ghc-6.7.* ?

2007-08-11 Thread Marc A. Ziegert
i just don't get it. please, can anybody explaim me how to do that? i tried it the last few days with ghc-6.7.20070807, ghc-6.7.20070809, and ghc-6.7.20070810. it always results in a broken library (without Prelude): # ghc-pkg list /usr/local/lib/ghc-6.7.20070810/package.conf:

[Haskell-cafe] arrow question HXT related

2007-08-11 Thread Andrea Rossato
Hi, I think this is just a stupid arrow question. Still I cannot find where my mistake is located. Suppose I have a simple xml document I want to process with HXT: root elem sub / risubtext/risub /elem /root After extracting elem I want to duplicate the children trees with the arrow

[Haskell-cafe] Re: Small question [new Wiki page up]

2007-08-11 Thread Andrew Coppin
Stefan O'Rear wrote: Good idea! Maybe it could be fit into the GHC Performance Resource somehow? (http://www.haskell.org/haskellwiki/Performance/GHC) OK. But it'll probably contain a lot of guessing to start with... ;-) Wiki pages can be fixed. Private misunderstandings

Re: [Haskell-cafe] arrow question HXT related

2007-08-11 Thread Andrea Rossato
On Sat, Aug 11, 2007 at 11:50:19AM +0200, Andrea Rossato wrote: Hi, I think this is just a stupid arrow question. Still I cannot find where my mistake is located. well, it was not an arrow problem but a HXT problem. This new version of tryMe2 does work as expected: tryMe2 = runLA arrow []

[Haskell-cafe] Re: Language support for imperative code. Was: Re: monad subexpressions

2007-08-11 Thread apfelmus
Brian Hulley schrieb: apfelmus wrote: However, most genuinely imperative things are often just a building block for a higher level functional model. The ByteString library is a good example: the interface is purely functional, the internals are explicit memory control. It's a bad idea to let

Re: [Haskell-cafe] How odd...

2007-08-11 Thread Jacques Carette
[Sorry for the long quote, but context is important] Dan Piponi wrote: It's fairly standard practice, when documenting functions of a complex variable, to specify precisely which 'branch cuts' are being used. Here's a quote from the Mathematica documentation describing their Log function:

[Haskell-cafe] Re: zip3, zip4 ... - zipn?

2007-08-11 Thread apfelmus
Frank Buss schrieb: Is it possible to write a function like this: zipn n list_1 list_2 list_3 ... list_n which implements zip3 for n=3, zip4 for n=4 etc.? Looks like variable number of arguments are possible, like printf shows, so a general zipn should be possible, too. If it is possible, why

Re: [Haskell-cafe] zip3, zip4 ... - zipn?

2007-08-11 Thread Brent Yorgey
On 8/11/07, Frank Buss [EMAIL PROTECTED] wrote: Is it possible to write a function like this: zipn n list_1 list_2 list_3 ... list_n which implements zip3 for n=3, zip4 for n=4 etc.? Looks like variable number of arguments are possible, like printf shows, so a general zipn should be

Re: [Haskell-cafe] Defining new operators

2007-08-11 Thread Brent Yorgey
On 8/10/07, Shachaf Ben-Kiki [EMAIL PROTECTED] wrote: Also consider using: data Step = Step { ..., scenario :: Scenario, ... } Just to expand on Shachaf's answer, when defining a data type you can use a special record syntax to give names to each of the components, like this: data Monkey

Re: [Haskell-cafe] Dynamic thread management?

2007-08-11 Thread Neil Bartlett
Hugh, I certainly think it would be wrong to declare that NDP is doomed to failure... not because you would be making an enemy of SPJ (I'm pretty sure you wouldn't!) but because it actually aims to solves a less ambitious problem: the problem of parallelising the SAME task applied to different

Re: [Haskell-cafe] Re: zip3, zip4 ... - zipn?

2007-08-11 Thread Per Vognsen
On 8/11/07, apfelmus [EMAIL PROTECTED] wrote: Frank Buss schrieb: Is it possible to write a function like this: zipn n list_1 list_2 list_3 ... list_n which implements zip3 for n=3, zip4 for n=4 etc.? Looks like variable number of arguments are possible, like printf shows, so a

Re: [Haskell-cafe] Dynamic thread management?

2007-08-11 Thread Brian Hurt
You guys might also want to take a look at the Cilk programming language, and how it managed threads. If you know C, learning Cilk is about 2 hours of work, as it's C with half a dozen extra keywords and a few new concepts. I'd love to see Cilk - C + Haskell as a programming language. The

Re: [Haskell-cafe] Dynamic thread management?

2007-08-11 Thread Andrew Coppin
Brian Hurt wrote: The key idea of Cilk is that it's easier to deparallelize than it is to parallelize, especially automatically. So the idea is that the program is written incredibly parallel, with huge numbers of microthreads, which are (on average) very cheap to spawn. The runtime then

Re: [Haskell-cafe] Dynamic thread management?

2007-08-11 Thread Sebastian Sylvan
On 11/08/07, Brian Hurt [EMAIL PROTECTED] wrote: You guys might also want to take a look at the Cilk programming language, and how it managed threads. If you know C, learning Cilk is about 2 hours of work, as it's C with half a dozen extra keywords and a few new concepts. I'd love to see

[Haskell-cafe] Haddock: documenting parameters of functional arguments

2007-08-11 Thread Henning Thielemann
I like to write documentation comments like fix :: ( a {- ^ local argument -} - a {- ^ local output -} ) - a {- ^ global output -} but Haddock doesn't allow it. Or is there a trick to get it work? ___ Haskell-Cafe mailing list

Re[2]: [Haskell-cafe] Dynamic thread management?

2007-08-11 Thread Bulat Ziganshin
Hello Brian, Saturday, August 11, 2007, 8:35:49 PM, you wrote: The key idea of Cilk is that it's easier to deparallelize than it is to parallelize, especially automatically. So the idea is that the program is written incredibly parallel, with huge numbers of microthreads, which are (on

Re: [Haskell-cafe] Explaining monads

2007-08-11 Thread Ronald Guida
David Menendez wrote: Be sure to read sigpfe's You could have invented monads! and the Wadler paper. http://sigfpe.blogspot.com/2006/08/you-could-have-invented-monads-and.html http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf Most tutorials try to explain what a monad

[Haskell-cafe] Re: zip3, zip4 ... - zipn?

2007-08-11 Thread Chung-chieh Shan
Frank Buss [EMAIL PROTECTED] wrote in article [EMAIL PROTECTED] in gmane.comp.lang.haskell.cafe: Is it possible to write a function like this: zipn n list_1 list_2 list_3 ... list_n which implements zip3 for n=3, zip4 for n=4 etc.? Looks like variable number of arguments are possible,

[Haskell-cafe] Re: default for quotRem in terms of divMod?

2007-08-11 Thread Henning Thielemann
Btw. is there any application, where 'quot' and 'rem' are needed? All occurrences of 'quot' and 'rem' I found in code so far were actually wrong and should have been 'div' and 'mod'. http://www.haskell.org/haskellwiki/Things_to_avoid#Forget_about_quot_and_rem

Re: [Haskell-cafe] Explaining monads

2007-08-11 Thread Stefan O'Rear
On Sat, Aug 11, 2007 at 03:00:04PM -0400, Ronald Guida wrote: The question remains: What is special about Monad or ArrowApply, compared to Arrow? or What is more general about Arrow, compared to Monad or ArrowApply? If all you have is an Arrow, then you must make up your mind what you're going

Re: [Haskell-cafe] zip3, zip4 ... - zipn?

2007-08-11 Thread Stefan O'Rear
On Sat, Aug 11, 2007 at 05:27:19PM +0800, Hugh Perkins wrote: I was looking for something like this too. Note that Erlang can do this ;-) but Erlang is probably not so strongly typed, so it's easier to do? I think the main issue is that Erlang doesn't use currying (IIRC). Currying makes it

Re: [Haskell-cafe] Re: default for quotRem in terms of divMod?

2007-08-11 Thread Derek Elkins
On Sat, 2007-08-11 at 21:10 +0200, Henning Thielemann wrote: Btw. is there any application, where 'quot' and 'rem' are needed? All occurrences of 'quot' and 'rem' I found in code so far were actually wrong and should have been 'div' and 'mod'.

Re: [Haskell-cafe] howto install ghc-6.7.* ?

2007-08-11 Thread Stefan O'Rear
On Sat, Aug 11, 2007 at 11:44:17AM +0200, Marc A. Ziegert wrote: i just don't get it. please, can anybody explaim me how to do that? i tried it the last few days with ghc-6.7.20070807, ghc-6.7.20070809, and ghc-6.7.20070810. it always results in a broken library (without Prelude): #

[Haskell-cafe] IO within parser

2007-08-11 Thread Gregory Propf
I've been struggling with writing a parser that needs to parse include files within source files. So far I cannot get this to work (in reality to get work done I wrote a kludge that returns a list of include filenames to be run later in a pure IO function. I realized that this just amounted

Re: [Haskell-cafe] IO within parser

2007-08-11 Thread Andrew Coppin
Gregory Propf wrote: I've been struggling with writing a parser that needs to parse include files within source files. So far I cannot get this to work (in reality to get work done I wrote a kludge that returns a list of include filenames to be run later in a pure IO function. I realized

Re: [Haskell-cafe] Re: zip3, zip4 ... - zipn?

2007-08-11 Thread Marc Weber
Also, applicative functors can help GHCi :m +Control.Applicative GHCi (\x y z - x*(y+z)) $ ZipList [1,2,3] * ZipList [-1,0,1] * ZipList [1,1,1] ZipList [0,2,6] GHCi http://www.soi.city.ac.uk/~ross/papers/Applicative.pdf quote The general scheme is as follows: (page 2) Marc

Re: [Haskell-cafe] Re: default for quotRem in terms of divMod?

2007-08-11 Thread Isaac Dupree
Henning Thielemann wrote: Btw. is there any application, where 'quot' and 'rem' are needed? All occurrences of 'quot' and 'rem' I found in code so far were actually wrong and should have been 'div' and 'mod'. http://www.haskell.org/haskellwiki/Things_to_avoid#Forget_about_quot_and_rem Yes, my

Re: [Haskell-cafe] Re: default for quotRem in terms of divMod?

2007-08-11 Thread Isaac Dupree
Isaac Dupree wrote: I do think that if you almost always want to _use_ div and mod, you should be able to just define div and mod too (not quot and rem) that was unclear - I mean you should have that choice, not that it should be disallowed to define quot and rem only! Isaac

Re: [Haskell-cafe] howto install ghc-6.7.* ?

2007-08-11 Thread Ryan Dickie
Same problem here. I downloaded the ghc-6.7.20070811.tar.bz2 snapshot build on amd64 under ubuntu. From the README The sh boot step is only necessary if this is a tree checked out from darcs. For source distributions downloaded from GHC's web site, this step has already been performed. On

Re: [Haskell-cafe] Dynamic thread management?

2007-08-11 Thread Brian Hurt
On Sat, 11 Aug 2007, Sebastian Sylvan wrote: How is this any better than using par in Haskell? Mainly how the threads are actually scheduled. Mind you, I'm an *incredible* Haskell newbie, so take all of my comments with a 5-pound salt block, but as I understand how the current

Re: [Haskell-cafe] zip3, zip4 ... - zipn?

2007-08-11 Thread Stefan O'Rear
On Sun, Aug 12, 2007 at 12:56:31PM +1000, Alexis Hazell wrote: On Sunday 12 August 2007 05:24, Stefan O'Rear wrote: Currying makes it MUCH harder to implement varargs functions. That's interesting - why is that the case? varsum 2 3 -- varsum receives 2, and returns a function, which

[Haskell-cafe] Infinity v0.1

2007-08-11 Thread Austin Seipp
Hello! Over the past couple of days I've been working on an IRC bot in the essence of lambdabot; that is, it should be extendable through plugins and plugins should be easy to write, modify and contribute. I also wanted the bot to be small in terms of LOC (as of 0.1, about ~360 including the two

Re: [Haskell-cafe] Re: towards a new foundation for set theory with atoms

2007-08-11 Thread Brandon Michael Moore
On Fri, Aug 10, 2007 at 03:54:23PM -0700, Greg Meredith wrote: Haskellians, A quick follow up. If you look at the code that i have written there is a great deal of repeated structure. Each of these different kinds of sets and atoms are isomorphic copies of each other. Because, however, of

Fw: [Haskell-cafe] IO within parser

2007-08-11 Thread Gregory Propf
Well the docs ( http://legacy.cs.uu.nl/daan/download/parsec/parsec.html ) hint that setInput and getInput are good for this. I can certainly how they *would* be - if I knew how to pull in files within the parse. Actually I use those functions to do multiple recursive passes but of course you