Re: [Haskell-cafe] Ideas

2007-08-26 Thread Andrew Coppin
Evan Laforge wrote: Indeed, you can write certain DSP algorithms beautifully in Haskell. Now, if only it could talk to the audio hardware... (Or just use common file formats even.) Oh, that's easy. I wrote an FFI interface to portaudio a while back to write a delay-looping type utility

Re: [Haskell-cafe] Re: Parsec is being weird at me

2007-08-26 Thread Andrew Coppin
Chris Casinghino wrote: On 8/25/07, Andrew Coppin [EMAIL PROTECTED] wrote: I thought the whole *purpose* of the endBy combinator was to keep applying one parser until the other one succeeds? I don't think this is a lookahead problem, but rather just a misreading of the spec of

Re: [Haskell-cafe] Re: Parsec is being weird at me

2007-08-26 Thread Andrew Coppin
Chris Casinghino wrote: On 8/25/07, Chris Casinghino [EMAIL PROTECTED] wrote: I'm not sure there is a built in combinator for what you want, I guess I should have looked harder. What you want is manyTill: manyTill :: GenParser tok st a - GenParser tok st end - GenParser tok st [a]

Re: [Haskell-cafe] Ideas

2007-08-26 Thread Claude Heiland-Allen
Evan Laforge wrote: The only thing I'm uncertain about is whether it would have good enough time and space performance. All the real work is writing yet another set of basic envelope, oscillator, and fft primitives. You *should* be able to go all the way down to the samples in pure haskell

[Haskell-cafe] Files for Hugs on Zaurus

2007-08-26 Thread Ulrich Vollert
Hi Phillipa, Hugs is fast enough for me to work on the Zaurus. I packed together all the files which belong to Hugs on my Zaurus and I hope that I didnt miss something. Unpack them to /, the files will stay in usr/local/bin, usr/local/lib and usr/local/share. If you want to use Hugs not only

Re: [Haskell-cafe] Style

2007-08-26 Thread Yitzchak Gale
Bjorn Bringert wrote: Here's a much more inefficient version, but it has the merit of being very easy to understand: tm_silly n = length $ takeWhile (=='0') $ reverse $ show $ product [1..n] Be careful with types - use Data.List.genericLength here instead of length. Otherwise, tm_silly n is

Re: [Haskell-cafe] Text.Xhtml.Strict

2007-08-26 Thread Henning Thielemann
On Sat, 25 Aug 2007, Marco Túlio Gontijo e Silva wrote: Hello there. I don't know if it's off topic, but I don't know where else to ask. I've been using Text.Xhtml.Strict, and I'm wondering why the functions are mostly Html - Html and not HTML a = a - Html, or something similar. If they were

Re: [Haskell-cafe] Converting CTime - Int

2007-08-26 Thread Sven Panne
[ Sorry for the *extremely* slow response, but I'm currently working through my backlog of 6000 mails... :-P ] On Wednesday 16 May 2007 09:35, Tomasz Zielonka wrote: I wonder why CTime is not Integral - maybe there is no such guarantee for time_t? If so, then you shouldn't rely on Enum. The

Re: [Haskell-cafe] Ideas

2007-08-26 Thread Henning Thielemann
On Sat, 25 Aug 2007, Andrew Coppin wrote: Would be nice if I could build something in Haskell that overcomes these. OTOH, does Haskell have any way to talk to the audio hardware? Maybe a JACK interface? http://haskell.org/haskellwiki/Applications_and_libraries/Music_and_sound

Re: [Haskell-cafe] :, infix operator, infix constructor, et cetera

2007-08-26 Thread Isaac Dupree
Andrew Coppin wrote: Daniel C. Bastos wrote: But that won't compile, because it doesn't obey the syntax rules of Haskell. You could, however, write data List x = x : (List x) | End and it would work. 1 : (2 : (3 : End)) Except that (for no particularly good reason) : is a reserved

Re: [Haskell-cafe] Ideas

2007-08-26 Thread Henning Thielemann
On Sat, 25 Aug 2007, Evan Laforge wrote: Reaktor has a few limitations though. 1. It's virtually impossible to debug the thing! (I.e., if your synth doesn't work... good luck working out why.) 2. It lacks looping capabilities. For example, you cannot build a variable-size convolution block -

[Haskell-cafe] Audio output (Was: Re: Ideas)

2007-08-26 Thread Henning Thielemann
On Sat, 25 Aug 2007, Andrew Coppin wrote: Evan Laforge wrote: To get this back to haskell, at the time I wondered if a more natural implementation might be possible in haskell, seeing as it was more naturally lazy. Not sure how to implement the behaviours though (which were simply macros

Re: [Haskell-cafe] Ideas

2007-08-26 Thread Henning Thielemann
On Sat, 25 Aug 2007, Andrew Coppin wrote: How easy would it be to make / would anybody care / has somebody already made ... in Haskell? - An interactive function plotter. (GNUplot is nice, but it can't plot recursive functions...) I'm be interested to use such a library. - A graphical

Re: [Haskell-cafe] Ideas

2007-08-26 Thread Henning Thielemann
On Sun, 26 Aug 2007, Andrew Coppin wrote: The only thing I'm uncertain about is whether it would have good enough time and space performance. All the real work is writing yet another set of basic envelope, oscillator, and fft primitives. You *should* be able to go all the way down to the

Re: [Haskell-cafe] Style

2007-08-26 Thread Chaddaï Fouché
2007/8/26, Yitzchak Gale [EMAIL PROTECTED]: Bjorn Bringert wrote: Here's a much more inefficient version, but it has the merit of being very easy to understand: tm_silly n = length $ takeWhile (=='0') $ reverse $ show $ product [1..n] Be careful with types - use Data.List.genericLength

Re: [Haskell-cafe] :, infix operator, infix constructor, et cetera

2007-08-26 Thread Andrew Coppin
Isaac Dupree wrote: Andrew Coppin wrote: Daniel C. Bastos wrote: But that won't compile, because it doesn't obey the syntax rules of Haskell. You could, however, write data List x = x : (List x) | End and it would work. 1 : (2 : (3 : End)) Except that (for no particularly good reason)

[Haskell-cafe] Norvig's Sudoku Solver in Haskell

2007-08-26 Thread manu
Hello, After reading Peter Norvig's take on writing a Sudoku solver (http:// norvig.com/sudoku.html) I decided that I would port his program to Haskell, without changing the algorithm, that'll make a nice exercise I thought and should be fairly easy... Boy, was I wrong ! Anyway, I

Re: [Haskell-cafe] is there a way to run tests at compile time using TH

2007-08-26 Thread Chris Mears
Alex Jacobson [EMAIL PROTECTED] writes: I'd like to have code not compile if it doesn't pass the tests. Is there a way to use TH to generate compiler errors if the tests don't pass? What about something like this? import Language.Haskell.TH import Tests -- this should

Re: [Haskell-cafe] :, infix operator, infix constructor, et cetera

2007-08-26 Thread Ian Lynagh
On Sun, Aug 26, 2007 at 01:35:33PM +0100, Andrew Coppin wrote: Isaac Dupree wrote: Except that (for no particularly good reason) : is a reserved symbol Really? That's interesting... AFAIK, according to the Report, it shouldn't be. It is; from

Re: [Haskell-cafe] is there a way to run tests at compile time using TH

2007-08-26 Thread Ian Lynagh
On Sun, Aug 26, 2007 at 01:20:52AM -0700, Alex Jacobson wrote: I'd like to have code not compile if it doesn't pass the tests. Is there a way to use TH to generate compiler errors if the tests don't pass? This should do it, in a different module to that which defines runtests: $( case

Re: [Haskell-cafe] renderString problems

2007-08-26 Thread Sven Panne
On Wednesday 01 August 2007 18:30, Dave Tapley wrote: I'm having a lot of trouble using renderString from Graphics.UI.GLUT.Fonts. All my attempts to render a StrokeFont have so far failed. Using a BitmapFont I can get strings to appear but they demonstrate the odd behaviour of translating

Re: [Haskell-cafe] renderString problems

2007-08-26 Thread Martin DeMello
On 8/26/07, Sven Panne [EMAIL PROTECTED] wrote: This is actually not a bug, but a feature. :-) From the Haddock docs for renderString: Render the string in the named font, without using any display lists. Rendering a

Re: [Haskell-cafe] Re: Parsec is being weird at me

2007-08-26 Thread Chris Casinghino
On 8/26/07, Andrew Coppin [EMAIL PROTECTED] wrote: ...so then what does sepEndBy do? With endBy, the sequence must end with the separator, with sepEndBy, the final occurrence of the separator is optional. The documentation here is very good: http://legacy.cs.uu.nl/daan/parsec.html --Chris

Re: [Haskell-cafe] Style

2007-08-26 Thread Yitzchak Gale
I wrote: Be careful with types - use Data.List.genericLength here instead of length. Otherwise, tm_silly n is wrong for n = 13 (on my 32-bit machine) due to round-off error in the Int type. Are you sure you really tested tm_silly ? length is perfectly enough to count the 0 in n! since the

[Haskell-cafe] nested datatypes

2007-08-26 Thread Thomas Girod
Hi there. recently I was trying to represent complex data by defining several datatypes and nesting them, such as data Foo = Foo { foo :: Bar } deriving (Eq,Show) data Bar = Bar { bar :: Int } deriving (Eq,Show) To change only a part of the data, syntactic sugar is quite convenient. But

Re: [Haskell-cafe] Norvig's Sudoku Solver in Haskell

2007-08-26 Thread Derek Elkins
On Sun, 2007-08-26 at 14:50 +0200, manu wrote: Hello, After reading Peter Norvig's take on writing a Sudoku solver (http:// norvig.com/sudoku.html) I decided that I would port his program to Haskell, without changing the algorithm, that'll make a nice exercise I thought and should be

Re: [Haskell-cafe] Norvig's Sudoku Solver in Haskell

2007-08-26 Thread Malte Milatz
manu [EMAIL PROTECTED]: After reading Peter Norvig's take on writing a Sudoku solver (http:// norvig.com/sudoku.html) I decided that I would port his program to Haskell Your program was wrapped by your mail client, so you may want to hpaste your program for easier digestion. Being a

[Haskell-cafe] Re: Ideas

2007-08-26 Thread John MacFarlane
+++ Andrew Coppin [Aug 25 07 12:50 ]: How easy would it be to make / would anybody care / has somebody already made ... in Haskell? - A wiki program. (Ditto.) I wrote a simple wiki using HAppS and pandoc. See demonstration #15 on the pandoc web page:

[Haskell-cafe] Re: Hugs on Zaurus

2007-08-26 Thread Radosław Grzanka
2007/8/26, Ulrich Vollert [EMAIL PROTECTED]: Haskell could run on such a platform. Ofcourse this is completly other way around in terms of power and memory. :) But anyway, did anyone do it? I compiled Hugs for my Sharp Zaurus SL-C3200 (http://www.trisoft.de) which is a PDA with an ARM

Re: [Haskell-cafe] Ideas

2007-08-26 Thread luc.taesch
John MacFarlane wrote: +++ Andrew Coppin [Aug 25 07 12:50 ]: I wrote a simple wiki using HAppS and pandoc. See demonstration #15 on the pandoc web page: http://sophos.berkeley.edu/macfarlane/pandoc/examples.html o Hey ! that s exactly whatI had in mind.. cool indeed, I am

[Haskell-cafe] Re: nested datatypes

2007-08-26 Thread apfelmus
(Note that the term nested data type also/already carries the meaning non-regular data type, an example being data PerfectBinaryTree a = One a | Succ (PerfectBinaryTree (a,a)) ) Thomas Girod wrote: recently I was trying to represent complex data by defining several datatypes and nesting

[Haskell-cafe] Re: Ideas

2007-08-26 Thread John MacFarlane
may i ask you what did you had in mind as an application when you started that ? This was just recreational programming: I wanted to see what writing a web application in Haskell would be like. I think it would be great to have a fully featured wiki program in Haskell, but I don't have time to

Re: [Haskell-cafe] Re: Parsec is being weird at me

2007-08-26 Thread Andrew Coppin
Chris Casinghino wrote: On 8/26/07, Andrew Coppin [EMAIL PROTECTED] wrote: ...so then what does sepEndBy do? With endBy, the sequence must end with the separator, with sepEndBy, the final occurrence of the separator is optional. Oh. I see... *sigh* Another wetware error. :-/

Re: [Haskell-cafe] Norvig's Sudoku Solver in Haskell

2007-08-26 Thread Yitzchak Gale
Hi Manu, You wrote: After reading Peter Norvig's take on writing a Sudoku solver (http:// norvig.com/sudoku.html) I decided that I would port his program to Haskell, without changing the algorithm, that'll make a nice exercise I thought and should be fairly easy... Boy, was I wrong !

Re: [Haskell-cafe] Norvig's Sudoku Solver in Haskell

2007-08-26 Thread Yitzchak Gale
Manu wrote: Should I introduce more strictness ? replace lists with more efficient data structures (ByteStrings, Arrays) ? Derek wrote: Yes. Treating lists like arrays is always a recipe for heartbreak. Here it costs very little - the lists are all short, mostly of length exactly 9. If

Re: [Haskell-cafe] Norvig's Sudoku Solver in Haskell

2007-08-26 Thread manu
From: Malte Milatz [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] Norvig's Sudoku Solver in Haskell Your program was wrapped by your mail client, so you may want to hpaste your program for easier digestion. here it is : http://hpaste.org/2452 Your profiling output suggests that much time

[Haskell-cafe] arrows-.02 fails when rebuilding ghc 6.6.1

2007-08-26 Thread Luc TAESCH
I try download and build 6.6.1 ( as ubntu has just 6.6 on package) and most went ok ( compiler and most libs) but arrows i tried and download arrow 0.2 from hackage but no more success any ideas ? ( knowing 6.6 is also on the machine if that matters) [EMAIL PROTECTED]:~/src/arrows-0.2$ runghc

Re: [Haskell-cafe] arrows-.02 fails when rebuilding ghc 6.6.1

2007-08-26 Thread Ross Paterson
On Sun, Aug 26, 2007 at 11:16:17PM +0200, Luc TAESCH wrote: I try download and build 6.6.1 ( as ubntu has just 6.6 on package) and most went ok ( compiler and most libs) but arrows i tried and download arrow 0.2 from hackage but no more success You need to change the Extensions line in

[Haskell-cafe] Re: Ideas

2007-08-26 Thread Luc TAESCH
thanks John for replying... when building , i cannot find the lcs mentionned in the cabal file not on hasckage nor on goggle. could you help? ( your papers on philosophy looks quite serious .. impressive you are in haskell too .. math backgroud ? logics ?) 2007/8/26, John MacFarlane [EMAIL

Re: [Haskell-cafe] Norvig's Sudoku Solver in Haskell

2007-08-26 Thread Yitzchak Gale
I wrote: Perhaps you would gain something if you used Data.Map.! instead of your lookup. Manu wrote: I'm not sure I understand, do you mean I should have use a strict Map constructor ? like : Map !key !value ? No, there is an operator in Data.Map called !. how can it replace the lookup

[Haskell-cafe] Re: Ideas

2007-08-26 Thread John MacFarlane
lcs can be found at http://urchin.earth.li/darcs/igloo/lcs/ +++ Luc TAESCH [Aug 26 07 23:45 ]: when building , i cannot find the lcs mentionned in the cabal file not on hasckage nor on goggle. could you help? ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Style

2007-08-26 Thread Chaddaï Fouché
2007/8/26, Yitzchak Gale [EMAIL PROTECTED]: True, that is not the problem. Using length forces the result to be Int, which is different than all of the other tm's so far. So for example, try this: [n | n - [0..25], tm_silly n /= tm n] You mean to say that tm_silly returns Int, which

[Haskell-cafe] Help understanding a partial application

2007-08-26 Thread Levi Stephen
Hi, I was browsing through the source code for Data.Foldable and having trouble comprehending it (which was kind of the point of browsing the code, so I could learn something ;) ) I'm looking at foldl foldl :: (c - d - c) - c - t d - c foldl f z t = appEndo (getDual (foldMap (Dual . Endo .

[Haskell-cafe] Geometry

2007-08-26 Thread Tony Morris
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I went camping on the weekend and a friend of mine who is a builder asked me many questions on geometry as they apply to his every day work - - most of which I could answer. However, there was one that I couldn't and I am having trouble googling a

Re: [Haskell-cafe] Geometry

2007-08-26 Thread Joel Koerwer
Hi Tony, x is called the sagitta. At least when making a telescope mirror it is[1]. By bisecting your angle with another radius, you'll see that you have a right triangle with hypotenuse a, and legs of length (b/2) and (a-x). Then sagitta a b = a - sqrt (a*a - b*b/4) Considered as a function

Re: [Haskell-cafe] Geometry

2007-08-26 Thread Chaddaï Fouché
You've got a which is the radius of the circle, and b which is the length of the arc, thus you've got the angle between the two red radiuses : u = b / a So with basic trigonometry, we can deduce a - x = a * cos(u/2) x = a *( cos(u/2) - 1) -- Jedaï ___

Re: [Haskell-cafe] Geometry

2007-08-26 Thread Stefan O'Rear
On Mon, Aug 27, 2007 at 11:04:58AM +1000, Tony Morris wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I went camping on the weekend and a friend of mine who is a builder asked me many questions on geometry as they apply to his every day work - - most of which I could answer.

Re: [Haskell-cafe] Geometry

2007-08-26 Thread Chaddaï Fouché
2007/8/27, Chaddaï Fouché [EMAIL PROTECTED]: You've got a which is the radius of the circle, and b which is the length of the arc, thus you've got the angle between the two red radiuses : u = b / a So with basic trigonometry, we can deduce a - x = a * cos(u/2) x = a *( cos(u/2) - 1) --

Re: [Haskell-cafe] Geometry

2007-08-26 Thread Steve Schafer
On Mon, 27 Aug 2007 11:04:58 +1000, you wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I went camping on the weekend and a friend of mine who is a builder asked me many questions on geometry as they apply to his every day work - - most of which I could answer. However, there was one that

Re: [Haskell-cafe] Geometry

2007-08-26 Thread Steve Schafer
On Sun, 26 Aug 2007 21:30:30 -0400, you wrote: I don't know offhand if there's a straightforward way to arrive at this result without using trigonometry. Duh. Of course there is Steve Schafer Fenestra Technologies Corp. http://www.fenestra.com/

Re: [Haskell-cafe] Help understanding a partial application

2007-08-26 Thread Ryan Ingram
Just expand out the function composition: Dual . Endo . flip f = (\x - Dual (Endo (flip f x))) which has the type d - Dual (Endo c). -- ryan On 8/26/07, Levi Stephen [EMAIL PROTECTED] wrote: Hi, I was browsing through the source code for Data.Foldable and having trouble

Re: [Haskell-cafe] Help understanding a partial application

2007-08-26 Thread Levi Stephen
Ryan Ingram wrote: Just expand out the function composition: Dual . Endo . flip f = (\x - Dual (Endo (flip f x))) which has the type d - Dual (Endo c). -- ryan Aha. I didn't get this straight away, but once I looked at the type signature for function composition, it became clear.