[Haskell-cafe] a random numbers generator with a good 'split'

2010-08-08 Thread deb
Hi cafe. recently I was looking at various possibilities of generating random numbers in Haskell. Apparently, the main problem is the 'split' function in the System.Random.RandomGen class. Since it is rarely needed in imperative programs, not much is known how to implement it safely. It's doc

Re: [Haskell-cafe] Re: [web-devel] statically compiled css

2010-08-08 Thread Michael Snoyman
Quick update: I'm including the "Stylish" code in the hamlet package now, and renaming it to "Camlet" (CSS-hamlet). I'm also including something called "Jamlet", which doesn't do much besides variable interpolation. As you might guess, it's for Javascript. I mention it at the end of my most recent

[Haskell-cafe] Combining Gtk2hs and Fieldtrip

2010-08-08 Thread Herng Yi Cheng
Recently I wrote a 3D graphics viewer using Gtk2hs and Cairo, and it works ok, aside from the fact that it got quite slow when it got to displaying about 1000 polygons. It works something like this: The three-dimensional coordinates of polygons are given, and the program sorts the polygons usin

Re: [Haskell-cafe] Combining Gtk2hs and Fieldtrip

2010-08-08 Thread Serguey Zefirov
Gtk2hs has an OepnGL binding. So you can create OpenGL context and draw there. I don't think you will still be able to use parallel threads, but path to hardware renderer will be shorter for sure. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org ht

Re: [Haskell-cafe] Re: [web-devel] statically compiled css

2010-08-08 Thread Tim Matthews
On Sun, Aug 8, 2010 at 9:20 PM, Michael Snoyman wrote: > Quick update: I'm including the "Stylish" code in the hamlet package now, > and renaming it to "Camlet" (CSS-hamlet). I'm also including something > called "Jamlet", which doesn't do much besides variable interpolation. As > you might guess

[Haskell-cafe] Re: Combining Gtk2hs and Fieldtrip

2010-08-08 Thread Andy Stewart
Hi Herng, You can use gtk2hs with OpenGL, then use OpenGL render your 3D graphics. You can use command cabal install install gtkglext to try it, demo at http://code.haskell.org/gtkglext/demo/ About multi-threaded, yes, you must post all *gtk* code to gtk+ main thread, otherwise bad thing will

Re: [Haskell-cafe] hdbc-mysql broken on snow-leopard?

2010-08-08 Thread Christopher Done
Did you install libmysqlclient? sudo port install should handle this, IIRC. There's also this problem in general with MySQL, it seems: http://www.google.co.uk/#q=libmysqlclient+os+x On 8 August 2010 03:27, Carter Schonwald wrote: > Hey All, > when i build hdbc-mysql and then try to run some exa

RE: [Haskell-cafe] Combining Gtk2hs and Fieldtrip

2010-08-08 Thread Herng Yi Cheng
> Date: Sun, 8 Aug 2010 12:53:54 +0300 > Subject: Re: [Haskell-cafe] Combining Gtk2hs and Fieldtrip > From: sergu...@gmail.com > To: hern...@gmail.com > CC: haskell-cafe@haskell.org > > Gtk2hs has an OepnGL binding. So you can create OpenGL context and draw there. > > I don't think you will stil

Re: [Haskell-cafe] Re: [web-devel] statically compiled css

2010-08-08 Thread Michael Snoyman
On Sun, Aug 8, 2010 at 1:03 PM, Tim Matthews wrote: > On Sun, Aug 8, 2010 at 9:20 PM, Michael Snoyman wrote: > >> Quick update: I'm including the "Stylish" code in the hamlet package now, >> and renaming it to "Camlet" (CSS-hamlet). I'm also including something >> called "Jamlet", which doesn't do

Re: [Haskell-cafe] Re: [web-devel] statically compiled css

2010-08-08 Thread Lyndon Maydwell
Sassy? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: [web-devel] statically compiled css

2010-08-08 Thread Alexander Dunlap
On Sun, Aug 8, 2010 at 4:00 AM, Michael Snoyman wrote: > > > On Sun, Aug 8, 2010 at 1:03 PM, Tim Matthews > wrote: >> >> On Sun, Aug 8, 2010 at 9:20 PM, Michael Snoyman >> wrote: >>> >>> Quick update: I'm including the "Stylish" code in the hamlet package now, >>> and renaming it to "Camlet" (CS

Re: [Haskell-cafe] Re: [web-devel] statically compiled css

2010-08-08 Thread Gábor Lehel
On Sun, Aug 8, 2010 at 3:15 PM, Alexander Dunlap wrote: > On Sun, Aug 8, 2010 at 4:00 AM, Michael Snoyman wrote: >> >> >> On Sun, Aug 8, 2010 at 1:03 PM, Tim Matthews >> wrote: >>> >>> On Sun, Aug 8, 2010 at 9:20 PM, Michael Snoyman >>> wrote: Quick update: I'm including the "Stylish"

[Haskell-cafe] What is <-

2010-08-08 Thread michael rice
What is <- ? Couldn't find anything on Hoogle. 1)  main = do   x <- getLine   -- get the value from the IO monad   putStrLn $ "You typed: " ++ x 2)  pythags = do   z <- [1..] --get the value from the List monad?   x <- [1..z]   y <- [x..z]   guard (x^2 + y^2 == z^2)  

Re: [Haskell-cafe] What is <-

2010-08-08 Thread Henning Thielemann
On Sun, 8 Aug 2010, michael rice wrote: So, Example 2 desugared becomes... [1..] >== \z ->  ? Yes, [1..] >>= \z -> ... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] What is <-

2010-08-08 Thread Christopher Done
In shortyes, "do z <- ..; foo" desugars to "... >>= \z -> foo" The Haskell Report describes `do' notation in detail: http://www.haskell.org/onlinereport/exps.html#sect3.14 Real World Haskell describes its uses: http://book.realworldhaskell.org/read/io.html#io.bind On 8 August 2010 15:36, micha

Re: [Haskell-cafe] What is <-

2010-08-08 Thread Miguel Mitrofanov
On 8 Aug 2010, at 17:36, michael rice wrote: What is <- ? Couldn't find anything on Hoogle. 1) main = do x <- getLine -- get the value from the IO monad putStrLn $ "You typed: " ++ x 2) pythags = do z <- [1..] --get the value from the List monad? x <- [1..z]

Re: [Haskell-cafe] What is <-

2010-08-08 Thread michael rice
getLine >>= \x ->  -- x is a string at this point [1..] >>= \x ->    -- x is WHAT at this point? MIchael --- On Sun, 8/8/10, Henning Thielemann wrote: From: Henning Thielemann Subject: Re: [Haskell-cafe] What is <- To: "michael rice" Cc: haskell-cafe@haskell.org Date: Sunday, August

Re: [Haskell-cafe] What is <-

2010-08-08 Thread Christopher Done
On 8 August 2010 16:21, michael rice wrote: > getLine >>= \x -> -- x is a string at this point > > [1..] >>= \x ->-- x is WHAT at this point? > Num n => n A number from the list. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

Re: [Haskell-cafe] What is <-

2010-08-08 Thread Markus Läll
Hi Michael, although I never used it myself, lists seem strange in the way that when combining list monads, then all the values go through the chain one by one -- x will be 1 first, then 2, then 3 and so on.. Try it out, to see. (I think the result is then also a list of all combinations of result

Re: [Haskell-cafe] What is <-

2010-08-08 Thread Daniel van den Eijkel
If xs is a list, xs >>= f is the same as (concat (map f xs)). Take a look at the monad instance for lists. So, in [1..] >>= \x -> x  is "every" element of the list. Example: [1,2,3] >>= \x -> [x, x*2] is concat  [ (\x -> [x, x*2]) 1  , (\x -> [x, x*2]) 2  , (\x -> [x, x*2]) 3   ]

Re: [Haskell-cafe] What is <-

2010-08-08 Thread Bulat Ziganshin
Hello michael, Sunday, August 8, 2010, 5:36:05 PM, you wrote: i highly recommend you to read http://sigfpe.blogspot.com/2006/08/you-could-have-invented-monads-and.html that is the best introduction into monads i know and then http://haskell.org/all_about_monads/html/index.html - comprehensive tu

Re: [Haskell-cafe] What is <-

2010-08-08 Thread Daniel van den Eijkel
Daniel van den Eijkel schrieb: If xs is a list, xs >>= f is the same as (concat (map f xs)). Take a look at the monad instance for lists. So, in [1..] >>= \x -> x  is "every" element of the list. Example: [1,2,3] >>= \x -> [x, x*2] is concat  [ (\x -> [x, x*2])

[Haskell-cafe] setting gcc during the ghc-build phase

2010-08-08 Thread Günther Schmidt
Hi all, for build ghc from source, how can I set which c-compiler to use? ./configure --with-gcc= does not seem to work for ghc-6.12.3 nor does setting the CC-environment variable. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@ha

Re: [Haskell-cafe] What is <-

2010-08-08 Thread michael rice
That was my suspicion. So, you can't change horses (monads) in mid-stream. A parallel question: main = do ...    -- in the IO monad I know I can have other *do*s in main,   if foo     then do       .       .     else do      .      . but must all these other *do

Re: [Haskell-cafe] What is <-

2010-08-08 Thread Henning Thielemann
On Sun, 8 Aug 2010, michael rice wrote: That was my suspicion. So, you can't change horses (monads) in mid-stream. A parallel question: main = do ...    -- in the IO monad I know I can have other *do*s in main,   if foo     then do       .       .     else do      .

Re: [Haskell-cafe] What is <-

2010-08-08 Thread Jochem Berndsen
michael rice wrote: > That was my suspicion. So, you can't change horses (monads) in mid-stream. > > A parallel question: > > main = do ...-- in the IO monad > > I know I can have other *do*s in main, > > if foo > then do > . > . > else do >

Re: [Haskell-cafe] philosophy of Haskell

2010-08-08 Thread Alberto G. Corona
I did`nt care about the underlying theory behind monads once I learn that the easy way to understand them is trough desugarization. Desugarize the "do" notation, after that, desugarize the >>= and >> operators down to the function call notation and suddenly everithing lost its magic because it bec

Re: [Haskell-cafe] philosophy of Haskell

2010-08-08 Thread jerzy . karczmarczuk
Alberto G. Corona writes: (...) Desugarize the "do" notation, after that, desugarize the >>= and >> operators down to the function call notation and suddenly everithing lost its magic because it becomes clear that a haskell monad is a sugarization of plain functional tricks. Yep. But, BTW

[Haskell-cafe] cairo rendered to screen examples

2010-08-08 Thread briand
I've been running around the gtk2hs web site and can't seem to find the actual code (I did find the cairo blog, with examples but no code). Can some kind soul post a link ? Thanks ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell

[Haskell-cafe] Is there any experience using Software Transactional Memory in substantial applications?

2010-08-08 Thread Serguey Zefirov
Recently we discussed Haskell and especially types in Russian part of LiveJournal and of course we talk about STM. My opponent gave me that link: http://logicaloptimizer.blogspot.com/2010/06/so-microsofts-experiments-with-software.html It says that performance with STM in Microsoft Research was m

Re: [Haskell-cafe] hdbc-mysql broken on snow-leopard?

2010-08-08 Thread Gregory Collins
Carter Schonwald writes: > Hey All, > when i build hdbc-mysql and then try to run some example code, i get the > following error message: > > Loading package HDBC-mysql-0.6.3 ... can't load .so/.DLL for: mysqlclient > (dlopen(libmysqlclient.dylib, 9): no suitable image found. Did find: > /us

[Haskell-cafe] Typo or on purpose? http://haskell.org/ghc/docs/6.12.2/html/users_guide/lang-parallel.html

2010-08-08 Thread Alexander Kotelnikov
This + 1 in (n1 + n2 + 1) what is it doing there? import Control.Parallel nfib :: Int -> Int nfib n | n <= 1 = 1 | otherwise = par n1 (pseq n2 (n1 + n2 + 1)) where n1 = nfib (n-1) n2 = nfib (n-2) BTW, same code can be found in "Seq no more:

Fwd: [Haskell-cafe] Is there any experience using Software Transactional Memory in substantial applications?

2010-08-08 Thread Alberto G. Corona
-- Forwarded message -- From: Alberto G. Corona Date: 2010/8/8 Subject: Re: [Haskell-cafe] Is there any experience using Software Transactional Memory in substantial applications? To: Serguey Zefirov This first papers is the first that describes the preliminary haskell implement

Re: [Haskell-cafe] using shared libs on the windows version

2010-08-08 Thread Henk-Jan van Tuyl
On Sat, 07 Aug 2010 10:52:57 +0200, Axel Huizinga wrote: I run into problems using shared libs on windows. The error messages I get looks like: Could not find module `Data.List': Perhaps you haven't installed the "dyn" libraries for package `base'? Any ideas how to enable shared libs sys

Re: [Haskell-cafe] Is there any experience using Software Transactional Memory in substantial applications?

2010-08-08 Thread Serguey Zefirov
Thank you very much. This is just the answer I needed. 2010/8/8 Alberto G. Corona : > > > -- Forwarded message -- > From: Alberto G. Corona > Date: 2010/8/8 > Subject: Re: [Haskell-cafe] Is there any experience using Software > Transactional Memory in substantial applications? > T

Re: [Haskell-cafe] Is there any experience using Software Transactional Memory in substantial applications?

2010-08-08 Thread Johnny Morrice
> My opponent gave me that link: http://logicaloptimizer.blogspot.com/2010/06/so-microsofts-experiments-with-software.html I enjoy the article you linked but I sort of skimmed it because it was a little boring, however its main point seem to be: 1. Ghostbusters. 2. Artificial intelligence is usel

Re: [Haskell-cafe] cairo rendered to screen examples

2010-08-08 Thread briand
On Sun, 8 Aug 2010 11:13:33 -0700 wrote: > I've been running around the gtk2hs web site and can't seem to find > the actual code (I did find the cairo blog, with examples but no > code). > > Can some kind soul post a link ? > and here you go: http://code.haskell.org/gtk2hs/cairo/demo/ __

Re: [Haskell-cafe] Is there any experience using Software Transactional Memory in substantial applications?

2010-08-08 Thread Serguey Zefirov
2010/8/8 Johnny Morrice : >> My opponent gave me that link: > http://logicaloptimizer.blogspot.com/2010/06/so-microsofts-experiments-with-software.html > > I enjoy the article you linked but I sort of skimmed it because it was a > little boring, however its main point seem to be: > > 1. Ghostbuster

[Haskell-cafe] gkt2hs seg fault issue

2010-08-08 Thread briand
I reported a seg-fault in chart a while back. so I was experimenting with cairo and rendering to to the screen, which if my understanding is correct, uses gtk. Certainly looks like it. So I compiled the cairo example Drawing.hs and that worked fine. I then tried running the example from ghci, i

Re: [Haskell-cafe] Is there any experience using Software Transactional Memory in substantial applications?

2010-08-08 Thread Felipe Lessa
On Sun, Aug 8, 2010 at 6:09 PM, Serguey Zefirov wrote: > "Except that we have to write real apps" is a real gem of that conversation. > ;) So this Anders guy bashes functional languages and then says that programmers should be encouraged to write functional code in OO languages? Doesn't make an

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-08 Thread Richard O'Keefe
On Aug 3, 2010, at 11:37 PM, Christopher Witte wrote: > On 3 August 2010 01:34, Richard O'Keefe wrote: > There's a thing I'm still finding extremely hard about monads, > and that's how to get into the frame of mind where inventing > things like Monad and Applicative and Arrows is something I cou

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-08 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/8/10 19:28 , Richard O'Keefe wrote: > On Aug 3, 2010, at 11:37 PM, Christopher Witte wrote: >> Maybe looking at Sigfpe's blog post You Could Have Invented Monads! (And >> Maybe You Already Have.) will help. > > Notice the tense, "could have". I

[Haskell-cafe] Re: gkt2hs seg fault issue

2010-08-08 Thread Andy Stewart
Which ghc version? It's have a bug in ghc-6.12 that cause gtk2hs segment fault. If you use other ghc version, you should use gdb run your program to get backtrace, then we can help you. Cheers, -- Andy writes: > I reported a seg-fault in chart a while back. > > so I was experimenting with

Re: [Haskell-cafe] Re: gkt2hs seg fault issue

2010-08-08 Thread Ivan Lazar Miljenovic
On 9 August 2010 09:44, Andy Stewart wrote: > Which ghc version? > > It's have a bug in ghc-6.12 that cause gtk2hs segment fault. If memory serves, that bug was only present in 6.12.2... -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com

Re: [Haskell-cafe] Re: gkt2hs seg fault issue

2010-08-08 Thread Andy Stewart
Ivan Lazar Miljenovic writes: > On 9 August 2010 09:44, Andy Stewart wrote: >> Which ghc version? >> >> It's have a bug in ghc-6.12 that cause gtk2hs segment fault. > > If memory serves, that bug was only present in 6.12.2... Yes, typo, it's a bug of ghc-6.12.2 -- Andy __

[Haskell-cafe] Spivak's "Databases are Categories" video/slides at www.galois.com

2010-08-08 Thread Vasili I. Galchin
Hello, I'm sorry if this has already been posted. http://www.galois.com/blog/2010/05/27/tech-talk-categories-are-databases/ Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] cairo rendered to screen examples

2010-08-08 Thread Herng Yi Cheng
Date: Sun, 8 Aug 2010 11:13:33 -0700 From: Subject: [Haskell-cafe] cairo rendered to screen examples To: haskell-cafe@haskell.org Message-ID: <20100808111333.44b5f...@windy.deldotd.com> Content-Type: text/plain; charset=US-ASCII I've been running around the gtk2hs web site and can't seem to fi

Re: [Haskell-cafe] Re: gkt2hs seg fault issue

2010-08-08 Thread briand
On Mon, 09 Aug 2010 11:09:40 +0800 Andy Stewart wrote: > Ivan Lazar Miljenovic writes: > > > On 9 August 2010 09:44, Andy Stewart > > wrote: > >> Which ghc version? > >> The Glorious Glasgow Haskell Compilation System, version 6.12.1 So just run gdb on ghci to see what is happening ? Brian

Re: [Haskell-cafe] philosophy of Haskell

2010-08-08 Thread wren ng thornton
Alberto G. Corona wrote: But it seems that the trick is so productive because it comes from some fundamental properties of math, the reality, and maybe the human mind . Jost now I found this article: Categorial Compositionality: A Category Theory Explanation for the Systematicity of Human Cognit

Re: [Haskell-cafe] Re: [web-devel] statically compiled css

2010-08-08 Thread wren ng thornton
Alexander Dunlap wrote: CaSSius and JSaesar? +1 for Cassius. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-08 Thread David Virebayre
On Fri, Aug 6, 2010 at 5:58 PM, Alex Stangl wrote: > On Fri, Aug 06, 2010 at 10:17:26AM -0500, aditya siram wrote: >> >From my vantage point they are (in no particular order) : Reader, Writer, >> State, IO, ST, STM, Parsec (have I missed any?) and of course the >> transformer versions. I am debati