Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Nicolas Wu
To repeat, the analogues in SML and Erlang *do* support multiple clauses (as well as pattern matching) and the failure of Haskell lambdas to do so has always seemed like a weird restriction in a language that's usually free of weird restrictions. I agree with this sentiment. I have never

Re: [Haskell-cafe] Re: Suggestions for improvement

2010-10-05 Thread Dominique Devriese
2010/10/5 N. Raghavendra ra...@mri.ernet.in: At 2010-10-03T22:45:30+02:00, Dominique Devriese wrote: comma :: (a - b) - (a - c) - a - (b,c) comma f g x = (f x, g x) comma = liftA2 (,) blowup = (uncurry (++)) . liftA2 (,) (blowup . allButLast) lastToTheLength I tried both of them, but

[Haskell-cafe] pointers for EDSL design

2010-10-05 Thread John Lato
Hello, I'm working on a prototype edsl (my first one), and I was wondering if there are any resources that discuss pros and cons of various implementation issues? I'm trying to decide what should be included in the edsl vs. re-using the meta language implementations (e.g. let-binding, lambdas).

[Haskell-cafe] Lazy evaluation from Why Functional programming matters

2010-10-05 Thread C K Kashyap
Hi All, I was going through the paper's lazy evaluation section where the square root example is given. It occurred to me that one could implement it in a modular way with just higher order functions (without the need for lazy evaluation that is). function f (within, eps, next, a0){

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Neil Brown
On 05/10/10 07:52, Nicolas Wu wrote: I'd prefer to see something like \ 1 - f | 2 - g but I'm sure something could be worked out. While I think the case of is a good idea, multiple clauses in lambdas seems more canonical to me. Alternatively, we could abandon

Re: [Haskell-cafe] pointers for EDSL design

2010-10-05 Thread C K Kashyap
Any advice or references would be very much appreciated. Best, Please check out the EDSL around the software build domain - * slides http://www.galois.com/~dons/talks/hiw-2010/ndm-shake.pdf * video http://www.vimeo.com/15465133 This one is around the music composition domain

Re: Re[2]: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Nicolas Pouillard
On Tue, 5 Oct 2010 03:36:12 -0600, Luke Palmer lrpal...@gmail.com wrote: On Mon, Oct 4, 2010 at 9:04 PM, Dean Herington heringtonla...@mindspring.com wrote: With respect to datatype destructing functions, the Prelude has: maybe :: b - (a - b) - Maybe a - b either :: (a - c) - (b - c) -

Re: [Haskell-cafe] Lazy evaluation from Why Functional programming matters

2010-10-05 Thread Hemanth Kapila
Hi, Let us try to rewrite the code in a more java-esque syntax: It translates to something like the below generic method. Correct? static T T function(IBoundsCheckT within, DeltaT eps, IteratorT iterator, T initValue){ T currVal = initVal; while(iterator.hasNext()){ T nextVal

Re: [Haskell-cafe] Lazy evaluation from Why Functional programming matters

2010-10-05 Thread C K Kashyap
Hi, Let us try to rewrite the code in a more java-esque syntax: It translates to something like the below generic method. Correct? static T T function(IBoundsCheckT within, DeltaT eps,  IteratorT iterator, T initValue){       T currVal = initVal;     while(iterator.hasNext()){         T

Re: [Haskell-cafe] Lazy evaluation from Why Functional programming matters

2010-10-05 Thread Brent Yorgey
On Tue, Oct 05, 2010 at 07:37:32PM +0530, C K Kashyap wrote: Hi, Let us try to rewrite the code in a more java-esque syntax: It translates to something like the below generic method. Correct? static T T function(IBoundsCheckT within, DeltaT eps,  IteratorT iterator, T initValue){       

Re: [Haskell-cafe] Lazy evaluation from Why Functional programming matters

2010-10-05 Thread Hemanth Kapila
I see ... I think I understand now. hmmm ... I am little disappointed though - does that mean that all the laziness cool stuffs can actually be done using iterators(generators)? As in, but for the inconvenient syntax, you can do it all in - say java? Yes. It would slightly easier in, say,

Re: [Haskell-cafe] Lazy evaluation from Why Functional programming matters

2010-10-05 Thread C K Kashyap
Yes. It would slightly easier in, say,  C# or C++. I think 'D' achieves its implementation of the 'lazy' keyword using a similar approach. But I did not understand why you are disappointed ? The disappointment was not on a serious note ... the thing is, I constantly run into discussions

Re: [Haskell-cafe] pointers for EDSL design

2010-10-05 Thread Stephen Tetley
Hello John If you are wanting variables, lambdas ... it sounds like you might be off-shoring - i.e. building a little language within Haskell that is executed on something else GPU (compiled to CUDA), compiled to C, compiled to VHDL, etc. Generally this is a deep-embedding as you need to produce

[Haskell-cafe] Re: Lazy evaluation from Why Functional programming matters

2010-10-05 Thread Ertugrul Soeylemez
C K Kashyap ckkash...@gmail.com wrote: Yes. It would slightly easier in, say,  C# or C++. I think 'D' achieves its implementation of the 'lazy' keyword using a similar approach. But I did not understand why you are disappointed ? The disappointment was not on a serious note ... the

Re: [Haskell-cafe] pointers for EDSL design

2010-10-05 Thread Sterling Clover
Stephen's list is great! Two more points of reference from the recent ICFP -- Geoff Mainland's Nikola [1], and a nice talk on Kansas Lava [2]. [1] http://www.eecs.harvard.edu/~mainland/publications/ [2] http://www.scribd.com/doc/38559736/kansaslava-hiw10 -- hopefully the video from the

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Gábor Lehel
I also vote +1 for lambda-case, and abstain for lambda-if. I don't think multiple-clause lambdas being desirable should be an argument against lambda-case. After all, we can also define top-level functions with either multiple clauses or a single case expression. Haskell has always followed the

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Ozgur Akgun
For what it's worth, after all this discussion my rather cheeky preference is as follows: Instead of introducing more specialised syntax, remove both existing special syntaxes for if and case, and introduce multi-clause support for lambdas! Cheers! On 2 October 2010 19:23, Max Bolingbroke

[Haskell-cafe] Re: Lazy evaluation from Why Functional programming matters

2010-10-05 Thread steffen
Don't be to disappointed. One can always kinda fake lazy evaluation using mutable cells. But not that elegantly. In the example given above, all being used is iterators as streams... this can also be expressed using lazy lists, true. But one big difference between e.g. lazy lists and iterators is,

Re: [Haskell-cafe] pointers for EDSL design

2010-10-05 Thread John Lato
Thanks for these, and also Stephen's extensive list. I think it's fair to say that I'm just exploring the space and don't know what I'm doing yet. As such, I'm pretty open to exploring ideas. I'm only familiar with a small fraction of these, so I've got some reading to do now! For my toy

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Henning Thielemann
Richard O'Keefe schrieb: I'd prefer to see something like \ 1 - f | 2 - g but I'm sure something could be worked out. In order to be consistent with current case, maybe in layout mode: \1 - f 2 - g and in non-layout mode \{1 - f; 2 - g} ?

Re: [Haskell-cafe] Lazy evaluation from Why Functional programming matters

2010-10-05 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/5/10 10:52 , C K Kashyap wrote: And I had built up this impression that laziness distinguished Haskell by a huge margin ... but it seems that is not the case. Hence the disappointment. Haskell is lazy-by-default and designed around lazy

Re: [Haskell-cafe] pointers for EDSL design

2010-10-05 Thread Stephen Tetley
Hi John For the user level stuff, I don't think CSound really has functions - either for the score or orchestra. The score I think is just a list of /notes/ with many, many parameters and the orchestra is a graph description saying how the UGens are connected. This is good news - I believe Pan,

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/5/10 12:38 , Henning Thielemann wrote: In order to be consistent with current case, maybe in layout mode: \1 - f 2 - g and in non-layout mode \{1 - f; 2 - g} +1; likewise for consistency it should support guards (which would

[Haskell-cafe] ByteString missing rewrite RULES (zipWith' f a = pack . zipWith f a)

2010-10-05 Thread Thomas DuBuisson
All, (I notice ByteString still isn't under l...@h.o ownership, which is good because this way I can avoid the bureaucracy and e-mail the maintainers directly) The following is a Data.ByteString comment for the (non-exported) function zipWith' -- -- | (...) Rewrite rules -- are used to

Re: [Haskell-cafe] ByteString missing rewrite RULES (zipWith' f a = pack . zipWith f a)

2010-10-05 Thread Jason Dusek
On Tue, Oct 5, 2010 at 18:07, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: If not, perhaps we could make chunkOverhead = max 16 (2 * sizeOf (undefined ::Int)) so it will be the same on 64 and 32 bit systems (a 128 bit boundary, nice and fast for most modern cipher algorithms, sadly

Re: [Haskell-cafe] ByteString missing rewrite RULES (zipWith' f a = pack . zipWith f a)

2010-10-05 Thread Thomas DuBuisson
 I don't have a horse in this race; but I am curious as to why  you wouldn't ask for `chunkOverhead = 16' as that seems to be  your intent as well as what the expression works out to on any  machine in common use. To avoid copying data when perform FFI calls to common cipher routines (such

[Haskell-cafe] darcs hacking sprint 15-17 Oct, Orleans

2010-10-05 Thread Eric Kow
Hi everybody, Just a quick reminder that the fifth Darcs hacking sprint is taking place in just ten days (Orleans, France, 15-17 Oct): http://wiki.darcs.net/Sprints/2010-10 It's still possible to attend, but you should contact Florent Becker (CC'ed) as soon as possible to confirm there are

Re: [Haskell-cafe] ByteString missing rewrite RULES (zipWith' f a = pack . zipWith f a)

2010-10-05 Thread Thomas DuBuisson
 I don't have a horse in this race; but I am curious as to why  you wouldn't ask for `chunkOverhead = 16' as that seems to be  your intent as well as what the expression works out to on any  machine in common use. Sorry, after I sent my long explanation I see what you are really asking. I

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Ketil Malde
Donn Cave d...@avvanta.com writes: I think you're not the first to ask. Just out of curiosity, or is there a use for these variations? Just that they seem to be natural generalizations. If it's just the single form of paramtrizing the condition, I think it's better served by a regular

Re: [Haskell-cafe] Big Arrays

2010-10-05 Thread Ketil Malde
Hemanth Kapila saihema...@gmail.com writes: Just out of curiosity, may I know a use case of such huge arrays? Bloom filters? At such sizes, I thought, the array would not have the expected array properties (constant access time) due to thrashing. Yes, but this is true for any array size,

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Donn Cave
Quoth Ketil Malde ke...@malde.org, ... Just that they seem to be natural generalizations. If it's just the single form of paramtrizing the condition, I think it's better served by a regular function, 'bool' or (??) or whatever. Well, yes, there's some logic to that. Like, bool b c a = if a

[Haskell-cafe] hClose: invalid argument (Invalid or incomplete multibyte or wide character)

2010-10-05 Thread Johannes Waldmann
I have this program main = writeFile check.out ü that's u-umlaut, and the source file is utf-8-encoded and ghc-6.12.3 compiles it without problems but when running, I get hClose: invalid argument (Invalid or incomplete multibyte or wide character) (debian 5.0.6, kernel 2.6.18-6-686. I know

Re: [Haskell-cafe] hClose: invalid argument (Invalid or incomplete multibyte or wide character)

2010-10-05 Thread Daniel Fischer
On Tuesday 05 October 2010 23:34:56, Johannes Waldmann wrote: I have this program main = writeFile check.out ? that's u-umlaut, and the source file is utf-8-encoded and ghc-6.12.3 compiles it without problems but when running, I get hClose: invalid argument (Invalid or incomplete

[Haskell-cafe] Re: hClose: invalid argument (Invalid or incomplete multibyte or wide character)

2010-10-05 Thread Johannes Waldmann
What does locale say your locale is? If it's *.UTF-8, it should work, if not, that's a likely cause. So, it was indeed C. I switched this - what now? Recompile? Just my application? All of ghc? ... ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Re: hClose: invalid argument (Invalid or incomplete multibyte or wide character)

2010-10-05 Thread Daniel Fischer
On Wednesday 06 October 2010 00:30:31, Johannes Waldmann wrote: What does locale say your locale is? If it's *.UTF-8, it should work, if not, that's a likely cause. So, it was indeed C. I switched this - what now? Recompile? Just my application? All of ghc? ... I think that would be

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Max Bolingbroke
On 5 October 2010 17:38, Henning Thielemann schlepp...@henning-thielemann.de wrote: Richard O'Keefe schrieb: I'd prefer to see something like       \ 1 - f       | 2 - g but I'm sure something could be worked out. In order to be consistent with current case, maybe in layout mode: \1 - f

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Max Bolingbroke
On 4 October 2010 00:38, Conal Elliott co...@conal.net wrote: I like it! Are the other sections available as well, e.g.,     (if False then else Cafe) Haskell -- Cafe They are not, though this would certainly make sense for lambda-if. It's not so clear with lambda-case because of the issue

[Haskell-cafe] Re: hClose: invalid argument (Invalid or incomplete multibyte or wide character)

2010-10-05 Thread Johannes Waldmann
My application was actually running as a CGI program and I needed some time to find out that I should put: SetEnv LC_ALL en_US.UTF-8 into /etc/apache2/sites-available/default ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Richard O'Keefe
On 6/10/2010, at 5:56 AM, Brandon S Allbery KF8NH wrote: In order to be consistent with current case, maybe in layout mode: \1 - f 2 - g and in non-layout mode \{1 - f; 2 - g} +1; likewise for consistency it should support guards (which would preclude using | the way Richard

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Evan Laforge
-1 for if then. The examples of curried if then else look, to my eyes, less readable than the pointed version. And it's easy enough to write a 'bool' deconstructor, or an 'ifM' for the monadic case. +1 for something to solve the dummy - m; case dummy of problem. Here are the possibilities I can

[Haskell-cafe] Haskell Platform: failed to parse output of 'ghc-pkg dump'

2010-10-05 Thread Tom Hawkins
I'm having trouble installing Haskell Platform on Windows. After the install, I run cabal update, which appears to work: 00-index.tar.gz is deposited in C:/Documents and Settings/user/Application Data/cabal/packages/hackage.haskell.org. However, when I try to cabal install anything, I get:

[Haskell-cafe] Re: Haskell Platform: failed to parse output of 'ghc-pkg dump'

2010-10-05 Thread Tom Hawkins
Classic pilot error. I had an old cabal.exe on the search path. -Tom On Tue, Oct 5, 2010 at 8:09 PM, Tom Hawkins tomahawk...@gmail.com wrote: I'm having trouble installing Haskell Platform on Windows.  After the install, I run cabal update, which appears to work: 00-index.tar.gz is deposited

Re: [Haskell-cafe] Big Arrays

2010-10-05 Thread Hemanth Kapila
Thanks Ketil. On Wed, Oct 6, 2010 at 1:36 AM, Ketil Malde ke...@malde.org wrote: Just out of curiosity, may I know a use case of such huge arrays? Bloom filters? Am probably dense - I still did not get an idea of where would one use such a big array. Let us say, we are using a bit-array of

Re: Re[2]: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Dean Herington Elizabeth Lacey
At 3:36 AM -0600 10/5/10, Luke Palmer wrote: On Mon, Oct 4, 2010 at 9:04 PM, Dean Herington heringtonla...@mindspring.com wrote: With respect to datatype destructing functions, the Prelude has: maybe :: b - (a - b) - Maybe a - b either :: (a - c) - (b - c) - Either a b - c which suggests