Re: [Haskell-cafe] class default method proposal

2007-12-12 Thread Luke Palmer
On Dec 11, 2007 3:19 PM, David Menendez <[EMAIL PROTECTED]> wrote: > On Dec 11, 2007 9:20 AM, Duncan Coutts <[EMAIL PROTECTED]> wrote: > > > So my suggestion is that we let classes declare default implementations > > of methods from super-classes. > > > Does this proposal have any unintended conse

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Benja Fallenstein
On Dec 13, 2007 2:28 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote: > Although on reflection, I think I might like the following compromise > with Tillmann's version best: > > main = interact $ perLine $ detab 0 where > detab tab ('\t':cs) = replicate (4-tab) ' ' ++ detab 0 cs

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Benja Fallenstein
On Dec 13, 2007 2:20 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote: > Another version of detab: > > main = interact $ perLine $ concat . snd. mapAccumL f 0 where > f tab '\t' = (0, replicate (4-tab) ' ') > f tab char = ((tab+1) `mod` 4, [char]) Although on reflection, I think I might lik

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Benja Fallenstein
Another version of detab: main = interact $ perLine $ concat . snd. mapAccumL f 0 where f tab '\t' = (0, replicate (4-tab) ' ') f tab char = ((tab+1) `mod` 4, [char]) - Benja ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.hask

Re: [Haskell-cafe] Re: Software Tools in Haskell

2007-12-12 Thread Conal Elliott
Since there are many useful per-line functions, do a little refactoring, placing the following into a library: perLine :: (String -> String) -> (String -> String) perLine f = unlines . map f . lines On Dec 12, 2007 12:43 PM, apfelmus <[EMAIL PROTECTED]> wrote: > Tommy M McGuire wrote: > > (

Re: [Haskell-cafe] GUI

2007-12-12 Thread Miguel Mitrofanov
I've seen an Objective C binding for Haskell; haven't used it yet. 13.12.2007, в 2:58, Marc A. Ziegert писал(а): Am Mittwoch, 12. Dezember 2007 schrieb Miguel Mitrofanov: Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's not "native" on my Mac; some Mac users don't install

Re: [Haskell-cafe] GUI

2007-12-12 Thread Marc A. Ziegert
Am Mittwoch, 12. Dezember 2007 schrieb Miguel Mitrofanov: > Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's > not "native" on my Mac; some Mac users don't install it and almost > all Mac users don't always run it. the problem is Apple. if you want to have a native gui on

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Tommy M McGuire
Don Stewart wrote: My thoughts too when reading the initial post was that it was all very low level imperative programming. Not of the Haskell flavour. -- Don Oh, heck yeah. As I was thinking when I was translating it, "I can't even say I'm writing Pascal code using Haskell; I wouldn't writ

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Tillmann Rendel
Hi Tommy, detab is one of the programs I do not like. I kept the "direct translation" approach up through that, but I think it really hides the simplicity there; detab copies its input to its output replacing tabs with 1-8 spaces, based on where the tab occurs in a line. The only interestin

Re: [Haskell-cafe] Re: Software Tools in Haskell

2007-12-12 Thread Tommy M McGuire
apfelmus wrote: Tommy M McGuire wrote: (Plus, interact is scary. :-D ) You have a scary feeling for a moment, then it passes. ;) tabwidth = 4 -- tabstop !! (col-1) == there is a tabstop at column col -- This is an infinite list, so no need to limit the line width tabstops =

Re: [Haskell-cafe] ANNOUNCE: dataenc-0.10.1

2007-12-12 Thread Duncan Coutts
On Wed, 2007-12-12 at 13:30 +, Magnus Therning wrote: > The visible change is the addition of a function, decode', that allows > lazier decoding by shifting some responisility to the user. That's interesting. It's in the same spirit as the lazy variant provided in the iconv lib. It'll be in

Re[2]: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Bulat Ziganshin
Hello Andrew, Thursday, December 13, 2007, 12:40:59 AM, you wrote: >> Knuth[1] pp. 417-419 discusses Fibonacci trees and Fibonacci search. >> According to Knuth (and who am I to argue with him) Fibonacci search has >> better average case running time than binary search, although worst case >> can

Re: [Haskell-cafe] class default method proposal

2007-12-12 Thread Lennart Augustsson
I had it pretty well worked out for single parameter type classes, but I couldn't see any nice extension to multiple parameters. On Dec 11, 2007 5:30 PM, Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: > | If it really would work ok we should get it fully specified and > | implemented so we can fix

Re: [Haskell-cafe] Folding Integrals

2007-12-12 Thread Lennart Augustsson
Not "can", "should". And it might even survive in th world of Unicode. On Dec 12, 2007 4:17 PM, Brent Yorgey <[EMAIL PROTECTED]> wrote: > > On Dec 12, 2007 10:36 AM, Arie Groeneveld <[EMAIL PROTECTED]> wrote: > > > Reinier Lamers schreef: > > > > > > printint :: Int -> [Char] > > > printint = ma

Re: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Andrew Coppin
Bill Wood wrote: On Wed, 2007-12-12 at 11:19 +, Andrew Coppin wrote: . . . ...and normal programmers care about the Fibonacci numbers because...? Seriously, there are many, many programmers who don't even know what Fibonacci numbers *are*. And even I can't think of a useful purpose f

Re: [Haskell-cafe] eager/strict eval katas

2007-12-12 Thread Benja Fallenstein
On Dec 12, 2007 9:58 PM, Don Stewart <[EMAIL PROTECTED]> wrote: > And no need to even use custom ones, just use the library strict pairs, > > > http://hackage.haskell.org/packages/archive/strict/0.2/doc/html/Data-Strict-Tuple.html Oh, good! :) 'nother Haskell lesson learned. Thanks, - Benja

Re: [Haskell-cafe] eager/strict eval katas

2007-12-12 Thread Dan Weston
Dan Weston wrote: scanl above is not strict in its second argument. The data dependencies cause the strictness. Cf: Prelude> head ([1,3] ++ head ((scanl undefined undefined) undefined)) 1 The first claim is of course false, nore would the example show it anyway. scanl is not strict in its th

Re: [Haskell-cafe] eager/strict eval katas

2007-12-12 Thread Don Stewart
benja.fallenstein: > Hi Thomas, > > On Dec 12, 2007 5:31 PM, Thomas Hartman <[EMAIL PROTECTED]> wrote: > > (solution involves building an accum list of (average,listLength) tuples. > > again you can't do a naive fold due to stack overflow, but in this case even > > strict foldl' from data.list i

Re: [Haskell-cafe] ANNOUNCE: A ReadP style parser for ByteStrings

2007-12-12 Thread Don Stewart
gracjanpolak: > > I'm happy to announce a ReadP style parser for ByteStrings, > Text.ParserCombinators.ReadP.ByteString. > > http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestringreadp > > Text.ParserCombinators.ReadP.ByteString is an adaptation of > Text.ParserCombinators.ReadP t

Re: [Haskell-cafe] eager/strict eval katas

2007-12-12 Thread Benja Fallenstein
Hi Thomas, On Dec 12, 2007 5:31 PM, Thomas Hartman <[EMAIL PROTECTED]> wrote: > (solution involves building an accum list of (average,listLength) tuples. > again you can't do a naive fold due to stack overflow, but in this case even > strict foldl' from data.list isn't "strict enough", I had to

Re: [Haskell-cafe] eager/strict eval katas

2007-12-12 Thread Dan Weston
Thomas Hartman wrote: >Note that 1 + ··· + n = n * (n+1) / 2, so the average of [1..n] is (n+1) / 2 fair enough. But I believe if I restate the problem so that you need to find the average of an arbitrary list, your clever trick doesn't work and we need eager eval or we blow the stack.

[Haskell-cafe] Re: Software Tools in Haskell

2007-12-12 Thread apfelmus
Tommy M McGuire wrote: (Plus, interact is scary. :-D ) You have a scary feeling for a moment, then it passes. ;) Gwern Branwen wrote: I... I want to provide a one-liner for 'detab', but it looks impressively monstrous and I'm not sure I understand it. On the other hand, I'm not looking for

Re: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Emre Sahin
> Andrew Coppin <[EMAIL PROTECTED]> writes: > [...] > Yeah, we should probably set up a seperate list for this > stuff... Agreed. :) This type of general discussions cannot be concluded. A board of bored Haskellers socialize themselves. To be honest, I didn't read that thing (

Re: [Haskell-cafe] eager/strict eval katas

2007-12-12 Thread Thomas Hartman
>Note that 1 + ··· + n = n * (n+1) / 2, so the average of [1..n] is (n+1) / 2 fair enough. But I believe if I restate the problem so that you need to find the average of an arbitrary list, your clever trick doesn't work and we need eager eval or we blow the stack. Also... on second thought, I

Re: [Haskell-cafe] GUI

2007-12-12 Thread Brandon S. Allbery KF8NH
On Dec 12, 2007, at 14:51 , Felipe Lessa wrote: On Dec 12, 2007 5:40 PM, Miguel Mitrofanov <[EMAIL PROTECTED]> wrote: Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's not "native" on my Mac; some Mac users don't install it and almost all Mac users don't always run it. G

Re: [Haskell-cafe] GUI

2007-12-12 Thread Conal Elliott
I prefer the elegant high-level style of wxhaskell over the current state of gtk2hs. duncan has said he's interested in making a gtk2hs more elegant, and daan has said he'll start supporting wxhaskell again. i don't know which will happen first. - Conal On Dec 12, 2007 11:47 AM, Neil Mitchell <

Re: [Haskell-cafe] GUI

2007-12-12 Thread Felipe Lessa
On Dec 12, 2007 5:40 PM, Miguel Mitrofanov <[EMAIL PROTECTED]> wrote: > Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's > not "native" on my Mac; some Mac users don't install it and almost > all Mac users don't always run it. Gtk is going native on Mac: http://developer.imend

Re: [Haskell-cafe] GUI

2007-12-12 Thread Brandon S. Allbery KF8NH
On Dec 12, 2007, at 14:47 , Neil Mitchell wrote: Hi Is there any really cross-platform GUI library for Haskell? Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's not "native" on my Mac; some Mac users don't install it and almost all Mac users don't always run it. On Win

Re: [Haskell-cafe] GUI

2007-12-12 Thread Neil Mitchell
Hi > Is there any really cross-platform GUI library for Haskell? > > Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's > not "native" on my Mac; some Mac users don't install it and almost > all Mac users don't always run it. On Windows, Gtk2hs is not as native as wxHaskell, bu

[Haskell-cafe] GUI

2007-12-12 Thread Miguel Mitrofanov
Is there any really cross-platform GUI library for Haskell? Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's not "native" on my Mac; some Mac users don't install it and almost all Mac users don't always run it. I was able to install wxHaskell (after some hacking - this

Re: [Haskell-cafe] eager/strict eval katas

2007-12-12 Thread Felipe Lessa
On Dec 12, 2007 2:31 PM, Thomas Hartman <[EMAIL PROTECTED]> wrote: > exercise 2) find the first integer such that average of [1..n] is > [10^6] > (solution involves building an accum list of (average,listLength) tuples. > again you can't do a naive fold due to stack overflow, but in this case eve

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Conal Elliott
Here's a version with cleaner separation between pure & IO: main = interact $ show . length . words - Conal On Dec 12, 2007 11:12 AM, Neil Mitchell <[EMAIL PROTECTED]> wrote: > Hi > > Having got to the word counting example on the website: > > wordcount :: IO () > wordcount = do >

[Haskell-cafe] PHP/code generation libraries?

2007-12-12 Thread Justin Bailey
I'm working on a project which would generate a PHP data-access layer from a Haskell model. I'm wondering what libraries might be already be available for generating PHP or other types of code. The pretty-printing library is one option. Any other suggestions? Thanks in advance. Justin ___

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Don Stewart
ndmitchell: > Hi > > Having got to the word counting example on the website: > > wordcount :: IO () > wordcount = do > wc <- wordcount' False 0 > putStrLn (show wc) > where > wordcount' inword wc = do >ch <- getc >

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Neil Mitchell
Hi Having got to the word counting example on the website: wordcount :: IO () wordcount = do wc <- wordcount' False 0 putStrLn (show wc) where wordcount' inword wc = do ch <- getc case ch of

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Neil Mitchell
Hi > main = do (print . showln . length) =<< getContents >where showln a = show a ++ "\n" This can be written better. print puts a newline at the end and does a show, so lets remove that bit: main = do (print . length) =<< getContents Now we aren't using do notation, despite having a do blo

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Tommy M McGuire
Gwern Branwen wrote: Some of those really look like they could be simpler, like 'copy' - couldn't that simply be 'main = interact (id)'? Have you seen ? For example, 'charcount' could be a lot simpler - 'charcount = showln . length' would work,

Re: [Haskell-cafe] class default method proposal

2007-12-12 Thread Twan van Laarhoven
Simon Peyton-Jones wrote: Concerning (b) here's a suggestion. As now, require that every instance requires an instance declaration. So, in the main example of http://haskell.org/haskellwiki/Class_system_extension_proposal, for a new data type T you'd write instance Monad T where

Re: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Bill Wood
On Wed, 2007-12-12 at 11:19 +, Andrew Coppin wrote: . . . > ...and normal programmers care about the Fibonacci numbers because...? > > Seriously, there are many, many programmers who don't even know what > Fibonacci numbers *are*. And even I can't think of a useful purpose for > them. (Un

[Haskell-cafe] Re: [darcs-devel] announcing darcs 2.0.0pre1, the first prerelease for darcs 2

2007-12-12 Thread zooko
Dear darcs-devel folks: Oh by the way, let me say: "HOORAY!". I suspected that darcs 2 was never going to actually happen, and now I see that it *is* going to happen! Way to go! This breathes new life into the darcs project! Regards, Zooko __

[Haskell-cafe] re: generics and grammars

2007-12-12 Thread Greg Meredith
Ken, Thanks for the references! Have two-level types been applied to parser generation? Best wishes, --greg Greg Meredith <[EMAIL PROTECTED]> wrote in article <[EMAIL PROTECTED] > > in gmane.comp.lang.haskell.cafe: > > Here is an idea so obvious that someone else must have already thought > of

[Haskell-cafe] eager/strict eval katas

2007-12-12 Thread Thomas Hartman
I'm trying to get a better handle on eager/strict eval in haskell, and a great way to do this is by building up from simple exercises to harder exercises. So far I have exercise 1) add the integers [1..10^6] (stack overflows if you do a naive fold, as described on wiki) exercise 2) find the

Re: [Haskell-cafe] Folding Integrals

2007-12-12 Thread Brent Yorgey
On Dec 12, 2007 10:36 AM, Arie Groeneveld <[EMAIL PROTECTED]> wrote: > Reinier Lamers schreef: > > > > printint :: Int -> [Char] > > printint = map chr . map (+0x30) . reverse . map (`mod` 10) . > > takeWhile (>0) . iterate (`div`10) > > > Most of the time I use this: > > digits :: Integer -> [Int

Re: [Haskell-cafe] Folding Integrals

2007-12-12 Thread Arie Groeneveld
Reinier Lamers schreef: > > printint :: Int -> [Char] > printint = map chr . map (+0x30) . reverse . map (`mod` 10) . > takeWhile (>0) . iterate (`div`10) > Most of the time I use this: digits :: Integer -> [Int] digits = map (flip(-)48.ord) . show Regards =@@i ___

Re: [Haskell-cafe] IO is a bad example for Monads

2007-12-12 Thread Hans van Thiel
On Wed, 2007-12-12 at 16:27 +0100, Hans van Thiel wrote: > [snip] > > > > I fear those people can do vast amounts of damage. :( > > > > When inept programming yields the wrong result, it is clear (even to the > > inept) that the program is bad. > > > > When the result is correct but there are e

[Haskell-cafe] ANNOUNCE: dataenc-0.10.1

2007-12-12 Thread Magnus Therning
Yesterday I uploaded a small update to the dataenc library: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dataenc-0.10.1 Dependenciesbase License LGPL Copyright Magnus Therning, 2007 Author Magnus Therning Maintainer [EMAIL PROTECTED] Exposed modules Codec.Binary.DataE

Re: [Haskell-cafe] class default method proposal

2007-12-12 Thread Yitzchak Gale
Simon Peyton-Jones wrote: Given "instance C T where ...", for any method 'm' not defined by "...": for every class D of which C is a superclass where there is an instance for (D T) see if the instance gives a binding for 'm' If this search finds exactly one bin

[Haskell-cafe] ANNOUNCE: dataenc-0.10.1

2007-12-12 Thread Magnus Therning
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yesterday I uploaded a small update to the dataenc library: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dataenc-0.10.1 Dependenciesbase License LGPL Copyright Magnus Therning, 2007 Author Magnus Therning Maintainer [EMAI

Re: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Reinier Lamers
Andrew Coppin wrote: Yeah, we should probably set up a seperate list for this stuff... Perhaps you can use http://haskell.org/haskellwiki/?title=Talk:FrontpageDraft&action=edit ? That page is also a better place to fight your edit wars than the front page is. Reinier _

Re: [Haskell-cafe] Re: New slogan for haskell.org

2007-12-12 Thread Henning Thielemann
On Wed, 12 Dec 2007, apfelmus wrote: > gwern wrote: > > Now, the Main Page on haskell.org is not protected, so I could just edit > > in one of the better descriptions proposed, but as in my Wikipedia editing, > > I like to have consensus especially for such visible changes. > > Hey, why has the f

Re: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Andrew Coppin
Emre Sahin wrote: Why don't you let Haskell speak for itself? Instead of putting such buzzwords nobody really understands (and cares), put random problem descriptions and one-line solutions in Haskell. Well known problems like Fibonacci, Quicksort, etc. may be good candidates, even "add 1 to all

Re: [Haskell-cafe] Folding Integrals

2007-12-12 Thread Henning Thielemann
On Wed, 12 Dec 2007, Reinier Lamers wrote: > Back in my Introduction to Functional Programming course, Daan Leijen > demonstrated how to print integers in Haskell using function > composition. Something along the lines of: > > printint :: Int -> [Char] > printint = map chr . map (+0x30) . reverse

[Haskell-cafe] Re: New slogan for haskell.org

2007-12-12 Thread apfelmus
gwern wrote: Now, the Main Page on haskell.org is not protected, so I could just edit in one of the better descriptions proposed, but as in my Wikipedia editing, I like to have consensus especially for such visible changes. Hey, why has the front-page already been changed then? I don't like ne

Re: [haskell-art] [Haskell-cafe] library to read/write audio files

2007-12-12 Thread Rohan Drape
hello john & stefan, Stefan Kersten <[EMAIL PROTECTED]> writes: > incidentally, i've been working on libsndfile bindings the last few > days; here's the darcs repository: > > http://darcs.k-hornz.de/cgi-bin/darcsweb.cgi?r=hsndfile;a=summary excellent news! i have, _much_ more incidentally, a si

Re: [Haskell-cafe] Folding Integrals

2007-12-12 Thread Reinier Lamers
Mattias Bengtsson wrote: I found myself writing this for an Euler-problem: digits :: Int -> [Int] digits i | i < 10= [i] | otherwise = i `mod` 10 : digits ( i `div` 10 ) And i realised it was quite some time ago (before this function) i had actually written any explicitly

Re: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Michael Vanier
Bayley, Alistair wrote: From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derek Elkins (Not directed at gwern in particular) I have a better idea. Let's decide to do nothing. The benefits of this approach are: 1) it takes zero effort to implement, 2) the number of peo

RE: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Bayley, Alistair
> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Derek Elkins > (Not directed at gwern in particular) > > I have a better idea. Let's decide to do nothing. The > benefits of this > approach are: 1) it takes zero effort to implement, 2) the number of > people who immediately

Re: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Henning Thielemann
On Wed, 12 Dec 2007, Emre Sahin wrote: > > How do you think the description could be improved? > > Why don't you let Haskell speak for itself? > > Instead of putting such buzzwords nobody really understands (and > cares), put random problem descriptions and one-line solutions in > Haskell. We

Re: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Emre Sahin
> gwern0 <[EMAIL PROTECTED]> writes: > If the reader is still interested and still takes Haskell > seriously after puzzling over the foregoing, this would either > be pointless or off-putting. Well, *of course* there are > compilers for most computers. You aren't a serious

Re: [Haskell-cafe] Folding Integrals

2007-12-12 Thread Henning Thielemann
On Wed, 12 Dec 2007, Mattias Bengtsson wrote: > I found myself writing this for an Euler-problem: > > > digits :: Int -> [Int] > > digits i | i < 10= [i] > > | otherwise = i `mod` 10 : digits ( i `div` 10 ) > > And i realised it was quite some time ago (before this function) i had >

Re[2]: [Haskell-cafe] New slogan for haskell.org

2007-12-12 Thread Bulat Ziganshin
Hello Steve, Wednesday, December 12, 2007, 6:47:36 AM, you wrote: > * clear distinction between functional and imperative (is this > really an advantage? almost everything I deal with is IO, network, > and db related, what is left for purely functional?) if your program has simple computations