RE: [Haskell-cafe] global variables

2007-05-21 Thread Simon Peyton-Jones
| I see no need two answer this again I believe I have already made my | views perfectly clear already and provided ample evidence to justify | them. Surely I don't need to do it again? Is there a Wiki page about this somewhere? Often email gets into a loop because not everyone reads

Re: [Haskell-cafe] Profiling, GUIs and libraries

2007-05-21 Thread Arthur van Leeuwen
On 20-mei-2007, at 17:39, Anthony Chaumas-Pellet wrote: Hello, I'm currently hacking away a wxhaskell program that uses up 100% CPU even when it should be idle. So, rather than doing blind guesswork, I've thought about using profiling to spot the zealous function. I do not need a very

Re: [Haskell-cafe] global variables

2007-05-21 Thread Arthur van Leeuwen
On 21-mei-2007, at 9:31, Simon Peyton-Jones wrote: | I see no need two answer this again I believe I have already made my | views perfectly clear already and provided ample evidence to justify | them. Surely I don't need to do it again? Is there a Wiki page about this somewhere? Often email

[Haskell-cafe] SWIG with Haskell ?

2007-05-21 Thread Mark Wassell
Hello, Has anyone got any pointers on using SWIG with Haskell to integrate a C++ library? For the library there other language bindings, so I am in a position to leverage off these. In general what are the particular issues with C++ and Haskell. One obvious one is management of object

RE: [Haskell-cafe] Scope of type variables in associated types

2007-05-21 Thread Simon Peyton-Jones
| The following doesn't seem to work. Is this a limitation of the current | implementation or will it never work? Are there any work arounds without | introducing extra type params into the data type E? | | class G a b | a - b where | data E a :: * | wrap :: b - E a | unwrap :: E a

Re: [Haskell-cafe] How Albus Dumbledore would sell Haskell

2007-05-21 Thread Henning Thielemann
On Wed, 18 Apr 2007, Dan Weston wrote: You have already won over the scientists. I only know few mathematicians using Haskell, most of the (applied) mathematician colleagues I know prefer MatLab. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] A wish for relaxed layout syntax

2007-05-21 Thread Henning Thielemann
On Wed, 28 Mar 2007, Benjamin Franksen wrote: Hi, I often run into the following issue: I want to write a list of lengthy items like this mylist = [ quite_lengthy_list_item_number_one, quite_lengthy_list_item_number_two, quite_lengthy_list_item_number_three ]

Re: [Haskell-cafe] Follow up on 'GroupBy behavior'

2007-05-21 Thread Henning Thielemann
On Sat, 28 Apr 2007, Hans van Thiel wrote: Thanks again for the help, and, to follow up, this now does what I need.. -- partitions a list according to an equivalence relation partition1 :: (a - a - Bool) - [a] - ([a],[a]) partition1 eq ls = partition ((head ls) `eq`) ls -- partitionBy

Re: [Haskell-cafe] Behavior of groupBy

2007-05-21 Thread Henning Thielemann
On Sat, 28 Apr 2007, Hans van Thiel wrote: Hello All, The standard function groupBy of List.hs doesn't work as I expect in this case: groupBy (\x y - (last x) == (last y)) [abc, bd,cac] results in: [[abc],[bd],[cac]] where I want: [[abc,cac], [bd]] I think you must roll your own

Re: [Haskell-cafe] Unresolved overloading error

2007-05-21 Thread Henning Thielemann
On Sat, 31 Mar 2007, Jacques Carette wrote: Bryan Burgers wrote: On 3/31/07, Scott Brown [EMAIL PROTECTED] wrote: It's working now, thank you. I changed the definition to binom n j = div (fac n) ((fac j)*(fac (n - j))) bernoulli n p j = fromIntegral(binom n j)*(p ^ j) * ((1 -

Re: [Haskell-cafe] Scope of type variables in associated types

2007-05-21 Thread Matthew Sackman
On Mon, May 21, 2007 at 10:36:00AM +0100, Simon Peyton-Jones wrote: | The following doesn't seem to work. Is this a limitation of the current | implementation or will it never work? Are there any work arounds without | introducing extra type params into the data type E? | | class G a b | a -

[Haskell-cafe] Editor

2007-05-21 Thread Michael T. Richter
I have a dream. It's not a little dream. It's a big dream. I have a dream that someday I can find a UNIX/Linux text editor for Haskell hacking (and possibly two or three hundred other programming languages, although that's optional) that can give me all of the following: 1. A real GUI

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-21 Thread geniusfat
What I meant is this: http://en.wikipedia.org/wiki/Combinatorics#Combination_without_repetition the order does not matter and each object can be chosen only once. But thank all those who have offered help, it helps a lot ;) -- View this message in context:

Re: [Haskell-cafe] Editor

2007-05-21 Thread Jules Bean
Michael T. Richter wrote: I have a dream. It's not a little dream. It's a big dream. I have a dream that someday I can find a UNIX/Linux text editor for Haskell hacking (and possibly two or three hundred other programming languages, although that's optional) that can give me all of the

Re: [Haskell-cafe] Profiling, GUIs and libraries

2007-05-21 Thread Anthony Chaumas-Pellet
You are not missing anything obvious. The process is in fact somewhat tricky. What you have to do is the following snip Thanks! I've followed your instructions and got a profiler-enabled binary up and running. I'd figured out how to modify the Makefile (silly me searching for *G*HC), but I had

RE: [Haskell-cafe] Scope of type variables in associated types

2007-05-21 Thread Simon Peyton-Jones
| | instance G a b where | | data E a = EC b -- this line - the b is not in scope. | | wrap = EC | | unwrap (EC b) = b | | | | I get Not in scope: type variable `b'. | | That's a bug. b should be in scope I was wrong. It's not a bug. E is supposed to be a type

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-21 Thread haskell
geniusfat wrote: What I meant is this: http://en.wikipedia.org/wiki/Combinatorics#Combination_without_repetition the order does not matter and each object can be chosen only once. But thank all those who have offered help, it helps a lot ;) Then you want triples1 from the code below. The

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-21 Thread Jules Bean
[EMAIL PROTECTED] wrote: Then you want triples1 from the code below. The idea for triples1, triples2, and triples3 is that each pickOne returns a list of pairs. The first element of each pair is the chosen element and the second element of each pair is the list of choices for the next element

Re: [Haskell-cafe] Editor

2007-05-21 Thread Michael T. Richter
On Mon, 2007-21-05 at 11:47 +0100, Jules Bean wrote: Michael T. Richter wrote: 1. A real GUI environment that takes into account some of the HID advances made in the past 30 years. (Emacs and Vim don't count, in other words.) That particular part is trolling. Both emacs

Re: [Haskell-cafe] Scope of type variables in associated types

2007-05-21 Thread Matthew Sackman
On Mon, May 21, 2007 at 12:39:20PM +0100, Simon Peyton-Jones wrote: | | instance G a b where | | data E a = EC b -- this line - the b is not in scope. | | wrap = EC | | unwrap (EC b) = b | | | | I get Not in scope: type variable `b'. | | That's a bug. b should be

Re: [Haskell-cafe] Editor

2007-05-21 Thread Rodrigo Queiro
My friend read your email and remarked: How is this guy not embarrassed posting on the internet about not liking vim because he doesn't like editing config files? On 21/05/07, Michael T. Richter [EMAIL PROTECTED] wrote: On Mon, 2007-21-05 at 11:47 +0100, Jules Bean wrote: Michael T. Richter

Re: [Haskell-cafe] Editor

2007-05-21 Thread Thomas Davie
On 21 May 2007, at 13:04, Rodrigo Queiro wrote: My friend read your email and remarked: How is this guy not embarrassed posting on the internet about not liking vim because he doesn't like editing config files? Two points 1) This guy doesn't like editing config files -- that's his

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-21 Thread Mirko Rahn
Jules Bean wrote: In the spirit of multiple implementations; another approach is to note that you're really asking for all 3-element sublists: power [] = [[]] power (x:xs) = power xs ++ map (x:) (power xs) triples1' l = [ t | t - power l, length t == 3] (this implementation also preserves

Re: [Haskell-cafe] Editor

2007-05-21 Thread Michael T. Richter
On Mon, 2007-21-05 at 13:04 +0100, Rodrigo Queiro wrote: My friend read your email and remarked: How is this guy not embarrassed posting on the internet about not liking vim because he doesn't like editing config files? Because, unlike your friend, I actually have seen the advances in HID

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-21 Thread Mark T.B. Carroll
geniusfat [EMAIL PROTECTED] writes: (snip) the order does not matter and each object can be chosen only once. (snip) In that case, with the help of Data.List.tails, one can do: threeOf :: [a] - [(a,a,a)] threeOf xs = [ (p,q,r) | (p:ps) - tails xs, (q:qs) - tails ps, r - qs ] (the r - qs

Re: [Haskell-cafe] Editor

2007-05-21 Thread Alex Queiroz
Hallo, On 5/21/07, Michael T. Richter [EMAIL PROTECTED] wrote: Oh, and of course it wasn't just the config files I showed problems with, now, was it? I seem to remember something about modality and bad syntax highlighting. Maybe I was tripping. It happens. You may not like

[Haskell-cafe] Ann: Emping 0.2

2007-05-21 Thread Hans van Thiel
Hello All, Version 0.2 of Emping, a utility to derive heuristic rules from a table of nominal data, is available. In addition to a reduced normal form in .csv format, which can be read by Open Office Calc, it now also displays observed implications and equivalences in the reduced rules (if

Re: [Haskell-cafe] Editor

2007-05-21 Thread Thomas Schilling
Your rant accomplishes nothing. Just note that programmers can generally be considered more open towards harder-to-learn but eventually more efficient to use interfaces. Yes, to a large part they lack visibility, consistency, integration, or other such properties; then again, once you learn to

Re: [Haskell-cafe] Scope of type variables in associated types

2007-05-21 Thread Tom Schrijvers
Ok, thanks for the clarification. One final question then, how could I rewrite the following in associated types: class OneStep a b | a - b instance OneStep (Cons v t) t class TwoStep a b | a - b instance (OneStep a b, OneStep b c) = TwoStep a c If the fundep and b is dropped then I get:

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-21 Thread Mirko Rahn
Mark T.B. Carroll wrote: nOf _[] = [] nOf 1xs = map return xs nOf n (x:xs) = map (x:) (nOf (n-1) xs) ++ nOf n xs No! With this implementation we have nOf 0 _ == [] but it should be nOf 0 _ == [[]]: The list of all sublists of length 0 is not empty, it contains the empty list!

Re: [Haskell-cafe] Scope of type variables in associated types

2007-05-21 Thread Matthew Sackman
Andres Loeh [EMAIL PROTECTED] wrote: class OneStep a data OS a :: * instance OneStep (Cons v t) data OS (Cons v t) = t class TwoStep a data TS a :: * instance (OneStep a, OneStep b) = TwoStep a instance (OneStep a, OneStep (OS a)) = TwoStep a ? Doesn't seem to

Re: [Haskell-cafe] Lazy HTML parsing with HXT, HaXML/polyparse, what else?

2007-05-21 Thread Henning Thielemann
On Mon, 14 May 2007, Malcolm Wallace wrote: Henning Thielemann [EMAIL PROTECTED] wrote: *Text.ParserCombinators.PolyLazy runParser (exactly 4 (satisfy Char.isAlpha)) (abc104++undefined) (*** Exception: Parse.satisfy: failed How can I rewrite the above example

Re: [Haskell-cafe] Behavior of groupBy

2007-05-21 Thread Hans van Thiel
Thanks for the help! Strangely, I just now received your messages from April 28, hence the late reply... Hans van Thiel On Sat, 2007-04-28 at 18:09 +0200, Henning Thielemann wrote: On Sat, 28 Apr 2007, Hans van Thiel wrote: Hello All, The standard function groupBy of List.hs doesn't work

Re: [Haskell-cafe] Editor

2007-05-21 Thread Claus Reinke
I have a dream. It's not a little dream. It's a big dream. I have a dream that someday I can find a UNIX/Linux text editor for Haskell hacking (and possibly two or three hundred other programming languages, although that's optional) that can give me all of the following: 'find / -type dream

Re: [Haskell-cafe] Scope of type variables in associated types

2007-05-21 Thread Matthew Sackman
On Mon, May 21, 2007 at 02:08:13PM +0100, Matthew Sackman wrote: Further, it is *impossible* to define mkTS'' for the extra -- should be mkOS'' But actually, in that code, the data declaration was never even used either - all that is needed is:

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-21 Thread Mark T.B. Carroll
Mirko Rahn [EMAIL PROTECTED] writes: (snip) Correct (and more natural): nOf 0 _ = [[]] nOf n (x:xs) = map (x:) (nOf (n-1) xs) ++ nOf n xs nOf _ [] = [] Thanks very much - in both claims you're indeed correct. -- Mark ___ Haskell-Cafe

Re: [Haskell-cafe] Editor

2007-05-21 Thread Rodrigo Queiro
With a slightly less flippant response, have you ever tried TextMate? I haven't, but I've heard many wax lyrical about its combination of the UNIXy power of Vim et al with the intuitive and simple UI that OS X has a reputation for. Unfortunately, it's not free and is only for Mac OS X, but it

Re: [Haskell-cafe] Editor

2007-05-21 Thread Michael T. Richter
On Mon, 2007-21-05 at 13:41 +0100, Neil Mitchell wrote: Michael is asking is there something more GUI like? - to which the answer is yes - Visual Haskell - Sadly what I was asking was is there anything more GUI like for Linux. ;) It doesn't surprise me that Macs and Windows boxes have

RE: [Haskell-cafe] Editor

2007-05-21 Thread Bayley, Alistair
1.A real GUI 2.Good quality syntax highlighting for Haskell..., plus: 3. raw Haskell both forms of Literate Haskell; 4. properly highlight Haddock comments; 5. highlight functions and types from libraries differently from local 3.Line folding

Re: [Haskell-cafe] Editor

2007-05-21 Thread Arthur van Leeuwen
On 21-mei-2007, at 13:56, Michael T. Richter wrote: Hell, even comparing the out-of-the-box syntax highlighting support in Gedit vs. (G)Vim is instructive. Code like makeRandomValueST :: StdGen - (MyType, StdGen) (which, incidentally, was far easier to copy from in Gedit than GVim to

Re: [Haskell-cafe] Behavior of groupBy

2007-05-21 Thread Henning Thielemann
On Mon, 21 May 2007, Hans van Thiel wrote: Thanks for the help! Strangely, I just now received your messages from April 28, hence the late reply... Our mail server does now send a bunch of mails I thought that were sent long ago. ___ Haskell-Cafe

Re: [Haskell-cafe] Editor

2007-05-21 Thread Leif Frenzel
Bayley, Alistair wrote: 1. A real GUI 2. Good quality syntax highlighting for Haskell..., plus: 3. raw Haskell both forms of Literate Haskell; 4. properly highlight Haddock comments; 5. highlight functions and types from libraries differently from local 3. Line folding to hide

[Haskell-cafe] AngloHaskell 2007

2007-05-21 Thread Philippa Cowderoy
I'd like to announce AngloHaskell 2007, or at least the start of the process of organising it! Last year there was a get-together organised around the interviews for the job of GHC maintainer. There were talks, with a largely pragmatic flavour, and there was plenty of socialising. It was fun,

Re: [Haskell-cafe] Editor

2007-05-21 Thread David House
On 21/05/07, Michael T. Richter [EMAIL PROTECTED] wrote: Easy, quick access to online documentation for said functions and declarations. I'm writing this for Emacs right now. At the moment both Emacs and Vim can access everything that GHCi has to offer on a function, which means where it's

Re: [Haskell-cafe] Profiling, GUIs and libraries

2007-05-21 Thread Duncan Coutts
Just in case anyone was wondering how to do this with the other major Haskell GUI lib Gtk2Hs... ./configure --enable-profiling some day when Gtk2Hs is cabalised it'll be even easier. Duncan On Sun, 2007-05-20 at 17:39 +0200, Anthony Chaumas-Pellet wrote: Hello, I'm currently hacking away a

Re: [Haskell-cafe] Scope of type variables in associated types

2007-05-21 Thread Bertram Felgenhauer
Matthew Sackman wrote: class G a where data E a :: * wrap :: a - E a unwrap :: E a - a I'm afraid not. I really need wrap to take a 'b' and unwrap to return a 'b'. Talking on #haskell to sjanssen last night, he came up with: How does class F a

Re: [Haskell-cafe] Haskell: the Craft of Functional Programming

2007-05-21 Thread PR Stanley
I'm not sure what you mean by a lot of transcription work. It's an excellent book, aimed at beginners. transcribe :: Print - Etext Mike PR Stanley wrote: Hi I've acquired a copy of the above title but it requires a lot of transcription work. So, I thought I'd first ensure it's

Re: [Haskell-cafe] How Albus Dumbledore would sell Haskell

2007-05-21 Thread Andrew Coppin
Henning Thielemann wrote: On Wed, 18 Apr 2007, Dan Weston wrote: You have already won over the scientists. I only know few mathematicians using Haskell, most of the (applied) mathematician colleagues I know prefer MatLab. Blehr! _ I hate MatLab... it's horrid! (OTOH, I'm not

Re: [Haskell-cafe] How Albus Dumbledore would sell Haskell

2007-05-21 Thread Brandon S. Allbery KF8NH
On May 21, 2007, at 14:15 , Andrew Coppin wrote: Henning Thielemann wrote: I only know few mathematicians using Haskell, most of the (applied) mathematician colleagues I know prefer MatLab. I hate MatLab... it's horrid! Everyone hates Matlab. Problem is, it's hard to find anything like

Re: [Haskell-cafe] How do I insert an element in HaXml?

2007-05-21 Thread Jeremy Shaw
At Sun, 20 May 2007 10:55:26 +0100, Malcolm Wallace wrote: Jeremy Shaw [EMAIL PROTECTED] writes: How do I create a HaXml filter that adds a new element as a child of an existing element. For example, let's say I have the XML document: a b/ c/ /a How do I add a new element under a

Re: [Haskell-cafe] Editor

2007-05-21 Thread Ben Moseley
You mentioned a dream Have you looked at Yi? might be worth a peek if you're prepared to work towards your dream. http://www.haskell.org/haskellwiki/Yi ...a long way to go - but it certainly nails #7! --Ben On 21 May 2007, at 15:44, Leif Frenzel wrote: Bayley, Alistair wrote:

Re: [Haskell-cafe] How Albus Dumbledore would sell Haskell

2007-05-21 Thread Dipankar Ray
(aside to Dylan T: I hope you don't mind me advertising your (well, public) web pages here. In my opinion a lot more people should know about the stuff that both you and Ken are doing!) Here's an example of some great math being done in haskell:

[Haskell-cafe] List algorithm

2007-05-21 Thread Steffen Mazanek
Hello, is there an efficient algorithm that takes two positive numbers n and m and that computes all lists l of numbers 0x=n such that sum l = m? For instance alg 5 1 = [[1]] alg 5 2 = [[1,1],[2]] alg 5 3 = [[1,1,1],[1,2],[2,1],[3]] ... I know that filter (\l-sum l == m) (powerSet [1..n])

Re: [Haskell-cafe] Editor

2007-05-21 Thread Albert Y. C. Lai
Michael T. Richter wrote: 1. A real GUI environment that takes into account some of the HID advances made in the past 30 years. (Emacs and Vim don't count, in other words.) I for my life think HID refers to human input devices: keyboard, mouse, joystick, gamepad, pedal,

Re: [Haskell-cafe] List algorithm

2007-05-21 Thread Mark T.B. Carroll
Steffen Mazanek [EMAIL PROTECTED] writes: alg 5 1 = [[1]] alg 5 2 = [[1,1],[2]] alg 5 3 = [[1,1,1],[1,2],[2,1],[3]] Would this be better? alg n m = case signum m of -1 - [] 0 - [[]] 1 - [ x : xs | x - [1..n], xs - alg n (m - x) ] -- Mark

[Haskell-cafe] efficient and/or lazy partitions of a multiset

2007-05-21 Thread Greg Meredith
HC-er's, Find below some simple-minded code from a naive Haskeller for generating all partitions of a multiset about which i have two questions. mSplit :: [a] - [([a], [a])] mSplit [x] = [([x],[])] mSplit (x:xs) = (zip (map (x:) lxs) rxs) ++ (zip lxs (map (x:) rxs))

Re: [Haskell-cafe] List algorithm

2007-05-21 Thread Mark T.B. Carroll
[EMAIL PROTECTED] (Mark T.B. Carroll) writes: alg n m = case signum m of -1 - [] 0 - [[]] 1 - [ x : xs | x - [1..n], xs - alg n (m - x) ] FWIW it's faster if you do some memoising: algMemo n m = lookupMemo m where memo = [[]] : map helper [1..m]

Re: [Haskell-cafe] List algorithm

2007-05-21 Thread Mark T.B. Carroll
[EMAIL PROTECTED] (Mark T.B. Carroll) writes: (snip) algMemo n m = lookupMemo m where memo = [[]] : map helper [1..m] lookupMemo m = if m 0 then [] else memo !! m helper m' = [ x : xs | x - [1..n], xs - lookupMemo (m' - x) ] which, I suppose, is rather like, algMemo n

Re: [Haskell-cafe] Editor

2007-05-21 Thread Alexis
On Tuesday 22 May 2007 02:30, Claus Reinke wrote: Vim is eliminated before it reaches the gate because it's a modal editor. Even with GVim in place, it still has that modal stench to it that leaps up and bites at awkward moments. that's a bit more specific, at least. but as far as i recall,

[Haskell-cafe] type class question

2007-05-21 Thread Tim Docker
I think this must almost be a FAQ, or at least a PAQ (Previously AQ)... If I have a type class for conversion to a type X: class XType a where toX :: a - X I can define instances for instance XType Int where toX = ... instance XType Double where toX = ...

Re: [Haskell-cafe] type class question

2007-05-21 Thread Derek Elkins
Tim Docker wrote: I think this must almost be a FAQ, or at least a PAQ (Previously AQ)... If I have a type class for conversion to a type X: class XType a where toX :: a - X I can define instances for instance XType Int where toX = ... instance XType Double

Re: [Haskell-cafe] Editor OT: streamofconciousness

2007-05-21 Thread John Meacham
On Mon, May 21, 2007 at 06:37:22PM +0800, Michael T. Richter wrote: 1. A real GUI environment that takes into account some of the HID advances made in the past 30 years. (Emacs and Vim don't count, in other words.) heh. find me a new GUI editor that takes into account the

Re: [Haskell-cafe] Scope of type variables in associated types

2007-05-21 Thread Matthew Brecknell
Bertram Felgenhauer: How does class F a where data B a :: * data E a :: * wrap :: B a - E a unwrap :: E a - B a sound? 'B a' would represent the 'b' in your previous attempt, class F a b | a - b where ... I'm with Simon in thinking that this code is

RE: [Haskell-cafe] type class question

2007-05-21 Thread Tim Docker
Derek Elkins wrote: I believe there is a trick where essentially you end up with, instance IsChar a = XType [a] where ... That is simple enough, and works fine. Thanks! Tim ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Wanted: extended static checking for xmonad

2007-05-21 Thread Donald Bruce Stewart
When working on xmonad, we're trying to produce very clean, correct code -- a window manager that just works. To do this, we're looking to employ more static checking tools to the code base. Currently we use: * QuickCheck (checks high level window manager behaviour) * Catch (Neil's