[Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Jacek Generowicz
[ TLDR: How do you do Lisp symbols in Haskell? ] What is the Haskell approach to efficient comparison and lookup of objects by their identity? Maybe a toy example would help to explain what I mean. Imagine that I want to use Haskell to maximize happiness in a situation where a bunch of

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Brandon Allbery
On Thu, May 26, 2011 at 04:45, Jacek Generowicz jacek.generow...@cern.chwrote: What is the Haskell approach to efficient comparison and lookup of objects by their identity? ghc uses Data.Unique to generate unique internal identifiers to associate with things. (Think gensym. Hm, except last

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Christopher Done
On 26 May 2011 10:45, Jacek Generowicz jacek.generow...@cern.ch wrote: What is the Haskell approach to efficient comparison and lookup of objects by their identity? Often you just provide your own and implement Eq. I should be able to run the program on data that becomes available at run

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Jacek Generowicz
On 2011 May 26, at 11:12, Brandon Allbery wrote: On Thu, May 26, 2011 at 04:45, Jacek Generowicz jacek.generow...@cern.ch wrote: What is the Haskell approach to efficient comparison and lookup of objects by their identity? ghc uses Data.Unique to generate unique internal identifiers to

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Jacek Generowicz
On 2011 May 26, at 11:16, Christopher Done wrote: On 26 May 2011 10:45, Jacek Generowicz jacek.generow...@cern.ch wrote: What is the Haskell approach to efficient comparison and lookup of objects by their identity? Often you just provide your own and implement Eq. I should be able to

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Brandon Allbery
On Thu, May 26, 2011 at 05:41, Jacek Generowicz jacek.generow...@cern.chwrote: On 2011 May 26, at 11:12, Brandon Allbery wrote: (Think gensym. Hm, except last time I did anything serious with Lisp, it was Maclisp... does gensym even still exist, or did CL do something inscrutable with it?)

[Haskell-cafe] Strange Type Error

2011-05-26 Thread jean-christophe mincke
Hello, Could anyone help me understand what is wrong with the definition of f2 in the code below? class C a b where convert :: a - b convertToInt :: (C a Int) = a - Int convertToInt x = convert x f1 x = convertToInt x f2 = \x - convertToInt x f3 :: (C a Int) = a - Int f3 = \x -

Re: [Haskell-cafe] Status of Haskell + Mac + GUIs graphics

2011-05-26 Thread John Lato
fltk definitely has some good points, but I've always found it hideously ugly. Of course the default gtk on osx is ugly too, but some of the available themes are nice. However, getting gtk with OpenGL on osx was fairly easy. Everything worked out of the box except gtkglext (Haskell package).

Re: [Haskell-cafe] Strange Type Error

2011-05-26 Thread Christopher Done
The problem is the monomorphism restriction: http://www.haskell.org/haskellwiki/Monomorphism_restriction http://www.haskell.org/ghc/docs/7.0.2/html/users_guide/monomorphism.html http://stackoverflow.com/questions/tagged/monomorphism-restriction

Re: [Haskell-cafe] Strange Type Error

2011-05-26 Thread Brandon Allbery
On Thu, May 26, 2011 at 06:01, jean-christophe mincke jeanchristophe.min...@gmail.com wrote: f1 x =  convertToInt x f2 = \x - convertToInt x Absent useful things like error messages, I'll assume that you tripped over the monomorphism restriction. That is, when you have a name that doesn't take

Re: [Haskell-cafe] Strange Type Error

2011-05-26 Thread Brandon Allbery
On Thu, May 26, 2011 at 06:10, Christopher Done chrisd...@googlemail.com wrote: This kicks everyone in the butt at least once. It would be good if GHC could point it out, as mine (6.12.3) just complains about no instance. Maybe GHC7 does point it out. It's a waste of people's time otherwise. I

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Jacek Generowicz
On 2011 May 26, at 11:59, Brandon Allbery wrote: On Thu, May 26, 2011 at 05:41, Jacek Generowicz jacek.generow...@cern.ch wrote: On 2011 May 26, at 11:12, Brandon Allbery wrote: (Think gensym. Hm, except last time I did anything serious with Lisp, it was Maclisp... does gensym even still

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Jacek Generowicz
On 2011 May 26, at 11:59, Jacek Generowicz wrote: (I imagine that a Sufficiently Smart Compiler could reduce (==) :: Person Person to just integer comparison.) Sorry, I meant (==) :: Person - Person - Bool in the above. ___ Haskell-Cafe

[Haskell-cafe] Parallel compilation and execution?

2011-05-26 Thread michael rice
How do I compile and run this parallel program? Michael === import Control.Parallel nfib :: Int - Intnfib n | n = 1 = 1       | otherwise = par n1 (seq n2 (n1 + n2 + 1))                     where n1 = nfib (n-1)                           n2 = nfib (n-2) {-nfib :: Int -

Re: [Haskell-cafe] Parallel compilation and execution?

2011-05-26 Thread Daniel Fischer
On Thursday 26 May 2011 13:24:09, michael rice wrote: How do I compile and run this parallel program? Michael === import Control.Parallel nfib :: Int - Int nfib n | n = 1 = 1 | otherwise = par n1 (seq n2 (n1 + n2 + 1)) The 'seq' here should be a 'pseq'

Re: [Haskell-cafe] Function application layout

2011-05-26 Thread Neil Brown
On 25/05/11 10:00, Jonas Almström Duregård wrote: As an equivalent to: f (x a) (y b) (z c) Of course my intention is that the new keyword should initiate layout syntax so we can write this: f applied to x a y b z c Here's a (tongue-in-cheek) trick that allows for layout close to

Re: [Haskell-cafe] Parallel compilation and execution?

2011-05-26 Thread michael rice
Thank, Daniel Multiple threads are in evidence in my system monitor, but I wonder why I'm getting two different answers, one twice the other. The first is the parallel solution and the second is the non. Michael === {-import Control.Parallel nfib :: Int - Intnfib n | n = 1 = 1       |

Re: [Haskell-cafe] Function application layout

2011-05-26 Thread Daniel Fischer
On Thursday 26 May 2011 14:35:41, Neil Brown wrote: foo is the function we want to apply, and eg shows how to apply it in do-notation with an argument on each line. I couldn't manage to remove the r$ at the beginning of each line, which rather ruins the whole scheme :-( On the plus side,

Re: [Haskell-cafe] Parallel compilation and execution?

2011-05-26 Thread David Virebayre
2011/5/26 michael rice nowg...@yahoo.com Thank, Daniel Multiple threads are in evidence in my system monitor, but I wonder why I'm getting two different answers, one twice the other. The first is the parallel solution and the second is the non. Why do you add n1+n2+1 in the parallel

Re: [Haskell-cafe] Parallel compilation and execution?

2011-05-26 Thread Brandon Moore
From: michael rice, Thursday, May 26, 2011 Subject: Re: [Haskell-cafe] Parallel compilation and execution? Thank, Daniel Multiple threads are in evidence in my system monitor, but I wonder why I'm getting two different answers, one twice the other. The first is the parallel solution and the

Re: [Haskell-cafe] Parallel compilation and execution?

2011-05-26 Thread michael rice
Fair question. I copied the parallel version from: http://www.haskell.org/ghc/docs/6.6/html/users_guide/lang-parallel.html but pulled the non-parallel version from a text. Michael --- On Thu, 5/26/11, David Virebayre dav.vire+hask...@gmail.com wrote: From: David Virebayre

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Gregory Collins
Based on the description it looks like you could be looking for: http://hackage.haskell.org/package/simple-atom G On Thu, May 26, 2011 at 10:45 AM, Jacek Generowicz jacek.generow...@cern.ch wrote: [ TLDR: How do you do Lisp symbols in Haskell? ] What is the Haskell approach to efficient

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Simon Meier
2011/5/26 Jacek Generowicz jacek.generow...@cern.ch: On 2011 May 26, at 11:16, Christopher Done wrote: On 26 May 2011 10:45, Jacek Generowicz jacek.generow...@cern.ch wrote: What is the Haskell approach to efficient comparison and lookup of objects by their identity? Often you just

Re: [Haskell-cafe] Function application layout

2011-05-26 Thread Jonas Almström Duregård
That's a useful operator! Unfortunately it does not play nice with $. Of less importance: some syntactic constructs can not appear in the arguments without parenthesis, let bindings for instance (although lambda abstraction works parenthesis-free). Also I'm not sure this can be used for defining

Re: [Haskell-cafe] Function application layout

2011-05-26 Thread Daniel Fischer
On Thursday 26 May 2011 17:22:10, Jonas Almström Duregård wrote: Unfortunately it does not play nice with $. Yes. Also I'm not sure this can be used for defining trees or nested function application since a nesting of the operator inevitably require parenthesis. It can't be nested, like ($)

[Haskell-cafe] Enterprise Haskell -- help

2011-05-26 Thread Srinivasan Balram
folks: I was advised to post this request here. This is about needs of daily-grind enterprise development. Enterprise developers need 3 categories of books in Haskell urgently: (i) Haskell (CookBooks / Recipes) (ii) Haskell Enterprise Development i.e. how to connect commercial RDBMS and use

Re: [Haskell-cafe] Enterprise Haskell -- help

2011-05-26 Thread Jason Dagit
On Thu, May 26, 2011 at 9:45 AM, Srinivasan Balram srinivasan_bal...@marlabs.com wrote: folks: I was advised to post this request here. This is about needs of daily-grind enterprise development. Enterprise developers need 3 categories of books in Haskell urgently:  (i) Haskell (CookBooks /

Re: [Haskell-cafe] Enterprise Haskell -- help

2011-05-26 Thread Clint Moore
While it's not a solution (yet) for a book, would a section or special section in the wiki be appropriate at least in the beginning? Our small company has been collecting cookbook-like recipies and best practices for a while now but definitely not anything close to as polished or collated as a

Re: [Haskell-cafe] Enterprise Haskell -- help

2011-05-26 Thread Jason Dagit
On Thu, May 26, 2011 at 11:17 AM, Clint Moore cl...@ivy.io wrote:  While it's not a solution (yet) for a book, would a section or special section in the wiki be appropriate at least in the beginning?  Our small company has been collecting cookbook-like recipies and best practices for a while

Re: [Haskell-cafe] Enterprise Haskell -- help

2011-05-26 Thread Clint Moore
On Thu, May 26, 2011 at 10:57:42AM -0700, Jason Dagit wrote: Database connectivity is a weakspot still. Haskell developers don't seem to use databases nearly as often as Java developers. We have several libraries for this, takusen and hdbc come to mind. Real-World Haskell documents using

Re: [Haskell-cafe] Enterprise Haskell -- help

2011-05-26 Thread Michael Snoyman
On Thu, May 26, 2011 at 7:45 PM, Srinivasan Balram srinivasan_bal...@marlabs.com wrote: folks: I was advised to post this request here. This is about needs of daily-grind enterprise development. Enterprise developers need 3 categories of books in Haskell urgently:  (i) Haskell (CookBooks /

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Andrew Coppin
On 26/05/2011 10:59 AM, Jacek Generowicz wrote: Any comments on the relative efficiency of the above as compared to A == B in the context of data Foo = A | B | C | D | ... lots more ... ? (I imagine that a Sufficiently Smart Compiler could reduce (==) :: Person Person to just integer

Re: [Haskell-cafe] Function application layout

2011-05-26 Thread Casey McCann
2011/5/26 Daniel Fischer daniel.is.fisc...@googlemail.com As far as I'm concerned, a left-associative version of ($) would sometimes be nice (on the other hand, right-associativity of ($) is sometimes also nice), but usually, I don't find parentheses too obnoxious. I have a whole set of

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Brandon Allbery
On Thu, May 26, 2011 at 14:56, Andrew Coppin andrewcop...@btinternet.com wrote: My understanding is that if you have a constructor with no fields, it gets allocated as a compile-time constant. In other words, C is just a pointer to a static data structure somewhere in the program binary, and

Re: [Haskell-cafe] Efficient object identity (aka symbols as data)

2011-05-26 Thread Andrew Coppin
On 26/05/2011 07:56 PM, Andrew Coppin wrote: On 26/05/2011 10:59 AM, Jacek Generowicz wrote: Any comments on the relative efficiency of the above as compared to A == B in the context of data Foo = A | B | C | D | ... lots more ... ? (I imagine that a Sufficiently Smart Compiler could

Re: [Haskell-cafe] Enterprise Haskell -- help

2011-05-26 Thread Stephen Tetley
Without support for at least extensible records and better GUI integration, you'd have a hard time convincing me to use Haskell for enterprise applications (and I use Haskell every day). It's not that Haskell isn't a fine language, it's just that doesn't have sufficient advantage on the

Re: [Haskell-cafe] Enterprise Haskell -- help

2011-05-26 Thread Jason Dagit
On Thu, May 26, 2011 at 1:09 PM, Gaius Hammond ga...@gaius.org.uk wrote: On 26 May 2011, at 19:22, Clint Moore wrote: On Thu, May 26, 2011 at 10:57:42AM -0700, Jason Dagit wrote: Database connectivity is a weakspot still.  Haskell developers don't seem to use databases nearly as often as

Re: [Haskell-cafe] Enterprise Haskell -- help

2011-05-26 Thread Gaius Hammond
On 26 May 2011, at 21:34, Jason Dagit wrote: On Thu, May 26, 2011 at 1:09 PM, Gaius Hammond ga...@gaius.org.uk wrote: Over in OCaml-land, I have taken it upon myself to address this: http://gaiustech.github.com/ociml/ Takusen already supports Oracle (and other rdbms) in a resource

Re: [Haskell-cafe] Policy for taking over a package on Hackage

2011-05-26 Thread Jason Dagit
On Wed, May 25, 2011 at 4:02 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 26 May 2011 08:49, wren ng thornton w...@freegeek.org wrote: On 5/25/11 1:03 PM, Bryan O'Sullivan wrote: On Wed, May 25, 2011 at 5:59 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com  wrote: Well,

Re: [Haskell-cafe] Enterprise Haskell -- help

2011-05-26 Thread Jason Dagit
On Thu, May 26, 2011 at 1:43 PM, Gaius Hammond ga...@gaius.org.uk wrote: On 26 May 2011, at 21:34, Jason Dagit wrote: On Thu, May 26, 2011 at 1:09 PM, Gaius Hammond ga...@gaius.org.uk wrote: Over in OCaml-land, I have taken it upon myself to address this: http://gaiustech.github.com/ociml/

[Haskell-cafe] (no subject)

2011-05-26 Thread Gregory Propf
As you my friend I invite you to visit my own site first!. http://prospero.ch/friends_links.php?uGIS=45ru4 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Parallel compilation and execution?

2011-05-26 Thread michael rice
Are the tools of Control.Parallel comparable to OpenMP? Michael --- On Thu, 5/26/11, michael rice nowg...@yahoo.com wrote: From: michael rice nowg...@yahoo.com Subject: Re: [Haskell-cafe] Parallel compilation and execution? To: David Virebayre dav.vire+hask...@gmail.com Cc: Daniel Fischer

[Haskell-cafe] Email spam from my account on May 26, 2011

2011-05-26 Thread Gregory Propf
I just discovered that some evil spammer has somehow gotten my contacts list and used it to send out a bunch of spam. This is just to notify you that if you get an email from me on May 26, 2011 (other than this one or one like it - the problem was more extensive than I first thought) it

[Haskell-cafe] Escaping of string literals

2011-05-26 Thread Michael Snoyman
Hi all, I'm working on a program right now that will involve embedding some static files inside my Haskell program as bytestrings. I've done this in the past with file-embed[1]. In this case, I have a strange requirement: I need to be able to modify the embedded data after the compiler has run.