[Haskell-cafe] Would you mind explain such a code ?

2009-09-10 Thread zaxis
myFoldl :: (a - b - a) - a - [b] - a myFoldl f z xs = foldr step id xs z where step x g a = g (f a x) I know myFoldl implements foldl using foldr. However i really donot know how it can do it ? Please shed a light one me, thanks! -- View this message in context:

Re: [Haskell-cafe] hmatrix on os x

2009-09-10 Thread brian
yep I had some trouble too, although interestingly less than on linux pc. can you provide some error messages and we can see if your problems are the same one's I saw. I think most of my problem involved the location of the libraries. Also I think that you are really going to want to have

Re: [Haskell-cafe] Would you mind explain such a code ?

2009-09-10 Thread staafmeister
zaxis wrote: myFoldl :: (a - b - a) - a - [b] - a myFoldl f z xs = foldr step id xs z where step x g a = g (f a x) I know myFoldl implements foldl using foldr. However i really donot know how it can do it ? Please shed a light one me, thanks! Hi, Nice example! Well this is

Re: [Haskell-cafe] hmatrix on os x

2009-09-10 Thread Martijn van Steenbergen
brian wrote: yep I had some trouble too, although interestingly less than on linux pc. can you provide some error messages and we can see if your problems are the same one's I saw. If this helps, here is the error message I got: Configuring hmatrix-0.5.2.2... Checking foreign libraries...

Re: [Haskell-cafe] Would you mind explain such a code ?

2009-09-10 Thread zaxis
thanks for your quick answer! As I understand foldr (\x g - g . (`f`x)) id xs will return a function such as (`f` 3).(`f` 2).(`f` 1) . You have already made it clear ! However, why does the step function below has three parameters ? I think foldr will call step using two parameters, the

[Haskell-cafe] Re: Would you mind explain such a code ?

2009-09-10 Thread oleg
I know myFoldl implements foldl using foldr. However i really donot know how it can do it ? You will probably like Graham Hutton A Tutorial on the Universality and Expressiveness of Fold JFP, 1999. http://www.cs.nott.ac.uk/~gmh/fold.pdf Section 5.1 (actually,

[Haskell-cafe] RE: Resolving overloading loops for circular constraint graph

2009-09-10 Thread Simon Peyton-Jones
Stefan You are trying to do something quite delicate here. The whole idea of solving constraints in a co-inductive way (building a recursive group of dictionary definitions) relies on spotting something we've seen before to tie the knot. To date, the main application I knew for this fairly

Re: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Peter Verswyvelen
Actually, this UAC was already present in Vista no? On Thu, Sep 10, 2009 at 4:18 AM, Jeff Wheeler j...@nokrev.com wrote: On Wed, Sep 9, 2009 at 2:19 PM, Sebastian Sylvansebastian.syl...@gmail.com wrote: I think it's morally right to run as user by default. Yes, the windows culture has some

[Haskell-cafe] Bounded parMap

2009-09-10 Thread Anakim Border
Hi, lately I've been working on a parallel parser whose core is something like this: pMap parse blocks where pMap is a map-like function sparking independent computations over the elements of the blocks list. The actual implementation used Control.Parallel.Strategies: map parse blocks

Re: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Peter Verswyvelen
Interestingly, a sudo for Windows does seem to exist. It's called the runas command. At first sight it existed already since Windows XP Also on Sourceforge an open source sudo command for Windows is hosted: http://sourceforge.net/projects/sudowin On Thu, Sep 10, 2009 at 11:21 AM, Peter

Re: [Haskell-cafe] Would you mind explain such a code ?

2009-09-10 Thread Roman Cheplyaka
* zaxis z_a...@163.com [2009-09-10 00:51:21-0700] thanks for your quick answer! As I understand foldr (\x g - g . (`f`x)) id xs will return a function such as (`f` 3).(`f` 2).(`f` 1) . You have already made it clear ! However, why does the step function below has three parameters ? I

Re: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Duncan Coutts
On Wed, 2009-09-09 at 20:19 +0100, Sebastian Sylvan wrote: On Wed, Sep 9, 2009 at 1:28 PM, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote: If the Windows users can come to a consensus on whether the default should be global or user, then we can easily switch

Re: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Sebastian Sylvan
On Thu, Sep 10, 2009 at 10:58 AM, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote: On Wed, 2009-09-09 at 20:19 +0100, Sebastian Sylvan wrote: On Wed, Sep 9, 2009 at 1:28 PM, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote: If the Windows users can come to a consensus on

Re: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Duncan Coutts
On Wed, 2009-09-09 at 21:18 -0500, Jeff Wheeler wrote: On Wed, Sep 9, 2009 at 2:19 PM, Sebastian Sylvansebastian.syl...@gmail.com wrote: I think it's morally right to run as user by default. Yes, the windows culture has some legacy that may, on occasion, make it slightly harder to use

Re: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Deniz Dogan
2009/9/10 Sebastian Sylvan sebastian.syl...@gmail.com: On Thu, Sep 10, 2009 at 10:58 AM, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote: On Wed, 2009-09-09 at 20:19 +0100, Sebastian Sylvan wrote: On Wed, Sep 9, 2009 at 1:28 PM, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote:  

Re: [Haskell-cafe] memoization

2009-09-10 Thread staafmeister
Thanks to reactions! What do you think about such a function? This function is still a bit dangerous (I think). I don't know how to make sure the compiler does not lift cache to something global. But on the other hand this use of unsafePerformIO is legit because it doesn't alter the referential

[Haskell-cafe] better error message for undefined

2009-09-10 Thread Andrew U. Frank
the haskell prelude introduces the type undefined and contains a remark to the effect that compilers are expected to intrudocue a meaningful error message. GHC just prints 'Prelude undefined' which is not very informativ. is there a way to have different kinds of undefined? such that i get a

Re[2]: [Haskell-cafe] memoization

2009-09-10 Thread Bulat Ziganshin
Hello staafmeister, Thursday, September 10, 2009, 3:54:34 PM, you wrote: What do you think about such a function? This function is a bit of refactoring -- global variable in haskell way cache = unsafePerformIO $ newIORef M.empty memo f x = unsafePerformIO$ do m -

Re: [Haskell-cafe] better error message for undefined

2009-09-10 Thread Bulat Ziganshin
Hello Andrew, Thursday, September 10, 2009, 4:02:27 PM, you wrote: is there a way to have different kinds of undefined? such that i get a message which one was hit. something like writing in the code 'unefined 'my error 123' which prints 'undefined - my error 123' when it is accidentally hit.

Re: [Haskell-cafe] better error message for undefined

2009-09-10 Thread Martijn van Steenbergen
You can use the error function. It accepts a string that is displayed when the error is evaluated: GHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ...

Re: Re[Haskell-cafe] [2]: memoization

2009-09-10 Thread staafmeister
Hi Bulat, Bulat Ziganshin-2 wrote: Hello staafmeister, Thursday, September 10, 2009, 3:54:34 PM, you wrote: What do you think about such a function? This function is a bit of refactoring -- global variable in haskell way cache = unsafePerformIO $ newIORef M.empty memo f x =

Re: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Peter Verswyvelen
No Windows XP did not have support for roaming profiles yet I think. But it wouldn't be too difficult to use %LOCALAPPDATA% first, and when it doesn't exist, use %APPDATA%? This article explains a lot about the differences; I didn't have time yet to read it in detail

Re: Re[2]: [Haskell-cafe] memoization

2009-09-10 Thread Peter Verswyvelen
You might want to watch out for multithreading issues, although in this case, I don't think it will cause sever problems, besides a couple of redundant cache updates. On Thu, Sep 10, 2009 at 2:07 PM, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello staafmeister, Thursday, September 10,

Re: [Haskell-cafe] Would you mind explain such a code ?

2009-09-10 Thread Peter Verswyvelen
On Thu, Sep 10, 2009 at 11:47 AM, Roman Cheplyaka r...@ro-che.info wrote:  step x g a = g (f a x) is, thanks to currying, another way to write  step x g = \a - g (f a x) I thought currying just meant curry f x y = f (x,y) Isn't the reason that f x y z = body is the same as f = \x - \y

[Haskell-cafe] Re: Cabal install on Windows 7

2009-09-10 Thread Felix Martini
Is there any %LOCALAPPDATA% on Windows XP? If not, what is the difference between %LOCALAPPDATA% and %APPDATA% in Windows Vista/7? XP does not define the %LOCALAPPDATA% environment variable, but it is equivalent to %USERPROFILE%\Local Settings\Application Data. Data in local application data

Re[2]: Re[Haskell-cafe] [2]: memoization

2009-09-10 Thread Bulat Ziganshin
Hello staafmeister, Thursday, September 10, 2009, 4:23:26 PM, you wrote: This doesn't work and is exactly what I'm afraid the compiler is going to do. Cache needs to be associated with the function f. Otherwise one would get conflicts well, technique i used is well known, we would have

RE: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Regis Saint-Paul
One way in which cabal can be made UAC aware (and therefore request for elevation privileges instead of just failing) would be to embed a manifest in the cabal.exe. This can be done by changing the default manifest (an XML file) that is embedded at link time by GHC. This is supported by GHC

Re: [Haskell-cafe] Would you mind explain such a code ?

2009-09-10 Thread Roman Cheplyaka
* Peter Verswyvelen bugf...@gmail.com [2009-09-10 14:43:10+0200] On Thu, Sep 10, 2009 at 11:47 AM, Roman Cheplyaka r...@ro-che.info wrote:  step x g a = g (f a x) is, thanks to currying, another way to write  step x g = \a - g (f a x) I thought currying just meant curry f x y = f

[Haskell-cafe] ANNOUNCE: A Levenberg-Marquardt implementation

2009-09-10 Thread Bas van Dijk
Dear all, We like to announce the release of a Haskell binding to Manolis Lourakis's C levmar library at: http://www.ics.forth.gr/~lourakis/levmar/ This library implements the Levenberg-Marquardt algorithm which is an iterative technique that finds a local minimum of a function that is

Re: [Haskell-cafe] Would you mind explain such a code ?

2009-09-10 Thread Sean Leather
On Thu, Sep 10, 2009 at 14:43, Peter Verswyvelen wrote: On Thu, Sep 10, 2009 at 11:47 AM, Roman Cheplyaka wrote: step x g a = g (f a x) is, thanks to currying, another way to write step x g = \a - g (f a x) I thought currying just meant curry f x y = f (x,y) Isn't the reason

Re: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Matthijs Kooijman
Hi Regis, - use windows API for requesting elevation during the process (ugly) Why is this ugly? This seems like an elegant solution, to get privileges only when you actually need them? Gr. Matthijs signature.asc Description: Digital signature ___

Re[2]: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Bulat Ziganshin
Hello Matthijs, Thursday, September 10, 2009, 5:24:57 PM, you wrote: - use windows API for requesting elevation during the process (ugly) Why is this ugly? This seems like an elegant solution, to get privileges only when you actually need them? afaik you need to run special COM server with

RE: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Regis Saint-Paul
I'm not familiar with cabal source code enough to actually assess how much of a problem it would be but I assumed so because: - one would need to identify the exact location in the cabal code where elevation will be required. That means one would have to check if a folder where cabal wishes to

RE: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Regis Saint-Paul
One last note as it may be confusing in previous message...I mention to use windows API, but there is no API per-se that can elevate a process already running. It takes to create another process which, at startup time, will popup the elevation dialog. The win32 function to call is therefore just

Re[2]: [Haskell-cafe] Cabal install on Windows 7

2009-09-10 Thread Bulat Ziganshin
Hello Regis, Thursday, September 10, 2009, 6:05:19 PM, you wrote: One last note as it may be confusing in previous message...I mention to use windows API, but there is no API per-se that can elevate a process already running. It takes to create another process which, at startup time, will

[Haskell-cafe] Problem installing OpenGL

2009-09-10 Thread Seb
Hi, I'm having trouble installing OpenGL through cabal. It fails when it tries to install OpenGLRaw with this error message: cabal: Missing dependency on a foreign library: * Missing C library: GL I'm running OS X Leopard and have Xcode 3.1.3 installed. Do i have to install something separate

Re: Re[Haskell-cafe] [2]: memoization

2009-09-10 Thread mf-hcafe-15c311f0c
On Thu, Sep 10, 2009 at 05:23:26AM -0700, staafmeister wrote: To: haskell-cafe@haskell.org From: staafmeister g.c.stave...@uu.nl Date: Thu, 10 Sep 2009 05:23:26 -0700 (PDT) Subject: Re: Re[Haskell-cafe] [2]: memoization Hi Bulat, Bulat Ziganshin-2 wrote: Hello staafmeister,

[Haskell-cafe] Dutch HUG: meeting tomorrow in Utrecht

2009-09-10 Thread Tom Lokhorst
Hi everyone, I want to remind all functional programmers currently in The Netherlands of the Dutch Haskell User Group [1, 2] meeting tomorrow at 19:00 [3]. The meeting will be in Booth Hall [4] of the Utrecht University Library, where we'll have three talks. There's free car parking [5] at the

[Haskell-cafe] retrieving arguments for functions from a heterogenous list (HList)

2009-09-10 Thread Andrew U. Frank
I have a number of functions which have some arguments and produce a single result. all the arguments are in a heterogenous list and the results should update the list. this appears somewhat similar to the keyword-argument solution for functions proposed by oleg kiselyov in 2004. i would like

Fwd: Re[Haskell-cafe] [2]: memoization

2009-09-10 Thread Alberto G. Corona
instead o that you can use a key such is: key :: a - Int key = unsafePerformIO . hashStableName . makeStableName that is defined for any kind of data then, a unique key for the pair f x could be: key1 f x=(key f , key x) However my experience is that ocassionally gives different hashes for

[Haskell-cafe] Re: Snow Leopard breaks GHC

2009-09-10 Thread Brian Sniffen
My problems were resolved by removing MacPorts from the system and adding 32-bit flags to runhaskell---apparently its zlib was interfering, as well as the runhaskell/runghc problems. Thank you for the advice, Brian On Wed, Sep 9, 2009 at 3:49 AM, Christian Maeder christian.mae...@dfki.de wrote:

Re: Re[Haskell-cafe] [2]: memoization

2009-09-10 Thread Alberto G. Corona
key x= unsafePerformIO $makeStableName x = return . hashStableName sorry 2009/9/10 Alberto G. Corona agocor...@gmail.com instead o that you can use a key such is: key :: a - Int key = unsafePerformIO . hashStableName . makeStableName that is defined for any kind of data then, a

[Haskell-cafe] Re: Resolving overloading loops for circular constraint graph

2009-09-10 Thread Martin Sulzmann
2009/9/9 Stefan Holdermans ste...@cs.uu.nl Dear Martin, By black-holing you probably mean co-induction. That is, if the statement to proven appears again, we assume it must hold. However, type classes are by default inductive, so there's no easy fix to offer to your problem. A propos:

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-10 Thread Dan Weston
One simple solution is to leave the state in Qt. As of Qt 4.2, in C++ you can use bool QObject::setProperty(const char * name, const QVariant value) QVariant QObject::property(const char * name) const to set and get properties on any QObject (hence any QWidget). Since I believe these are

Re: [Haskell-cafe] ANNOUNCE: Palindromes 0.1

2009-09-10 Thread Henning Thielemann
On Sun, 6 Sep 2009, Johan Jeuring wrote: The primary features of Palindromes include: * Linear-time algorithm for finding exact palindromes * Linear-time algorithm for finding text palindromes, ignoring spaces, case of characters, and punctuation symbols. You made me curious, whether

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-10 Thread Duncan Coutts
On Wed, 2009-09-09 at 18:29 -0700, Michael P Mossey wrote: I'm trying to learn qtHaskell. I realize few people on this list know anything about qtHaskell, but I have a question that probably relates to all GUIs as implemented in Haskell. I just need a hint that could help me figure out the

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-10 Thread Michael Mossey
Dan Weston wrote: One simple solution is to leave the state in Qt. As of Qt 4.2, in C++ you can use bool QObject::setProperty(const char * name, const QVariant value) QVariant QObject::property(const char * name) const to set and get properties on any QObject (hence any QWidget).

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-10 Thread Michael Mossey
Duncan Coutts wrote: On Wed, 2009-09-09 at 18:29 -0700, Michael P Mossey wrote: I'm trying to learn qtHaskell. I realize few people on this list know anything about qtHaskell, but I have a question that probably relates to all GUIs as implemented in Haskell. I just need a hint that could

[Haskell-cafe] Re: ANNOUNCE: A Levenberg-Marquardt implementation

2009-09-10 Thread Maurí­cio CA
Our binding consists of three packages: * http://hackage.haskell.org/package/bindings-levmar-0.1 Which were the changes you needed to do to the library code? I believe this is going to cause you two problems: maintenance (as you can't always be sure the patched version didn't introduce a bug)

Re: Re[2]: [Haskell-cafe] memoization

2009-09-10 Thread Luke Palmer
On Thu, Sep 10, 2009 at 6:34 AM, Peter Verswyvelen bugf...@gmail.com wrote: You might want to watch out for multithreading issues, although in this case, I don't think it will cause sever problems, besides a couple of redundant cache updates. On Thu, Sep 10, 2009 at 2:07 PM, Bulat Ziganshin

[Haskell-cafe] instance Monad (Either String) in Prelude or Data.Either?

2009-09-10 Thread Evan Laforge
Is there any particular reason to not move the instance to the prelude? A module was failing when imported from one place and ok when imported from another, so I spent a frustrating 10 minutes searching for the instance. I couldn't find a way to search haddock for instances (not even grep on the

Re: Re[2]: [Haskell-cafe] memoization

2009-09-10 Thread Ryan Ingram
On Thu, Sep 10, 2009 at 5:46 PM, Luke Palmer lrpal...@gmail.com wrote: However, because the body of cache didn't depend on f, we can use lambda calculus rules to lift the let outside the lambda. So your transformation is completely valid... And yet, the original code works, and Bulat's