[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
documentation says:

 The split operation allows one to obtain two distinct random number
 generators. This is very useful in functional programs (for example,
 when passing a random number generator down to recursive calls), but
 very little work has been done on statistically robust implementations
 of split ([System.Random, System.Random] are the only examples we know
 of). 

I consulted it with a friend, who has done much work in the area of
random number generators. He suggested that this might be implemented
using a random number generator with a very large period, such as
Mersene Twister (MT19937 has a period of 2^19937-1). A pair of splitted
generators states could be positioned sufficiently far enough from each
other so that in practice they never reach each other, and in such a way
that successive splits (in practice) never meet.

I searched Hackage, where I found a few implementations of Mersene
Twister, but AFAIK no one actually implements neither RandomGen nor
'split' alone. I wonder why -- is RandomGen inconvenient or obsolete in
some way? Or just nobody tried?

  With best regards,
  Petr Pudlak

PS: Sorry if you get multiple copies, I had problems sending the mail.
___
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 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 blog post[1].

Michael

[1] http://www.snoyman.com/blog/entry/typesafe-runtime-hamlet/

On Fri, Aug 6, 2010 at 1:25 PM, Michael Snoyman mich...@snoyman.com wrote:



 On Fri, Aug 6, 2010 at 12:28 PM, Benedict Eastaugh ionf...@gmail.comwrote:

 On 6 August 2010 09:19, Michael Snoyman mich...@snoyman.com wrote:

  After looking into sass a little bit, I've decided I like it ;). I see
 the
  following benefits of implementing something sass-like in Haskell via
  quasi-quotation:
 
  * Compile-time guarantee of well-formedness.
  * The speed benefits of blaze-builder. Of course, this will still be
 slower
than serving a static file.
  * Ability to use the same Haskell variables for both Hamlet and CSS.
 
  I've started a new repo on Github[1]; I'm tentatively calling the
 project
  stylish.

 This sounds pretty interesting. I wrote a Ruby tool called Stylish [1]
 a couple of years ago to solve a similar set of problems, and have
 occasionally wondered about rewriting it in Haskell. I look forward to
 seeing what you come up with.

 One potentially useful feature is generating code that requires
 browser prefixes (-webkit-border-radius etc.). There's also potential
 for generating minified versions of the code, concatenating multiple
 stylesheets etc.—it's a lot easier to do this stuff if you can
 programmatically manipulate the stylesheet at run-time. Embedding
 assets (graphics) as data URIs is another thing; have a look at how
 something like Jammit [3] does this.

 As far as the border-radius kind of stuff: the approach I'm taking to
 mixins should make it possible to write a plain old Haskell function to
 output multiple border-radius statements. I might even include such a mixin
 in the main package.

 Regarding concatenating stylesheets: I believe that would have to be
 handled at the level *above* Stylish; Yesod, for example, automatically
 concatenates all style statements added via the addStyle function.

 There's also a Firefox and Thunderbird extension [2] called Stylish.
 Obviously you're free to call your project whatever you wish; I just
 thought I should let you know.

 I'm open to naming suggestions. Here's a few other ideas I'd had:

 * sasslet: I don't really like too much, but makes clear the connection to
 Hamlet and Sass.
 * csser/cssar: pronounced Caesar, might give Shakespeare fans something
 to chuckle at.

 As it stands, I'm leaning fairly strongly towards including Stylish in the
 Hamlet package.

 Michael

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[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 using a BSP Tree 
(following the Painter's Algorithm), then it projects the polygons onto the 
plane of vision and renders each polygon to the screen using Cairo. After some 
investigation, I realised that my bottleneck was the rendering of polygons, but 
I could not speed up the rendering using parallel programming since the 
rendering order is crucial in the Painter's Algorithm. Even if I switched to an 
algorithm based on Hidden Surface Removal so I could render all my obscured 
polygons at once, Gtk2hs is single threaded and its functions cannot be called 
from other threads.

Then I heard about FieldTrip, which uses the GPU to process rendering 
efficiently. I decided to switch to using FieldTrip in conjunction with Gtk2hs 
to write applications, but it doesn't seem that easy because (i) there doesn't 
seem to be any version of GHC where Gtk2hs, Glade and Fieldtrip can work 
together on Windows and (ii) unlike Cairo, there is no Gtk2hs support for 
Fieldtrip in the sense that there are no Gtk2hs functions that render FieldTrip 
output to a Gtk2hs widget, like the DrawWindow. The latter would mean that 
Gtk2hs can't interact easily with FieldTrip.

I really like Gtk2hs because it is very comprehensive and its interface can be 
designed using Glade. Does anyone know if there is a project linking Gtk2hs and 
FieldTrip? Otherwise, does anyone know if user interfaces can be written using 
Reactive (since it's linked to FieldTrip) with the usual functionality (e.g. 
menus, buttons, FieldTrip display reacting to mouseclicks etc)? If that is 
possible then I might have to switch to Reactive, but I'd miss Glade a lot :)

regards,
Herng Yi
  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 mich...@snoyman.com 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, it's for Javascript. I mention it at the end of my most
 recent blog post[1].

 Michael


While It's just a name and not really important: hamlet was haml so I first
imagined sasset, sasslet or another name from one of the works of
Shakespeare but I then really liked stylish as I thought it would tell that
something with solid foundations and theory could still appear, hip and
pretty.

What is important though is the code. This is absolutely great and success
just keeps getting harder to avoid.

Thanks a lot,

Tim Matthews
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[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 happened.

But you can unsafeInitGUIForThreadedRTS with -thread to enable
multi-thread, then use other threads calculate *non-graphics* code,
and use postGUIAsync post all *gtk* code to gtk main-thread.

Of course, if OpenGL still slow, perhaps algorithm problem or hardware
performance problem.

Cheers,

  -- Andy

Herng Yi Cheng hern...@gmail.com writes:

 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 using a BSP Tree (following the 
 Painter's Algorithm),
 then it projects the
 polygons onto the plane of vision and renders each polygon to the screen 
 using Cairo. After some
 investigation, I realised
 that my bottleneck was the rendering of polygons, but I could not speed up 
 the rendering using
 parallel programming since
 the rendering order is crucial in the Painter's Algorithm. Even if I switched 
 to an algorithm based
 on Hidden Surface
 Removal so I could render all my obscured polygons at once, Gtk2hs is 
 single threaded and its
 functions cannot be called
 from other threads.

 Then I heard about FieldTrip, which uses the GPU to process rendering 
 efficiently. I decided to
 switch to using FieldTrip in
 conjunction with Gtk2hs to write applications, but it doesn't seem that easy 
 because (i) there
 doesn't seem to be any
 version of GHC where Gtk2hs, Glade and Fieldtrip can work together on Windows 
 and (ii) unlike Cairo,
 there is no Gtk2hs
 support for Fieldtrip in the sense that there are no Gtk2hs functions that 
 render FieldTrip output
 to a Gtk2hs widget, like
 the DrawWindow. The latter would mean that Gtk2hs can't interact easily with 
 FieldTrip.

 I really like Gtk2hs because it is very comprehensive and its interface can 
 be designed using
 Glade. Does anyone know if
 there is a project linking Gtk2hs and FieldTrip? Otherwise, does anyone know 
 if user interfaces can
 be written using
 Reactive (since it's linked to FieldTrip) with the usual functionality (e.g. 
 menus, buttons,
 FieldTrip display reacting to
 mouseclicks etc)? If that is possible then I might have to switch to 
 Reactive, but I'd miss Glade a
 lot :)

 regards,
 Herng Yi

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 carter.schonw...@gmail.com wrote:
 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:
    /usr/local/lib/libmysqlclient.dylib: mach-o, but wrong architecture)

 does this mean that it won't build on OS X snow leopard?
 (and yes, I am aware of hdbc-odbc, but i was curious if I could use
 hdbc-mysql
 thanks
 -Carter

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 still be able to use parallel threads, but path
 to hardware renderer will be shorter for sure.

Thanks for the info!



I looked at the documentation for GtkGLExt (I think you were referring 
to this), and compared to FieldTrip, I think it's a lot harder to write.
 As diving into either of these systems would require serious work, I'm 
not totally sure of this, but it seems that FieldTrip is more high-level
 with its wrappers and with GtkGLExts you still have to deal with lots 
of small details. Is it possible that that FieldTrip could export a data 
structure (Geometry3 ?) that can be read by GtkGLExts? That would solve the 
problem of interfacing between Gtk2hs and FieldTrip.

regards,
Herng Yi

  ___
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 Michael Snoyman
On Sun, Aug 8, 2010 at 1:03 PM, Tim Matthews tim.matthe...@gmail.comwrote:

 On Sun, Aug 8, 2010 at 9:20 PM, Michael Snoyman mich...@snoyman.comwrote:

 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 blog post[1].

 Michael


 While It's just a name and not really important: hamlet was haml so I first
 imagined sasset, sasslet or another name from one of the works of
 Shakespeare but I then really liked stylish as I thought it would tell that
 something with solid foundations and theory could still appear, hip and
 pretty.

 What is important though is the code. This is absolutely great and success
 just keeps getting harder to avoid.

 This is by no means a final decision; I'm open to being convinced that
other names are better. But I'll point out the main reason for the
Camlet/Jamlet name choice: easy to remember and type. I found stylish to
be much harder to get out than camlet; that might just be because I'm so
used to hamlet already, but that's exactly my goal here: make these three
templating systems work together nicely to make the developers life a little
bit easier.

Michael
___
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 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 mich...@snoyman.com wrote:


 On Sun, Aug 8, 2010 at 1:03 PM, Tim Matthews tim.matthe...@gmail.com
 wrote:

 On Sun, Aug 8, 2010 at 9:20 PM, Michael Snoyman mich...@snoyman.com
 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, it's for Javascript. I mention it at the end of my most
 recent blog post[1].
 Michael

 While It's just a name and not really important: hamlet was haml so I
 first imagined sasset, sasslet or another name from one of the works of
 Shakespeare but I then really liked stylish as I thought it would tell that
 something with solid foundations and theory could still appear, hip and
 pretty.

 What is important though is the code. This is absolutely great and success
 just keeps getting harder to avoid.

 This is by no means a final decision; I'm open to being convinced that other
 names are better. But I'll point out the main reason for the Camlet/Jamlet
 name choice: easy to remember and type. I found stylish to be much harder
 to get out than camlet; that might just be because I'm so used to hamlet
 already, but that's exactly my goal here: make these three templating
 systems work together nicely to make the developers life a little bit
 easier.
 Michael
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



CaSSius and JSaesar?

Alex
___
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 Gábor Lehel
On Sun, Aug 8, 2010 at 3:15 PM, Alexander Dunlap
alexander.dun...@gmail.com wrote:
 On Sun, Aug 8, 2010 at 4:00 AM, Michael Snoyman mich...@snoyman.com wrote:


 On Sun, Aug 8, 2010 at 1:03 PM, Tim Matthews tim.matthe...@gmail.com
 wrote:

 On Sun, Aug 8, 2010 at 9:20 PM, Michael Snoyman mich...@snoyman.com
 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, it's for Javascript. I mention it at the end of my most
 recent blog post[1].
 Michael

 While It's just a name and not really important: hamlet was haml so I
 first imagined sasset, sasslet or another name from one of the works of
 Shakespeare but I then really liked stylish as I thought it would tell that
 something with solid foundations and theory could still appear, hip and
 pretty.

 What is important though is the code. This is absolutely great and success
 just keeps getting harder to avoid.

 This is by no means a final decision; I'm open to being convinced that other
 names are better. But I'll point out the main reason for the Camlet/Jamlet
 name choice: easy to remember and type. I found stylish to be much harder
 to get out than camlet; that might just be because I'm so used to hamlet
 already, but that's exactly my goal here: make these three templating
 systems work together nicely to make the developers life a little bit
 easier.
 Michael
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



 CaSSius and JSaesar?

I'd rather go with Julius at that point.


 Alex
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Work is punishment for failing to procrastinate effectively.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[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)
  return (x, y, z)



From: http://en.wikibooks.org/wiki/Haskell/Syntactic_sugar

Do and proc notation


  Sweet    Unsweet
Monadic binding  do x - getLIne  getLine = \x -
    putStrLn $ You typed:  ++ x putStrLn $ You typed:  
++ x


So, Example 2 desugared becomes...

 [1..] == \z -  ?





Michael




  ___
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 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, michael rice nowg...@yahoo.com 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]
   y - [x..z]
   guard (x^2 + y^2 == z^2)
   return (x, y, z)



 From: http://en.wikibooks.org/wiki/Haskell/Syntactic_sugar

 Do and proc notation


   SweetUnsweet
 Monadic binding  do x - getLIne  getLine = \x -
 putStrLn $ You typed:  ++ x putStrLn $ You
 typed:  ++ x


 So, Example 2 desugared becomes...

  [1..] == \z -  ?





 Michael



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
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 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]
  y - [x..z]
  guard (x^2 + y^2 == z^2)
  return (x, y, z)



From: http://en.wikibooks.org/wiki/Haskell/Syntactic_sugar

Do and proc notation


  SweetUnsweet
Monadic binding  do x - getLIne  getLine = \x  
-
putStrLn $ You typed:  ++ x putStrLn $  
You typed:  ++ x



So, Example 2 desugared becomes...

 [1..] == \z -  ?


[1..] = \z -
[1..z] = \x -
[x..z] = \y -
guard (x^2 + y^2 == z^2) 
return (x, y, z)

Isn't that kinda obvious?







Michael


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
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 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 lemm...@henning-thielemann.de wrote:

From: Henning Thielemann lemm...@henning-thielemann.de
Subject: Re: [Haskell-cafe] What is -
To: michael rice nowg...@yahoo.com
Cc: haskell-cafe@haskell.org
Date: Sunday, August 8, 2010, 9:38 AM


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
On 8 August 2010 16:21, michael rice nowg...@yahoo.com 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://www.haskell.org/mailman/listinfo/haskell-cafe


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 results.)


On Sun, Aug 8, 2010 at 5:26 PM, Christopher Done
chrisd...@googlemail.comwrote:

 On 8 August 2010 16:21, michael rice nowg...@yahoo.com 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://www.haskell.org/mailman/listinfo/haskell-cafe


___
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 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
 ]

is

concat [ [1,1], [2,4], [3,6] ]

is

[1,1,2,4,3,6] 


hope that helps. best regards,
daniel



michael rice schrieb:

  

  
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 lemm...@henning-thielemann.de
wrote:

From: Henning Thielemann lemm...@henning-thielemann.de
Subject: Re: [Haskell-cafe] What is -
To: "michael rice" nowg...@yahoo.com
Cc: haskell-cafe@haskell.org
Date: Sunday, August 8, 2010, 9:38 AM
  
  
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
  



___
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 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 tutorial about many useful monads

both are mentioned at 
http://en.wikipedia.org/wiki/Monad_%28functional_programming%29


 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)
   return (x, y, z)



 From: http://en.wikibooks.org/wiki/Haskell/Syntactic_sugar

 Do and proc notation


   Sweet    Unsweet
 Monadic binding  do x - getLIne  getLine = \x -
     putStrLn $ You typed:  ++  x putStrLn $ You typed: 
  ++ x


 So, Example 2 desugared becomes...

  [1..] == \z -  ?





 Michael


   


-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

___
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 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]) 1
, (\x - [x, x*2]) 2
, (\x - [x, x*2]) 3
 ]
  
is
  
concat [ [1,1], [2,4], [3,6] ]


typo: should be [1,2]

is
  
[1,1,2,4,3,6] 

... and [1,2, ...


  
hope that helps. best regards,
daniel
  
  
  
michael rice schrieb:
  

  

  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 lemm...@henning-thielemann.de
wrote:
  
From: Henning Thielemann lemm...@henning-thielemann.de
Subject: Re: [Haskell-cafe] What is -
To: "michael rice" nowg...@yahoo.com
Cc: haskell-cafe@haskell.org
Date: Sunday, August 8, 2010, 9:38 AM


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
  
  
  

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
  



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[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@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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*s also be in the same IO monad? What determines 
what monad a *do* is in? The first line after the *do*?

Thanks for your patience.

Michael

--- On Sun, 8/8/10, Henning Thielemann lemm...@henning-thielemann.de wrote:

From: Henning Thielemann lemm...@henning-thielemann.de
Subject: Re: [Haskell-cafe] What is -
To: michael rice nowg...@yahoo.com
Date: Sunday, August 8, 2010, 11:01 AM


On Sun, 8 Aug 2010, michael rice wrote:

 How would I print each of these integers, one per line?
 
 [1,2,3,4,5] = \x - ?

You can't do this from inside the List monad, but you can easily do it from 
outside, since the result of a 'do' block in List monad is just a list.

  mapM_ print [1..5]

or

  mapM_ print $ do
     x - [1..]
     ...
     return (x+y+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 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
     .
     .

but must all these other *do*s also be in the same IO monad? What determines 
what monad
a *do* is in? The first line after the *do*?


'do' is just syntactic sugar that is expanded to '=' and '' 
combinators. Determining the monad is the task of type inference. Since x, 
y and (if b then x else y) must have the same type, so if they are monadic 
actions, they are all of the same monad type.___
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 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
  .
  .
 
 but must all these other *do*s also be in the same IO monad?

Yes, if you write it like that, they have to. Let us take as an example
(in the IO monad):
f = do
  x - getLine
  if null x
then y
else z

Desugaring gives:
f =
  getLine = (\x - if null x then y else z)

Since getLine :: IO String and (=) :: Monad m = m a - (a - m b) -
m b, we see that
  m = IO
  a = String
So the type of (\x - if null x then y else z) in the above expression
will be String - IO b. This means that the parameter x will be of type
String, and if null x then y else z will be of type IO b. This implies
that y and z both will be of type IO b. So if you write y and z as a
do-block, this will be in the IO monad.

However, there is no special rule that says in an expression all
do-blocks must have the same type. E.g., the following is a valid
expression:
  do -- in the Maybe monad.
return Nothing
listToMaybe $ do -- in the [] monad.
  return 4

 What
 determines what monad a *do* is in? The first line after the *do*?

Type inference. E.g.
f = do
  return []
will be of type Monad m = m [a].
There is nothing special about monads in this regard, only the
do-notation is special: it is desugared as described elsewhere in the
thread and in the Report.

HTH, Jochem

-- 
Jochem Berndsen | joc...@functor.nl
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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
becomes clear that a haskell monad is a sugarization of plain  functional
tricks.

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
Cognitionhttp://www.ploscompbiol.org/article/info:doi/10.1371/journal.pcbi.1000858?utm_source=feedburnerutm_medium=feedutm_campaign=Feed:+ploscompbiol/NewArticles+(PLoS+Computational+Biology:+New+Articles)

That definitively gives me the motivation to learn category theory
seriously.

Alberto

http://www.ploscompbiol.org/article/info:doi/10.1371/journal.pcbi.1000858?utm_source=feedburnerutm_medium=feedutm_campaign=Feed:+ploscompbiol/NewArticles+(PLoS+Computational+Biology:+New+Articles)

2010/8/7 Michael Mossey m...@alumni.caltech.edu

 When I started to study Haskell, I was surprised that so much emphasis was
 placed on simple things. Monads were introduced to me as basically a
 wrapper, and a bind function that unwrapped something and wrapped something
 else back up again. I didn't understand what the fuss was about. Later I saw
 the amazing feats of expressiveness that were possible. I scratched my head
 in confusion---Wait, say that again?

 Here's a quote from Bertrand Russell about philosophy (read: Haskell). He's
 actually being humorous, but it applies, in a way:

 The point of philosophy is to start with something so simple as not to
 seem worth stating, and to end with something so paradoxical no one will
 believe it.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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, could you tell me what was the result of the final desugarization 
and the BASIC sense of the IO monad for you? 


Jerzy Karczmarczuk
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[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.org/mailman/listinfo/haskell-cafe


[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 more than horrible.

I failed to find convincing counter-evidence on the web. Not for
Haskell, even for Java/C#/C++.

So I asking Haskell-cafe for clarification. Do anyone here have an
experience with STM in computing-intensive tasks? Did it help there?
What are the possible reasons for STM failure in MR?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2010-08-08 Thread Gregory Collins
Carter Schonwald carter.schonw...@gmail.com 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:
 /usr/local/lib/libmysqlclient.dylib: mach-o, but wrong architecture)

 does this mean that it won't build on OS X snow leopard?

GHC on OSX is 32-bit, so you need to build a 32-bit or universal mysql
library. The linker is probably complaining because your libmysqlclient
is 64-bit.

G
-- 
Gregory Collins g...@gregorycollins.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[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: Better Strategies for
Parallel Haskell article.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 agocor...@gmail.com
Date: 2010/8/8
Subject: Re: [Haskell-cafe] Is there any experience using Software
Transactional Memory in substantial applications?
To: Serguey Zefirov sergu...@gmail.com


This first papers is the first that describes the preliminary haskell
implementation and the performance data says that STM scales well with the
number of CPU cores  Blocking does not scale, as expected.

http://research.microsoft.com/en-us/um/people/simonpj/papers/stm/lock-free-flops06.pdf

In this other study, also for microsoft:

http://research.microsoft.com/en-us/um/people/simonpj/papers/stm/lock-free-flops06.pdf
 Dissecting Transactional Executions in
Haskellhttp://www.cs.rochester.edu/meetings/TRANSACT07/papers/perfumo.pdf
.

The worst performance  in the study is from an extreme case example form my
package TCache described
herehttp://haskell-web.blogspot.com/2006/11/transactional-cache-for-haskell.html.
In that example,  a set of treads update the same two objects all the time.
Since STM is non  blocking, all threads tries to perform the task and
rollback at the very end if things have been changed by other thread in the
meantime. Just like databases. The bad thing is that the more CPU cores are
executing the example, the more work being rolled back is done. That is more
or less the history.

 I heard (The Monad Reader -mplementing STM in pure
Haskellhttp://themonadreader.files.wordpress.com/2010/01/issue15.pdf)
  about other tentative implementation that do not wait for the end of the
atomic task to test the atomicity of the transaction, but instead, any
update of a TVar inmediately invalidates (and kill) all  atomic transactions
that uses that TVar. This could potentially improve the performance a lot.

However I don´t know the strategy of the current haskell implementation nor
the strasategy of the Microsoft runtime(s) either.

Anyway, it is waranteed 100% that 1) the slowest in memory transaction is
way faster than the transaction delegated to the fastest external database.
 2) in memory transactions with blocking is a nightmare. For me  these are
enough arguments for  STM usage in many ordinary (I mean Web) applications.


2010/8/8 Serguey Zefirov sergu...@gmail.com

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 more than
 horrible.

 I failed to find convincing counter-evidence on the web. Not for
 Haskell, even for Java/C#/C++.

 So I asking Haskell-cafe for clarification. Do anyone here have an
 experience with STM in computing-intensive tasks? Did it help there?
 What are the possible reasons for STM failure in MR?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 a...@go2ghana.de 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 system-wide?


The asnwer seems to be given at:
  http://osdir.com/ml/haskell-cafe@haskell.org/2009-12/msg01540.html

Regards,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 agocor...@gmail.com:


 -- Forwarded message --
 From: Alberto G. Corona agocor...@gmail.com
 Date: 2010/8/8
 Subject: Re: [Haskell-cafe] Is there any experience using Software
 Transactional Memory in substantial applications?
 To: Serguey Zefirov sergu...@gmail.com


 This first papers is the first that describes the preliminary haskell
 implementation and the performance data says that STM scales well with the
 number of CPU cores  Blocking does not scale, as expected.
 http://research.microsoft.com/en-us/um/people/simonpj/papers/stm/lock-free-flops06.pdf
 In this other study, also for microsoft:
  Dissecting Transactional Executions in Haskell.
 The worst performance  in the study is from an extreme case example form my
 package TCache described here. In that example,  a set of treads update the
 same two objects all the time. Since STM is non  blocking, all threads tries
 to perform the task and rollback at the very end if things have been changed
 by other thread in the meantime. Just like databases. The bad thing is that
 the more CPU cores are executing the example, the more work being rolled
 back is done. That is more or less the history.
  I heard (The Monad Reader -mplementing STM in pure Haskell)   about other
 tentative implementation that do not wait for the end of the atomic task to
 test the atomicity of the transaction, but instead, any update of a TVar
 inmediately invalidates (and kill) all  atomic transactions that uses that
 TVar. This could potentially improve the performance a lot.
 However I don´t know the strategy of the current haskell implementation nor
 the strasategy of the Microsoft runtime(s) either.
 Anyway, it is waranteed 100% that 1) the slowest in memory transaction is
 way faster than the transaction delegated to the fastest external database.
  2) in memory transactions with blocking is a nightmare. For me  these are
 enough arguments for  STM usage in many ordinary (I mean Web) applications.


 2010/8/8 Serguey Zefirov sergu...@gmail.com

 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 more than
 horrible.

 I failed to find convincing counter-evidence on the web. Not for
 Haskell, even for Java/C#/C++.

 So I asking Haskell-cafe for clarification. Do anyone here have an
 experience with STM in computing-intensive tasks? Did it help there?
 What are the possible reasons for STM failure in MR?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 useless [1]
3. Listen to Anders! [2]

An interesting sample:

Anders Hejlsberg: Well, the best Software
Transactional Memory implementations are still sitting
at around 200% to 400% and that's even in best
cases actually and still with Software Transactional
Memory it's still, in a sense, it's still a problem of
synchronization and shared state which...

Carl Franklin:
It's just under the lower level.

Anders Hejlsberg: Some would argue it's t h e
wrong way to look at the problem in the beginning.
We shouldn't have the shared state to begin with.

Richard Campbell: Right.

Hat guy from xkcd (Enter stage left): But don't you see that Haskell has
no shared state.  That's exactly why STM is so great for doing
concurrency in Haskell!

(I maybe edited that a little there.)

Ta ta,
   Johnny

[1] Artificial intelligence is pointless
http://www.youtube.com/watch?v=nvZBtJ-ncEM

[2] The internet audio talkshow
http://www.dotnetrocks.com/default.aspx?showNum=541
I found this transcript on google.  Server seems to give of fake 404
pages, so have to hotlink :(
http://perseus.franklins.net/dotnetrocks_0541_anders_hejlsberg.pdf



___
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 briand
On Sun, 8 Aug 2010 11:13:33 -0700
bri...@aracnet.com 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/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 sp...@killersmurf.com:
 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 useless [1]
 3. Listen to Anders! [2]

 Anders Hejlsberg: Some would argue it's t h e
 wrong way to look at the problem in the beginning.
 We shouldn't have the shared state to begin with.

 Richard Campbell: Right.

Except that we have to write real apps is a real gem of that conversation. ;)

Thank you very much for your points.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[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.e. loading it and typing
main.

I get a seg-fault when it exits:

Ok, modules loaded: Main.
*Main main
Loading package array-0.3.0.0 ... linking ... done.
Loading package bytestring-0.9.1.5 ... linking ... done.
Loading package filepath-1.1.0.3 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.3 ... linking ... done.
Loading package unix-2.4.0.0 ... linking ... done.
Loading package directory-1.0.1.0 ... linking ... done.
Loading package process-1.0.1.2 ... linking ... done.
Loading package time-1.1.4 ... linking ... done.
Loading package random-1.0.0.2 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package cairo-0.11.0 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package glib-0.11.0 ... linking ... done.
Loading package gio-0.11.0 ... linking ... done.
Loading package pretty-1.0.1.1 ... linking ... done.
Loading package pango-0.11.0 ... linking ... done.
Loading package gtk-0.11.0 ... linking ... done.
*Main Segmentation fault

I included all the messages in case someone knows that one of the
libraries is out of date and could be the source of the problem.

Is it to be expected that it would seg-fault under ghci ??

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 sergu...@gmail.com 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 any sense for me.  Well, whatever =).

Cheers! =)

-- 
Felipe.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 o...@cs.otago.ac.nz 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 could
 do myself.  Functor, yes, I could have invented Functor.
 But not the others.
 
 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 have read You Could Have Invented
Monads, and recommended it to students.  In fact I _did_ invent
monads, in the guise of parser combinators.  That is to say, having
heard of parser combinators, I developed my own set, which contained
operations recognisable with hindsight as the operations of Monad and
MonadPlus c BUT I DID NOT REALISE THAT THAT WAS WHAT I HAD DONE.
After reading that blog post, yes.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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 have read You Could Have Invented
 Monads, and recommended it to students.  In fact I _did_ invent
 monads, in the guise of parser combinators.  That is to say, having
 heard of parser combinators, I developed my own set, which contained
 operations recognisable with hindsight as the operations of Monad and
 MonadPlus c BUT I DID NOT REALISE THAT THAT WAS WHAT I HAD DONE.
 After reading that blog post, yes.

That's what the And Maybe You Already Have part is about

- -- 
brandon s. allbery [linux,solaris,freebsd,perl]  allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university  KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxfQQ4ACgkQIn7hlCsL25V5aQCfaweA9PmrInW3BSQwVQdDhdnQ
vo0AnRbv58abJ7jINqDsZG2UaXifmRLl
=c9Ro
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[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

bri...@aracnet.com writes:

 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.e. loading it and typing
 main.

 I get a seg-fault when it exits:

 Ok, modules loaded: Main.
 *Main main
 Loading package array-0.3.0.0 ... linking ... done.
 Loading package bytestring-0.9.1.5 ... linking ... done.
 Loading package filepath-1.1.0.3 ... linking ... done.
 Loading package old-locale-1.0.0.2 ... linking ... done.
 Loading package old-time-1.0.0.3 ... linking ... done.
 Loading package unix-2.4.0.0 ... linking ... done.
 Loading package directory-1.0.1.0 ... linking ... done.
 Loading package process-1.0.1.2 ... linking ... done.
 Loading package time-1.1.4 ... linking ... done.
 Loading package random-1.0.0.2 ... linking ... done.
 Loading package haskell98 ... linking ... done.
 Loading package mtl-1.1.0.2 ... linking ... done.
 Loading package cairo-0.11.0 ... linking ... done.
 Loading package containers-0.3.0.0 ... linking ... done.
 Loading package glib-0.11.0 ... linking ... done.
 Loading package gio-0.11.0 ... linking ... done.
 Loading package pretty-1.0.1.1 ... linking ... done.
 Loading package pango-0.11.0 ... linking ... done.
 Loading package gtk-0.11.0 ... linking ... done.
 *Main Segmentation fault

 I included all the messages in case someone knows that one of the
 libraries is out of date and could be the source of the problem.

 Is it to be expected that it would seg-fault under ghci ??

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2010-08-08 Thread Ivan Lazar Miljenovic
On 9 August 2010 09:44, Andy Stewart lazycat.mana...@gmail.com 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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2010-08-08 Thread Andy Stewart
Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes:

 On 9 August 2010 09:44, Andy Stewart lazycat.mana...@gmail.com 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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[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

original
Date: Sun, 8 Aug 2010 11:13:33 -0700
From: bri...@aracnet.com
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 find the
actual code (I did find the cairo blog, with examples but no code).
 
Can some kind soul post a link ?
 
Thanks
\original

If you've installed gtk2hs on your computer, go to 
gtk2hs/0.10.1/share/demo/cairo or some similar folder (using your own gtk2hs 
version). There are some cairo examples there with source code.

regards,
Herng Yi
  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2010-08-08 Thread briand
On Mon, 09 Aug 2010 11:09:40 +0800
Andy Stewart lazycat.mana...@gmail.com wrote:

 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes:
 
  On 9 August 2010 09:44, Andy Stewart lazycat.mana...@gmail.com
  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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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
Cognitionhttp://www.ploscompbiol.org/article/info:doi/10.1371/journal.pcbi.1000858?utm_source=feedburnerutm_medium=feedutm_campaign=Feed:+ploscompbiol/NewArticles+(PLoS+Computational+Biology:+New+Articles)


Ooh, that looks very shiny. Thanks for sharing :)

--
Live well,
~wren
___
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 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