Re: [Haskell-cafe] ANN: MIME Strike Force

2007-03-20 Thread Bjorn Bringert
On Mar 18, 2007, at 21:36 , Jeremy Shaw wrote: Hello, If you have tried to do any MIME processing using Haskell, you are likely to have found two things: 1) There are a lot of MIME libraries for Haskell 2) None of them do everything you want So, I propose that we form a MIME Strike Force

Re: [Haskell-cafe] Search monad

2007-03-20 Thread Tomasz Zielonka
On Mon, Mar 19, 2007 at 05:11:19PM +, Edsko de Vries wrote: What I'm wondering about is if this monad is an instance of a more general monad(if so, which one?), and generally if people have any comments about these definitions. It's like the Writer monad used with different monoids.

Re: [Haskell-cafe] flip fix and iterate (was: Lazy IO and closing of file handles)

2007-03-20 Thread Alistair Bayley
On 20/03/07, Bryan Burgers [EMAIL PROTECTED] wrote: On the topic of 'fix', is there any good tutorial for fix? I quite liked this one: http://dreamsongs.org/Files/WhyOfY.pdf Alistair ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Matrices in Haskell

2007-03-20 Thread Vincent Kraeutler
Matthew Brecknell wrote: Ivan Miljenovic: As such, I'd like to know if there's any way of storing a an n-by-n matrix such that the algorithm/function to get either the rows or the columns is less than O(n^2) like transposition is. I did try using an Array, but my (admittedly hurried and

[Haskell-cafe] Re: Two Other AI Sources

2007-03-20 Thread DavidA
I would also recommend Mitchell, Machine Learning. I have quite a lot of Haskell code for stuff in this book, which I'm currently polishing for publishing. (For example, I'm rather proud of my thirty line neural network code.) ___ Haskell-Cafe

Re: [Haskell-cafe] what I learnt from my first serious haskell programm

2007-03-20 Thread Fawzi Mohamed
oops, I realized now that my answer did not go to the list. For the record here is it: Thanks to everybody for the answers and to Henning Thielemann for the useful links: http://haskell.org/haskellwiki/Qualified_names http://haskell.org/haskellwiki/Category:Style I agree with apfelmus

Re: [Haskell-cafe] what I learnt from my first serious haskell programm

2007-03-20 Thread Fawzi Mohamed
Bulat Ziganshin wrote: Hello Fawzi, Monday, March 19, 2007, 8:26:33 PM, you wrote: Maybe I did not express me clearly enough, I think that classes are useful (and the language that I was speaking of, aldor, has them), but it is not nice that the only way to have an overloaded function is

Re: [Haskell-cafe] what I learnt from my first serious haskell programm

2007-03-20 Thread Fawzi Mohamed
David House wrote: On 19/03/07, Fawzi Mohamed [EMAIL PROTECTED] wrote: Vectors don't act like numbers, a vector space is not a field, even if they have some common operations. As I said in my previous email, this is because Num is too big. We need to split it down, but there's no sane way of

Re: [Haskell-cafe] flip fix and iterate

2007-03-20 Thread Jules Bean
Matthew Brecknell wrote: There is the question of whether it's preferable to use the let form or the fix form for embedding a recursive function in the middle of a do-block. I don't know if there's any consensus on this question, but it seems to me to be about whether one prefers to read a

Re: [Haskell-cafe] Lazy IO and closing of file handles

2007-03-20 Thread Claus Reinke
[left-fold operator for enumerating the lines of a text file] .. enumLines :: (a - String - Either a a) - a - FilePath - IO a enumLines iter accum filename = do h - openFile filename ReadMode flip fix accum $ \iterate accum - do try_line - try (hGetLine h) case try_line of

Re: [Haskell-cafe] Matrices in Haskell

2007-03-20 Thread Claus Reinke
When you tried using Arrays, I presume you used an array indexed by a pair (i,j), and just reversed the order of the index pair to switch from row-wise to column-wise access? It's hard to see how that would slow you down. Perhaps the slowdown was caused by excessive array copying? the

[Haskell-cafe] NYTimes.com: John W. Backus, 82, Fortran Developer, Dies

2007-03-20 Thread paul . hudak
This page was sent to you by: [EMAIL PROTECTED] John Backus, inventor of Fortran, Turing Award winner, and also an early pioneer in functional programming, died Saturday at his home in Oregon. Many of us have fond memories of him in the earlier days of our careers, and we all owe a lot to him

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Thomas Hartman
Just thought I'd add another potentially helpful bit to this oneliner / shell scripting thread. Though to be fair, this perhaps strains the definition of one in one liner. This takes a long file containing mostly numerical data, filters out the numerical data, and sorts it numerically. (Not the

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Thomas Hartman
To answer my own post, the Data.List.sort *is* necessary. Otherwise, you get alphabetic sort. 2007/3/20, Thomas Hartman [EMAIL PROTECTED]: Just thought I'd add another potentially helpful bit to this oneliner / shell scripting thread. Though to be fair, this perhaps strains the definition of

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Thomas Hartman
Same thing, but with better comments and whitespace. [EMAIL PROTECTED]:~/learning/haskell/UnixToolshead -n30 sortNumeric.sh cat out_select_char_length_csv.out | ghc -e ' interact $ unlines -- take 10 from the end -- more efficient than -- reverse . take 10 . reverse

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Dougal Stanton
Quoth Thomas Hartman, nevermore, This takes a long file containing mostly numerical data, filters out the numerical data, and sorts it numerically. (Not the same thing as sorting alphabetically, which is what you get by default, or using the unix sort utility). Maybe there's some flag to make

[Haskell-cafe] Haskell and a new web developement mailinglist?

2007-03-20 Thread Marc Weber
I've been talking to Chris Eidhof the last days and we'd like to suggest adding another specialized haskell mailinglist: Haskell and web developement. I think the global interest will increase in the feature, libraries are evolving and it would be nice to have a place to discuss them. Any

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Thomas Hartman
You contributed #12:14 Thunder @pl \s - drop (length s - n) s #12:14 lambdabot drop = subtract n . length But, on second thought, 1) I can't use this as a drop-in replacement for the non points free (right term?) version, and 2) I don't really understand it. Still, I would be curious to see

Re: [Haskell-cafe] Matrices in Haskell

2007-03-20 Thread Vincent Kraeutler
Claus Reinke wrote: When you tried using Arrays, I presume you used an array indexed by a pair (i,j), and just reversed the order of the index pair to switch from row-wise to column-wise access? It's hard to see how that would slow you down. Perhaps the slowdown was caused by excessive array

[Haskell-cafe] Haskell-cafe] Haskell and a new web developement mailinglist?

2007-03-20 Thread Dimitry Golubovsky
Marco Weber wrote: I've been talking to Chris Eidhof the last days and we'd like to suggest adding another specialized haskell mailinglist: Haskell and web developement. I support the idea to have such a mailing list. Thanks. -- Dimitry Golubovsky Anywhere on the Web

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Lutz Donnerhacke
* Thomas Hartman wrote: You contributed #12:14 Thunder @pl s - drop (length s - n) s #12:14 lambdabot drop = subtract n . length But, on second thought, 1) I can't use this as a drop-in replacement for the non points free (right term?) version, and 2) I don't really understand it. I did

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Jules Bean
Thomas Hartman wrote: To answer my own post, the Data.List.sort *is* necessary. Otherwise, you get alphabetic sort. Which is why you do the Set trick at a different stage in the process, like this: interact $ unlines . map show -- more efficient than -- reverse . take 10 . reverse . (

Re[2]: [Haskell-cafe] what I learnt from my first serious haskell programm

2007-03-20 Thread Bulat Ziganshin
Hello Fawzi, Tuesday, March 20, 2007, 1:47:48 PM, you wrote: That was the reason that is spoke of aldor ( http://www.aldor.com ), as it has type inference, but yes indeed this makes type inference much more difficult and undefined in some cases (also haskell extensions make inference in

[Haskell-cafe] Newbie vs. laziness

2007-03-20 Thread Alex Queiroz
Hallo list, I don't quite get how ($!) works. I have this function: dbCreateIndices con dtn dof = do let dummy = newDbItem let query = SELECT id FROM ++ (dtn dummy) ++ ORDER BY ++ (dof dummy) ids - liftM (map fromSql . concat ) $! quickQuery con query [] return $ IntMap.fromList

Re: [Haskell-cafe] Newbie vs. laziness

2007-03-20 Thread Jules Bean
Alex Queiroz wrote: quickQuery returns a lazy list of results, and I expected ($!) to make it strict. But my program crashes if I use it this way. But, if I add a print to the function: 'Making things strict' isn't that simple. What $! does is force its arguments into WHNF before applying the

Re: [Haskell-cafe] Newbie vs. laziness

2007-03-20 Thread Alex Queiroz
Hallo, On 3/20/07, Jules Bean [EMAIL PROTECTED] wrote: What $! does is force its arguments into WHNF before applying the function. WHNF means, roughly, either a lambda or a constructor at the top-level. I think I got it now. However that's a bit clumsy. What kind of error are you

Re: [Haskell-cafe] Newbie vs. laziness

2007-03-20 Thread Jules Bean
Alex Queiroz wrote: However that's a bit clumsy. What kind of error are you seeing when you say 'it crashes'? I must fetch all rows of the result, otherwise the database will be in an inconsistent state and all subsequent queries crash the application. Fetching all rows automatically

Re: [Haskell-cafe] what I learnt from my first serious haskell programm

2007-03-20 Thread Fawzi Mohamed
Bulat Ziganshin wrote: Hello Fawzi, Tuesday, March 20, 2007, 1:47:48 PM, you wrote: That was the reason that is spoke of aldor ( http://www.aldor.com ), as ehm http://www.aldor.org it has type inference, but yes indeed this makes type inference much more difficult and undefined in

Re: [Haskell-cafe] Haskell and a new web developement mailinglist?

2007-03-20 Thread David House
On 20/03/07, Marc Weber [EMAIL PROTECTED] wrote: I've been talking to Chris Eidhof the last days and we'd like to suggest adding another specialized haskell mailinglist: Haskell and web developement. I'd love to contribute here. You should be able to find an appropriate email to ask for this

Re: [Haskell-cafe] Matrices in Haskell

2007-03-20 Thread Claus Reinke
it seems unlikely to me that this would cause a degradation in performance with respect to lists... that might depend on the number of operations per transposition, i guess. lists and explicit transpositions make it very obvious what is going on in terms of iteration order, so i would be

[Haskell-cafe] Re: Matrices in Haskell

2007-03-20 Thread apfelmus
Ivan Miljenovic wrote: (a primitive Sudoku solver, to be precise) Concerning Sudoku, there is a beautiful talk from R. Bird http://icfp06.cs.uchicago.edu/bird-talk.pdf The other problem with using a list of lists is that the only reason I'm sure that the matrix is valid (i.e. all the

Re: [Haskell-cafe] Two Other AI Sources

2007-03-20 Thread Jacques Carette
Alfonso Acosta wrote: Just in case it helps, I ported the code of Norvigs Paradigms of Artificial Intelligence Programming chapter 8 (integrals and derivates) for a collage course. A link to this code would have been / would still be most appreciated. Jacques

[Haskell-cafe] Re: Search monad

2007-03-20 Thread apfelmus
Edsko de Vries wrote: Hey, I have a structure containing Xs in various places, like so data X data Structure = Structure .. [X] .. [X] .. And I defined mapStructure mapStructure :: (X - X) - (Structure - Structure) I then wanted to use mapStructure to define queries as well as

[Haskell-cafe] toClockTime

2007-03-20 Thread Jeff Polakow
Hello, On my system, GHC 6.6 running on windows xp, System.Time.toClockTime fails on calendar times later than (by days, I didn't check hours, minutes, etc.) January 18, 2038. Is this a bug? thanks, Jeff --- This e-mail may contain confidential and/or privileged information. If you

Re: [Haskell-cafe] Two Other AI Sources

2007-03-20 Thread Alfonso Acosta
On 3/20/07, Jacques Carette [EMAIL PROTECTED] wrote: A link to this code would have been / would still be most appreciated. I would have provided it if I had it, but the code is not online. However I don't have any problem to send it or uploaded somewhere. Any suggestions?

Re: [Haskell-cafe] toClockTime

2007-03-20 Thread Dougal Stanton
Quoth Jeff Polakow, nevermore, On my system, GHC 6.6 running on windows xp, System.Time.toClockTime fails on calendar times later than (by days, I didn't check hours, minutes, etc.) January 18, 2038. Is this a bug? That *sounds* suspiciously like the Year 2038 problem [1]. I thought it

Re: [Haskell-cafe] Two Other AI Sources

2007-03-20 Thread Andrew Wagner
Alfonso, Lemmih (from #haskell) has been kind enough to give me space on a server for a darcs repo. I could add your code there if you'd like to email it to me, or we could ask him if you could have your own space. Perhaps you could email me off-list and we can arrange it. On 3/20/07, Alfonso

Re: [Haskell-cafe] Newbie vs. laziness

2007-03-20 Thread Alex Queiroz
Hallo, On 3/20/07, Jules Bean [EMAIL PROTECTED] wrote: Personally I'd inclined to suggest use of the strict FetchRow which the library provides than struggle with explicit uses of seq to fight an over-lazy IO action. Sounds like a good suggestion. Thanks very much for the help! Cheers,

Re: [Hs-Generics] FW: [Haskell-cafe] SYB vs HList (again)

2007-03-20 Thread S. Alexander Jacobson
Oleg, data Name = Name String String deriving Show newtype Salary = S Float deriving Show data Dept = D String Int deriving Show I like the idea of these simpler label declarations, but I think the cost is that it is harder to write generic code for e.g. parsing urlencoded data or

[Haskell-cafe] parsec error message

2007-03-20 Thread david karapetyan
i get the following error message new.o:fake:(.text+0x85): undefined reference to `parseczm2zi0_TextziParserCombin atorsziParsecziChar_oneOf_closure' new.o:fake:(.rodata+0x4): undefined reference to `parseczm2zi0_TextziParserCombi natorsziParsecziChar_oneOf_closure' collect2: ld returned 1 exit

[Haskell-cafe] Re: Lazy IO and closing of file handles

2007-03-20 Thread Ferenc Wagner
Matthew Brecknell [EMAIL PROTECTED] writes: enumLines :: (a - String - Either a a) - a - FilePath - IO a enumLines iter accum filename = do h - openFile filename ReadMode flip fix accum $ \iterate accum - do try_line - try (hGetLine h) case try_line of Left e -

Re: [Haskell-cafe] parsec error message

2007-03-20 Thread Brandon S. Allbery KF8NH
On Mar 20, 2007, at 1:23 PM, david karapetyan wrote: i get the following error message new.o:fake:(.text+0x85): undefined reference to `parseczm2zi0_TextziParserCombin atorsziParsecziChar_oneOf_closure' Add either the --make parameter or the -package parsec parameter to GHC. -- brandon

Re: [Haskell-cafe] what I learnt from my first serious haskell programm

2007-03-20 Thread Fawzi Mohamed
Bulat Ziganshin wrote: Hello Fawzi, Tuesday, March 20, 2007, 5:37:45 PM, you wrote: ambiguous function call at line xxx. Possible instances are: f: Int - String - Double - a f: String - Int - [Int] - a please explicitly annotate the type to disambiguate Note that you

Re: [Haskell-cafe] toClockTime

2007-03-20 Thread Jeremy Shaw
At Tue, 20 Mar 2007 12:02:20 -0400, Jeff Polakow wrote: [1 multipart/alternative (7bit)] [1.1 text/plain; US-ASCII (7bit)] Hello, On my system, GHC 6.6 running on windows xp, System.Time.toClockTime fails on calendar times later than (by days, I didn't check hours, minutes, etc.)

[Haskell-cafe] Re: [Haskell] Call-by-name: moved to haskell-cafe

2007-03-20 Thread Dan Weston
Dan Weston wrote: Douglas Philips wrote: On 2007 Mar 20, at 3:30 PM, Dan Weston indited: I looked up John Backus on wikipedia and followed a link to ALGOL: http://en.wikipedia.org/wiki/ALGOL_60 where the following undesirable property of call-by-name is mentioned. ALGOL 60 allowed for two

Re: [Haskell-cafe] Haskell and a new web developement mailinglist?

2007-03-20 Thread S. Alexander Jacobson
There is currently a happs mailing list. I see no reason not to broaden the subject matter to haskell web development in general. The URL for the list is http://groups.google.com/group/happs -Alex- On Tue, 20 Mar 2007, David House wrote: On 20/03/07, Marc Weber [EMAIL PROTECTED] wrote:

Re: [Haskell-cafe] Haskell and a new web developement mailinglist?

2007-03-20 Thread Johan Tibell
I'm also interested. I'm trying to free up some time to experiment a bit with web frameworks. I would also like to try help to clean up the HTTP module and increase its performance. Johan On 3/20/07, Marc Weber [EMAIL PROTECTED] wrote: I've been talking to Chris Eidhof the last days and we'd

Re: [Haskell-cafe] Haskell and a new web developement mailinglist?

2007-03-20 Thread Paul Brown
On 3/20/07, David House [EMAIL PROTECTED] wrote: On 20/03/07, Marc Weber [EMAIL PROTECTED] wrote: I've been talking to Chris Eidhof the last days and we'd like to suggest adding another specialized haskell mailinglist: Haskell and web developement. I'd love to contribute here. You should be

Re: [Haskell-cafe] Re: [Haskell] Call-by-name: moved to haskell-cafe

2007-03-20 Thread Creighton Hogg
On 3/20/07, Dan Weston [EMAIL PROTECTED] wrote: Dan Weston wrote: Douglas Philips wrote: On 2007 Mar 20, at 3:30 PM, Dan Weston indited: I looked up John Backus on wikipedia and followed a link to ALGOL: http://en.wikipedia.org/wiki/ALGOL_60 where the following undesirable property of

[Haskell-cafe] Re: Lazy IO and closing of file handles

2007-03-20 Thread Benjamin Franksen
Bertram Felgenhauer wrote: Having to rely on GC to close the fds quickly enough is another problem; can this be solved on the library side, maybe by performing GCs when running out of FDs? Claus Reinke wrote: in good old Hugs, for instance, we find in function newHandle in src/iomonad.c

Re: [Haskell-cafe] Re: Matrices in Haskell

2007-03-20 Thread Ivan Miljenovic
On 21/03/07, apfelmus [EMAIL PROTECTED] wrote: Concerning Sudoku, there is a beautiful talk from R. Bird http://icfp06.cs.uchicago.edu/bird-talk.pdf I based my Latin Squares algorithms on Bird's Functional Pearl article A Program to play Sudoku The other problem with using a list of

Re: [Haskell-cafe] what I learnt from my first serious haskell programm

2007-03-20 Thread Lennart Augustsson
The nice thing about Haskell's overloading is that every function, like f, has a type. Not two different types, but one general type you can give it. It's a different approach to overloading. -- Lennart On Mar 20, 2007, at 14:37 , Fawzi Mohamed wrote: Bulat Ziganshin wrote:

[Haskell-cafe] Re: toClockTime

2007-03-20 Thread Jón Fairbairn
Jeremy Shaw [EMAIL PROTECTED] writes: Try using Data.Time instead -- it was written by a self-professed time nerd, and probably works correctly. It was added in GHC 6.6 and largely supercedes System.Time. Curiously, Hoogle doesn't seem to have it indexed yet -- I was looking for it just the

Re: [Haskell-cafe] Haskell and a new web developement mailinglist?

2007-03-20 Thread Marc Weber
On Tue, Mar 20, 2007 at 04:04:42PM -0400, S. Alexander Jacobson wrote: There is currently a happs mailing list. I see no reason not to broaden the subject matter to haskell web development in general. The URL for the list is http://groups.google.com/group/happs -Alex- Hi Alex The

Re: [Haskell-cafe] flip fix or let

2007-03-20 Thread Matthew Brecknell
Jules Bean: If you're merely talking about top-down or bottom-up then there is also 'where' rather than 'let'. Yes, I admit I tend to prefer where over let, all else being equal. But my main concern was embedding recursive functions in do-blocks, particularly monadic loops that aren't

Re: [Haskell-cafe] Haskell and a new web developement mailinglist?

2007-03-20 Thread Marc Weber
On Tue, Mar 20, 2007 at 02:25:41PM +0100, Marc Weber wrote: I've been talking to Chris Eidhof the last days and we'd like to suggest adding another specialized haskell mailinglist: Haskell and web developement. I've written to John Peterson who replied: I'm sure that will be fine -

[Haskell-cafe] Re: flip fix and iterate

2007-03-20 Thread Pete Kazmier
Matthew Brecknell [EMAIL PROTECTED] writes: Pete Kazmier: I understand the intent of this code, but I am having a hard time understanding the implementation, specifically the combination of 'fix', 'flip', and 'interate'. I looked up 'fix' and I'm unsure how one can call 'flip' on a function

Re: [Haskell-cafe] fix

2007-03-20 Thread Matthew Brecknell
Pete Kazmier: Haskell has a way of making one feel dumb. This is by far the most challenging programming language I've ever used. It (or perhaps the community around it) does have a way of making you realise that the rabbit-hole really is very deep. But that's no reason to feel dumb. I won't

[Haskell-cafe] Re: fix

2007-03-20 Thread Pete Kazmier
Matthew Brecknell [EMAIL PROTECTED] writes: As others have pointed out, fix is polymorphic, so a can stand for any type, including (b - c). Removing redundant parentheses, this means fix can directly specialise to: fix :: ((b - c) - b - c) - b - c I understand now. I think part of my

Re: [Haskell-cafe] Re: flip fix and iterate

2007-03-20 Thread Claus Reinke
Haskell has a way of making one feel dumb. This is by far the most challenging programming language I've ever used. i wouldn't see either as a particularly positive attribute. a language should enable, explain, encourage, and perhaps inspire. if it also leaves you feeling that you could do

Re: [Haskell-cafe] Re: fix

2007-03-20 Thread Dan Weston
But in fact it seems to me that the type variable a not only can, but must unify with b-c. Is there any use of fix for which this is not true? If this is true, is the type a instead of b-c because it is not possible in general for the type checker to verify this fact, making it some kind of

Re: [Haskell-cafe] Re: fix

2007-03-20 Thread Paul Hudak
Assuming 1 :: Int, then: ones = 1 : ones is equivalent to: ones = fix (\ones - 1:ones) where fix has type ([Int] - [Int]) - [Int]. It's also the case that: inf = 1+inf is equivalent to: inf = fix (\inf - 1+inf) where fix has type (Int - Int) - Int. Unfortunately (perhaps), the fixed point

Re: [Haskell-cafe] Re: fix

2007-03-20 Thread Nicolas Frisby
In effect, this is a demonstration that Haskell supports recursive values and not just recursive functions. If the a in fix :: (a - a) - a were to be unified always with a function type, then that would imply that the language only supported recursive definitions for functions, which would be a

Re: [Haskell-cafe] There can be only one fix? Pondering Bekic's lemma

2007-03-20 Thread Levent Erkok
On 3/19/07, Nicolas Frisby [EMAIL PROTECTED] wrote: Nope, but I believe the two are equipotent. This usage of believe is one of those I think I remember reading it somewhere usages. On 3/19/07, Henning Thielemann [EMAIL PROTECTED] wrote: On Sat, 17 Mar 2007, Nicolas Frisby wrote: Bekic's