Re: [Haskell-cafe] Generating random graph

2011-04-11 Thread Henning Thielemann
On Mon, 11 Apr 2011, Mitar wrote: generateGraph :: Int - IO (Gr String Double) generateGraph graphSize = do when (graphSize 1) $ throwIO $ AssertionFailed $ Graph size out of bounds ++ show graphSize let ns = map (\n - (n, show n)) [1..graphSize] es - fmap concat $ forM [1..graphSize] $

[Haskell-cafe] CFP: APLAS 2011, Kenting, Taiwan

2011-04-11 Thread Shin-Cheng Mu
== APLAS 2011 Call For Papers Ninth Asian Symposium on Programming Languages and Systems Kenting, Taiwan, December 5--7, 2011 (co-located with CPP 2011) http://flolac.iis.sinica.edu.tw/aplas11/

[Haskell-cafe] already installed packages alerted as not being installed

2011-04-11 Thread Daniel Kahlenberg
Hello cafe-readers, does anyone of you observe similar problems e. g. on a Windows with ghc-7.0.2 setup: When I'm trying cabal install threadscope (as an example package depending on gtk2hs, latter which I've installed using the stepwise approach of cabal unpack first, then cabal configure --user

Re: [Haskell-cafe] already installed packages alerted as not being installed

2011-04-11 Thread 山本和彦
Hello, When I install cabal-dev and cab first and then re-install everything with cab instead of cabal the issue with re-installing already installed packages described above disappears and only an unknown symbol message related to the correctly found installed cairo package remains. So is

Re: [Haskell-cafe] already installed packages alerted as not being installed

2011-04-11 Thread Daniel Kahlenberg
Kazu, thanks I wanted to mention that the unknown symbol error is very likely not related to the cab tool as the same error appears, when using the cabal - tool. I guess we can ignore it even in the context of my main question, sorry for being to verbose. What I found more interesting is, that

[Haskell-cafe] Fucntion composing

2011-04-11 Thread Adam Krauze
Hello, as I am newbie to Haskell and my introductory question is: given functions say f and g with type signatures f :: (Num a) = [a] - [a] - [(a,a)] // f takes two lists and zips them into one in some special way g :: (Num a) = a - [(a,a)] - [a] // g using some Num value calculates list of

Re: [Haskell-cafe] already installed packages alerted as not being installed

2011-04-11 Thread 山本和彦
Hello, thanks I wanted to mention that the unknown symbol error is very likely not related to the cab tool as the same error appears, when using the cabal - tool. I guess we can ignore it even in the context of my main question, sorry for being to verbose. What I found more interesting is,

Re: [Haskell-cafe] Fucntion composing

2011-04-11 Thread Sean Leather
Prelude let h x y = (g 0 (f x y)) How to do pointfree definition of h? See the thread http://thread.gmane.org/gmane.comp.lang.haskell.cafe/70488for related material. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Generating random graph

2011-04-11 Thread Mitar
Hi! On Mon, Apr 11, 2011 at 7:36 AM, Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de wrote: So when using randomRs, the state of the global random number generator is not updated, but it is used again in the next iteration of the toplevel forM [1..graphSize] loop. I thought it would be

Re: [Haskell-cafe] Fucntion composing

2011-04-11 Thread Daniel Fischer
On Monday 11 April 2011 11:22:51, Adam Krauze wrote: Hello, as I am newbie to Haskell and my introductory question is: given functions say f and g with type signatures f :: (Num a) = [a] - [a] - [(a,a)] // f takes two lists and zips them into one in some special way g :: (Num a) = a -

Re: [Haskell-cafe] Parsing HTML tables with HXT

2011-04-11 Thread Dmitry Simonchik
Thanks! I was also able to extract the needed value with the code below: testArrow :: IOSArrow XmlTree XmlTree testArrow = deep (isElem hasName table ) deep (isElem hasName tr) (deep isText hasText (==a)) `guards` (getChildren getChildren isText) 2011/4/11

[Haskell-cafe] Foreign function performance: monadic vs pure

2011-04-11 Thread Serguei Son
Consider two versions of sin wrapped: foreign import ccall math.h sin c_sin_m :: CDouble - IO CDouble and foreign import ccall math.h sin c_sin :: CDouble - CDouble One can invoke them so: mapM c_sin_m [1..n] mapM (return . c_sin) [1..n] On my computer with n = 10^7 the first version

Re: [Haskell-cafe] Fucntion composing

2011-04-11 Thread Adam Krauze
Thanks all! You helped me a lot. Adam. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] how to optmize this code?

2011-04-11 Thread Gilberto Garcia
Hi Guys, Thanks all for the suggestions, I have certainly improved my knowledge. I made a blog post to show all the possible solution a problem can have. you can check it out at katacoder.blogspot.com Giba On Sun, Apr 10, 2011 at 3:35 AM, Johan Tibell johan.tib...@gmail.com wrote: Hi Gilberto,

Re: [Haskell-cafe] Fucntion composing

2011-04-11 Thread Chris Smith
On Mon, 2011-04-11 at 11:22 +0200, Adam Krauze wrote: f :: (Num a) = [a] - [a] - [(a,a)] // f takes two lists and zips them into one in some special way g :: (Num a) = a - [(a,a)] - [a] // g using some Num value calculates list of singletons from list of pairs Prelude let h x y = (g 0

[Haskell-cafe] Emscripten: compiling LLVM to JavaScript

2011-04-11 Thread Sönke Hahn
Hi all! I haven't tried the tool myself, but it seems interesting to the Haskell efforts to compile to JavaScript: http://syntensity.blogspot.com/2011/04/emscripten-10.html Cheers, Sönke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Foreign function performance: monadic vs pure

2011-04-11 Thread Maciej Marcin Piechotka
On Mon, 2011-04-11 at 12:09 +, Serguei Son wrote: Consider two versions of sin wrapped: foreign import ccall math.h sin c_sin_m :: CDouble - IO CDouble and foreign import ccall math.h sin c_sin :: CDouble - CDouble One can invoke them so: mapM c_sin_m [1..n] mapM (return .

Re: [Haskell-cafe] Foreign function performance: monadic vs pure

2011-04-11 Thread Felipe Almeida Lessa
On Mon, Apr 11, 2011 at 10:14 AM, Maciej Marcin Piechotka uzytkown...@gmail.com wrote: main = mapM (\x - return $! c_sin_u) [1..n] 0.012 s This should be main = mapM (\x - return $! c_sin_u x) [1..n] -- Felipe. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Foreign function performance: monadic vs pure

2011-04-11 Thread Serguei Son
Felipe Almeida Lessa felipe.lessa at gmail.com writes: On Mon, Apr 11, 2011 at 10:14 AM, Maciej Marcin Piechotka uzytkownik2 at gmail.com wrote: main = mapM (\x - return $! c_sin_u) [1..n] 0.012 s This should be main = mapM (\x - return $! c_sin_u x) [1..n] So if I must use a

Re: [Haskell-cafe] Foreign function performance: monadic vs pure

2011-04-11 Thread Serguei Son
Serguei Son serguei.son at gmail.com writes: Felipe Almeida Lessa felipe.lessa at gmail.com writes: On Mon, Apr 11, 2011 at 10:14 AM, Maciej Marcin Piechotka uzytkownik2 at gmail.com wrote: main = mapM (\x - return $! c_sin_u) [1..n] 0.012 s This should be main =

Re: [Haskell-cafe] Foreign function performance: monadic vs pure

2011-04-11 Thread Serguei Son
Serguei Son serguei.son at gmail.com writes: Also, please note that I can force the evaluation of c_sin, e.g. mapM (return . c_sin) [1..n] = (print $ foldl' (+) 0) And it will still execute reasonably fast. Pls disregard the my previous post. I actually meant let lst = map c_sin

Re: [Haskell-cafe] already installed packages alerted as not being installed

2011-04-11 Thread Daniel Kahlenberg
Ingenious, finally it is possible at least with the help of those two tools cabal-dev and cab to build the threadscope executable on Windows linked against gtk+-bundle_2.22.1-20101227_win32 version, thanks again to their developers. [Note to myself] How I did, 1) as described in

Re: [Haskell-cafe] Foreign function performance: monadic vs pure

2011-04-11 Thread Anthony Cowley
On Mon, Apr 11, 2011 at 8:09 AM, Serguei Son serguei@gmail.com wrote: Consider two versions of sin wrapped: foreign import ccall math.h sin    c_sin_m :: CDouble - IO CDouble Marking this call as unsafe (i.e. foreign import ccall unsafe math.h sin) can improve performance dramatically. If

Re: [Haskell-cafe] Emscripten: compiling LLVM to JavaScript

2011-04-11 Thread Christopher Done
On 11 April 2011 14:54, Sönke Hahn sh...@cs.tu-berlin.de wrote: I haven't tried the tool myself, but it seems interesting to the Haskell efforts to compile to JavaScript: http://syntensity.blogspot.com/2011/04/emscripten-10.html Good grief, that sounds incredibly awesome. GHC → LLVM → JS.

Re: [Haskell-cafe] Emscripten: compiling LLVM to JavaScript

2011-04-11 Thread KC
Can JS in a browser call out to heavy computational routines in Haskell? I suppose JS run as a scripting language outside the browser can call out to Haskell. Can Haskell open and interact with a browser window without going through a server like component? On Mon, Apr 11, 2011 at 9:02 AM,

Re: [Haskell-cafe] Emscripten: compiling LLVM to JavaScript

2011-04-11 Thread Michael Snoyman
On Mon, Apr 11, 2011 at 3:54 PM, Sönke Hahn sh...@cs.tu-berlin.de wrote: Hi all! I haven't tried the tool myself, but it seems interesting to the Haskell efforts to compile to JavaScript: http://syntensity.blogspot.com/2011/04/emscripten-10.html I saw this same article this morning. I

Re: [Haskell-cafe] Emscripten: compiling LLVM to JavaScript

2011-04-11 Thread austin seipp
I do wonder how Emscripten handles the GHC calling convention that is part of LLVM. In particular, global register declarations in the RTS scare me from a side line view, and LLVM's calling convention support is what makes the combination work at all in a registered environment. It's currently not

Re: [Haskell-cafe] Emscripten: compiling LLVM to JavaScript

2011-04-11 Thread Szymon Jachim
Time ago YHC compiler (not longer active) got additional backend that generated JS from Yhc.Core. It was working quite ok. You can still find demos online. Generating JS (high level code) from Ghc.Core feels better than from low level code of LLVM. Is GHC.core very different from YHC.core? Sz.

Re: [Haskell-cafe] Tuple

2011-04-11 Thread Henning Thielemann
Anwar Bari schrieb: I have to make a function to check that I have one occurrence of the last element (z) of the same list [a,b] in the tuple How about using Data.Map? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Foreign function performance: monadic vs pure

2011-04-11 Thread Gregory Collins
On Mon, Apr 11, 2011 at 3:55 PM, Serguei Son serguei@gmail.com wrote: So if I must use a safe function returning IO a, there is no way to improve its performance? To give you a benchmark, calling gsl_ran_ugaussian a million times in pure C takes only a second or two on my system. In the C

Re: [Haskell-cafe] Stacking data types

2011-04-11 Thread Job Vranish
Yep you probably don't need the fundep, you just might need to provide more signatures. It does imply one 'b' for an 'a' which probably isn't what you want. On Wed, Apr 6, 2011 at 6:13 PM, Yves Parès limestr...@gmail.com wrote: Thank you all, In fact, Brandon, I knew about Datatypes a la

Re: [Haskell-cafe] Fucntion composing

2011-04-11 Thread Ozgur Akgun
In addition to what others have said, you could use pointfree[1] to do this automagically! pointfree h x y = (g 0 (f x y)) h = (g 0 .) . f [1] http://hackage.haskell.org/package/pointfree On 11 April 2011 10:22, Adam Krauze ajschy...@mac.com wrote: Hello, as I am newbie to Haskell and my

[Haskell-cafe] Higher-kinded Quantification

2011-04-11 Thread Leon Smith
I have a type constructor (Iterator i o m a) of kind (* - * - (* - *) - *), which is a monad transformer, and I'd like to use the type system to express the fact that some computations must be pure, by writing the impredicative type (Iterator i o (forall m. m) a). However I've run into a bit of

[Haskell-cafe] Assimp FFI Library

2011-04-11 Thread Joel Burget
Hello, I've been working on an ffi library for the Assimp asset import library( http://assimp.sourceforge.net). It should be useful for people doing graphics in Haskell. I've been working on it so I can import models into a ray-tracer I've been working on. My current progress is here:

Re: [Haskell-cafe] Assimp FFI Library

2011-04-11 Thread Jason Dagit
On Mon, Apr 11, 2011 at 8:38 PM, Joel Burget joelbur...@gmail.com wrote: Hello, I've been working on an ffi library for the Assimp asset import library( http://assimp.sourceforge.net). It should be useful for people doing graphics in Haskell. I've been working on it so I can import models

Re: [Haskell-cafe] Tuple

2011-04-11 Thread Richard O'Keefe
On 11/04/2011, at 4:49 AM, Anwar Bari wrote: HI Cafe I have to make a function to check that I have one occurrence of the last element (z) of the same list [a,b] in the tuple [([a,b],z)] For example [([1,2],3),([1,1],5),([1,3],6)...] this is true because there is one