ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

Max Rabkin wrote:
On Sat, Jul 4, 2009 at 8:38 PM, Andrew Coppin<andrewcoppin at btinternet.com> wrote:
A few reasons:
1. I never knew it existed. ;-)
A good reason. However, it's good to do a quick search over Hackage before uploading (or before writing) so you know what's out there.
Also, if you hadn't used an "AC-" prefix, you'd have had a name collision. Is there a particular reason why you want your name in the package name rather than just the author field?
I find it amazing that you independently chose to spell colour with a `u'. It makes me feel better about my choice.
2. It's mind-blowingly complex.
Colour *is* complex. Which is why I'm so glad Russell O'Connor did all the hard work for me :)
Well, no, because now I'm going to have to spend a few hours trying to find out what CIE is before I can even use that library.
I think really it's just aimed at a different problem. It looks like it's trying to specify actual real-world colours. [It's news to me that this isn't fundamentally impossible...] I'm only trying to specify colours on a computer screen. And as we all know, computer screens aren't calibrated in any way, and the same RGB value looks different on each display. But then, I'm only trying to write a fractal generator, so CIE specifications are somewhat overkill here. ;-)
You can use by lib without worrying about the CIE. You can use my library without ever importing or using the word CIE. However, the CIE stuff is there for those who need it. Perhaps I (maybe with some help) need to make a tutorial on the haskell wiki to try to make it less intimidating.
3. It doesn't appear to provide arithmetic over colours.
It provides darken, blend and addition (though addition is called mappend rather than (+)). signum, abs and fromInteger don't make a huge amount of sense for colours.
Yeah, I implemented signum and so forth for colours and vectors, but they're not particularly meaningful... [Insert remark here about Haskell's numeric class hierachy.]
So mappend gives you colour addition [with the perplexing comments about "gamut", presumably some kind of small mammal?], but there's no subtraction? No multiplication? No linear blending?
Linear blending is done by the affineCombo function. I think the darken function will do what you mean by multiplication Colour subtraction can be done by adding (using mappend) a colour that has been darkend by a factor of (-1). I don't believe there is any demand for a colour subtraction fuction, so I don't have a name for it. I suppose these sorts of questions can be put nicely into a short tutorial on the wiki.
4. It's parameterised over the component type; my library is hard-coded to specific types for speed.
My feeling would be to trust the specializer until it lets me down. Has it let you down in the past?
Heh, my colour library includes a custom floor implementation that talks to the GHC primops directly because calling floor is too slow...
[In case that sounds like idle talk, I had a program go from 10 seconds to less than 1 second just by using this function. There's a few tickets about it on the GHC Trac.]
Certainly speed is an issue that I haven't tackled yet since I don't know too much about how to optimized Haskell code. I was thinking of sprinkling in some SPECIALIZE pragmas and maybe adding some RULES to make operations more effecient. For example we could have a rule to rewrite floor to some sort of GHC specific fast floor function. (Although that rule probably deserves to be in some sort of more general location). Any help in this direction would be appricated (perferably while keeping things as portable as possible). This all being said, the major problem my code solves is doing blending in a linear colour space. This necessarily make converting to non-linear sRGB for output much slower. So for people who want speed over proper blending, then probably AC-Colour is the package they need to reach for. Essentially the two packages do fill different niches!
BTW, the EasyRaster package looks useful.
I haven't looked at EasyRaster yet, but I got excited when I saw it announced. :) -- Russell O'Connor http://r6.ca/ ``All talk about `theft,''' the general counsel of the American Graphophone Company wrote, ``is the merest claptrap, for there exists no property in ideas musical, literary or artistic, except as defined by statute.''

On Thu, 9 Jul 2009, roconnor@theorem.ca wrote:
You can use by lib without worrying about the CIE. You can use my library without ever importing or using the word CIE. However, the CIE stuff is there for those who need it.
Perhaps I (maybe with some help) need to make a tutorial on the haskell wiki to try to make it less intimidating.
Okay, I threw together a quick introduction at http://www.haskell.org/haskellwiki/Colour. Any changes, comments, corrections, and addtions are welcome. It's a wiki! The word CIE does occur at all in the document. -- Russell O'Connor http://r6.ca/ ``All talk about `theft,''' the general counsel of the American Graphophone Company wrote, ``is the merest claptrap, for there exists no property in ideas musical, literary or artistic, except as defined by statute.''

On Fri, Jul 10, 2009 at 6:42 AM,
On Thu, 9 Jul 2009, roconnor@theorem.ca wrote:
You can use by lib without worrying about the CIE. You can use my library without ever importing or using the word CIE. However, the CIE stuff is there for those who need it.
Perhaps I (maybe with some help) need to make a tutorial on the haskell wiki to try to make it less intimidating.
Okay, I threw together a quick introduction at http://www.haskell.org/haskellwiki/Colour. Any changes, comments, corrections, and addtions are welcome. It's a wiki!
Excellent! I admit to being Quite Baffled by the new terminology when I tried using this library a few months ago. Spent a lot of time on WP trying to find out what everything was! Even something as simple as stating "yes, just use Colour Double" makes the library seem a lot easier to plumb in to other things. A couple of notes: Section 4.2: "Out of gamut channels be clamped to either to the range 0 to 255" <-- some kind of mix-up here Section 5: "Note that\n\nOne should avoid dissolving" has a spurious line break, or an unfinished sentence. Cheers, D -- Dougal Stanton dougal@dougalstanton.net // http://www.dougalstanton.net

On Fri, Jul 10, 2009 at 12:42 AM,
On Thu, 9 Jul 2009, roconnor@theorem.ca wrote:
You can use by lib without worrying about the CIE. You can use my library without ever importing or using the word CIE. However, the CIE stuff is there for those who need it.
Perhaps I (maybe with some help) need to make a tutorial on the haskell wiki to try to make it less intimidating.
Okay, I threw together a quick introduction at http://www.haskell.org/haskellwiki/Colour. Any changes, comments, corrections, and addtions are welcome. It's a wiki!
The word CIE does occur at all in the document.
I read this and it irks me that opaque is not a monoid homomorphism despite being the natural injection of non-transparent colours into semi-transparent colours with pureColour being the projection back. [Incidentally, you have a typo in pureColour, ac `over` mempty should be ac `over` black or opaque black presumably, or even opaque mempty, which I think was what you were going for, illustrating my point.] It's like defining mappend on Integers as (+) and on Reals as (*); actually, I think this is very close to what is actually happening.

On Sat, Jul 11, 2009 at 12:54 PM, Derek Elkins
On Fri, Jul 10, 2009 at 12:42 AM,
wrote: On Thu, 9 Jul 2009, roconnor@theorem.ca wrote:
You can use by lib without worrying about the CIE. You can use my library without ever importing or using the word CIE. However, the CIE stuff is there for those who need it.
Perhaps I (maybe with some help) need to make a tutorial on the haskell wiki to try to make it less intimidating.
Okay, I threw together a quick introduction at http://www.haskell.org/haskellwiki/Colour. Any changes, comments, corrections, and addtions are welcome. It's a wiki!
The word CIE does occur at all in the document.
I read this and it irks me that opaque is not a monoid homomorphism despite being the natural injection of non-transparent colours into semi-transparent colours with pureColour being the projection back. [Incidentally, you have a typo in pureColour, ac `over` mempty should be ac `over` black or opaque black presumably, or even opaque mempty, which I think was what you were going for, illustrating my point.] It's like defining mappend on Integers as (+) and on Reals as (*); actually, I think this is very close to what is actually happening.
I'm mistaken about the typo in pureColour, but luckily the mistake just further illustrates my point.

Am Freitag, 10. Juli 2009 05:26 schrieb roconnor@theorem.ca:
I find it amazing that you independently chose to spell colour with a `u'. It makes me feel better about my choice.
I have to admit that it makes me unhappy. :-( Why do we use English for identifiers? Because English is the language of computer science. What English should we use? It’s tempting to say, we should use the original English, which is British English. But we should ask again what is the language of computer science. And the language of computer science is American English. To my knowledge, most early developments in computer science had their roots in the US. One consequence of this is that reserved words of programming languages are typically in American English. PASCAL uses “program”, not “programme”, and BASIC uses “COLOR”, not “COLOUR”. So, in my opinion, Haskell color packages should use the identifier Color, not Colour. By the way, I also write my papers and documentation in American English. Best wishes, Wolfgang (who is neither British nor American)

Am Dienstag, 7. Juli 2009 14:42 schrieb Robin Green:
On Fri, 10 Jul 2009 10:44:51 +0200
Wolfgang Jeltsch
wrote: PASCAL uses “program”, not “programme”,
The word program (as in computer program) is spelled program in both British and American English.
Probably just because British English took it from American English. It’s similar to the “German” word “Computer”. It’s not native. Best wishes, Wolfgang

On Jul 18, 2009, at 2:27 AM, Wolfgang Jeltsch wrote:
Probably just because British English took it from American English. It’s similar to the “German” word “Computer”. It’s not native.
The spelling "program" goes back to 1633 at least; it cannot then have referred to computers, and is not likely to have been an American import.

Wolfgang Jeltsch
Am Freitag, 10. Juli 2009 05:26 schrieb roconnor@theorem.ca:
I find it amazing that you independently chose to spell colour with a `u'. It makes me feel better about my choice.
I have to admit that it makes me unhappy. :-(
Why do we use English for identifiers? Because English is the language of computer science. What English should we use? It’s tempting to say, we should use the original English, which is British English. But we should ask again what is the language of computer science. And the language of computer science is American English.
I don't buy that. And don't forget India.
To my knowledge, most early developments in computer science had their roots in the US.
Really? Manchester Mark I, EDSAC I, EDSAC II? Alan Turing, David Wheeler, Maurice Wilkes? To mention a random selection of early ones (leaving aside Konrad Zuse and colleagues and various Russian pioneers on account of not speaking English).
One consequence of this is that reserved words of programming languages are typically in American English. PASCAL uses “program”,
The use of "program" rather than "programme" in programming was mandated by the IFIP in what I regard as an attempt to act outwith their remit. I've never accepted it.
not “programme”, and BASIC uses “COLOR”, not “COLOUR”.
I'm not sure I would use BASIC as an authority for any aspect of programming language design. Going back to the early developments aspect, a high proportion of early work in functional programming was done in Britain and elsewhere in Europe (at a time when Europeans typically preferred British spellings), so perhaps one should recognise that in choosing identifiers. But anyway, where's the harm in a bit of variety? If someone who prefers British spellings originates a package, why get het up about it if they use them in identifiers? I have to put up with American spellings all over the place, so a few British spellings might even up the balance a bit. -- Jón Fairbairn (British, but with a tendency to identify myself as European)

It’s tempting to say, we should use the original English, which is British English.
Some suggest the original English remained in Britain when the North American colonies were founded; others claim it was brought to the Americas by the British settlers, leaving a pale imitation back in Britain. The truth is much stranger: the original English was actually smuggled out of Britain to the West Indies in a wardrobe belonging to General Sir Ralph Abercromby, where it ended up on the island of Trinidad after Sir Ralph took possession of that territory in the name of the British Crown. It came to be used and modified freely by the various immigrants to Trinidad (and later Tobago) and their descendants (largely African, Indian, British, Portuguese, German, Spanish, and Chinese). Many of these peoples then emigrated, bringing the original English to North America and back to Britain. A copy of it has fallen into my hands, and so I can, without bias, make the following call: both color and colour shall be acceptable in Haskell programming. 'Kerb' and 'gaol' are right out, however. Cheers, Robert (who's grandfather is from London and grandmother from Trinidad; but is nevertheless American)

On Jul 10, 2009, at 8:44 PM, Wolfgang Jeltsch wrote:
Am Freitag, 10. Juli 2009 05:26 schrieb roconnor@theorem.ca:
I find it amazing that you independently chose to spell colour with a `u'. It makes me feel better about my choice.
I have to admit that it makes me unhappy. :-(
Why do we use English for identifiers? Because English is the language of computer science. What English should we use? It’s tempting to say, we should use the original English, which is British English. But we should ask again what is the language of computer science. And the language of computer science is American English.
It was possible to adopt such an attitude in the 20th century. But this is the 21st century. We have globalisation, internationalisation, localisation. We have Unicode, so that people are no longer limited to the set of characters that technicians from the USA found tolerable back in 1967. (Note that "Americans" includes French Canadians and lost of people who mainly speak Spanish.) Let's face it, by this argument we'd have to abandon the metric system when writing computer programs. There are good reasons to adopt American speling for a term or English spelling. They include the language that the author is most familiar with, the language the paying customers are most familiar with, the language of the laws that the program has to conform to, any number of things. But there is a way above this issue. Why can't we have BOTH "Colour" AND "Color"? What changes, if any, would it take for Haskell to support bidialectal naming practices (whether it is English -vs- American, insular/Brazilian Portuguese, Norwegian, Arabic dialects, or whatever)? We can create an alias for a type easily enough. We can create an alias for a defined function easily enough. We cannot create an alias for a constructor; there is no way to say data X = A | B Int constructor C = B so that C can be used for pattern matching just like B. We cannot create an alias for a module name; while we can create a module that re-exports everything from some module, there is no way to make them act the same as far as inheritance of dotted names is concerned. SML has similar limitations, but not quite the same. It lets us create alias for types and defined functions. It also lets us create aliases for modules, its structures and functors (more or less). But even SML doesn't allow the definition of aliases for constructors.
To my knowledge, most early developments in computer science had their roots in the US. One consequence of this is that reserved words of programming languages are typically in American English. PASCAL uses “program”, not “programme”, and BASIC uses “COLOR”, not “COLOUR”. So, in my opinion, Haskell color packages should use the identifier Color, not Colour. By the way, I also write my papers and documentation in American English.
Best wishes, Wolfgang (who is neither British nor American) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Am Mittwoch, 15. Juli 2009 05:27 schrieben Sie:
On Jul 10, 2009, at 8:44 PM, Wolfgang Jeltsch wrote:
Why do we use English for identifiers? Because English is the language of computer science. What English should we use? It’s tempting to say, we should use the original English, which is British English. But we should ask again what is the language of computer science. And the language of computer science is American English.
It was possible to adopt such an attitude in the 20th century. But this is the 21st century. We have globalisation, internationalisation, localisation. We have Unicode, so that people are no longer limited to the set of characters that technicians from the USA found tolerable back in 1967.
So I should upload a package with German identifiers to Hackage? Best wishes, Wolfgang

Wolfgang Jeltsch schrieb:
Am Mittwoch, 15. Juli 2009 05:27 schrieben Sie:
Why do we use English for identifiers? Because English is the language of computer science. What English should we use? It’s tempting to say, we should use the original English, which is British English. But we should ask again what is the language of computer science. And the language of computer science is American English. It was possible to adopt such an attitude in the 20th century. But this is
On Jul 10, 2009, at 8:44 PM, Wolfgang Jeltsch wrote: the 21st century. We have globalisation, internationalisation, localisation. We have Unicode, so that people are no longer limited to the set of characters that technicians from the USA found tolerable back in 1967.
So I should upload a package with German identifiers to Hackage?
I most like identifiers like "getZahl". :-)

On Jul 18, 2009, at 2:35 AM, Wolfgang Jeltsch wrote:
So I should upload a package with German identifiers to Hackage?
Sure, why not? The fact that I can't read it is my loss, not your fault, and there will be plenty of other German- reading Haskellers to benefit from it. I've happily worked with programs in French (not large ones (:-)). Mind you, I was specifically speaking of alternative *dialects* (English, Scots, American, Strine), not alternative *languages*. The library at this University contains books in a wide range of languages and is all the better for it; it would be as churlish as it would be foolish to say "English books only!"

Am Samstag, 18. Juli 2009 06:31 schrieben Sie:
On Jul 18, 2009, at 2:35 AM, Wolfgang Jeltsch wrote:
So I should upload a package with German identifiers to Hackage?
Sure, why not? The fact that I can't read it is my loss, not your fault, and there will be plenty of other German-reading Haskellers to benefit from it. I've happily worked with programs in French (not large ones (:-)).
I don’t think, it’s a good idea to have German identifiers, since Haskell’s keywords are English. On the other hand, I strongly argue that a library about Bézier curves uses the identifier Bézier, not Bezier. So non-ASCII identifiers are useful even if identifiers are in English. Best wishes, Wolfgang

On 18 Jul 2009, at 13:26, Wolfgang Jeltsch wrote:
Am Samstag, 18. Juli 2009 06:31 schrieben Sie:
On Jul 18, 2009, at 2:35 AM, Wolfgang Jeltsch wrote:
So I should upload a package with German identifiers to Hackage?
Sure, why not? The fact that I can't read it is my loss, not your fault, and there will be plenty of other German-reading Haskellers to benefit from it. I've happily worked with programs in French (not large ones (:-)).
I don’t think, it’s a good idea to have German identifiers, since Haskell’s keywords are English. On the other hand, I strongly argue that a library about Bézier curves uses the identifier Bézier, not Bezier. So non- ASCII identifiers are useful even if identifiers are in English.\
And I think that a library about Dynkin diagrams should use the identifier "Dynkin", not "Дынкин".

On Jul 18, 2009, at 9:26 PM, Wolfgang Jeltsch wrote:
I don’t think, it’s a good idea to have German identifiers, since Haskell’s keywords are English.
Put it this way: if Haskell's keywords were in German, do you suppose I would write my Haskell code in anything but English? Does the fact that 'data' is a Latin word mean that some fraction of our Haskell identifiers should be in Latin? Some say ita, some say minime.
On the other hand, I strongly argue that a library about Bézier curves uses the identifier Bézier, not Bezier. So non- ASCII identifiers are useful even if identifiers are in English.
Indeed, you need non-ASCII letters to write English well.

Am Sonntag, 19. Juli 2009 23:42 schrieben Sie:
On Jul 18, 2009, at 9:26 PM, Wolfgang Jeltsch wrote:
I don’t think, it’s a good idea to have German identifiers, since Haskell’s keywords are English.
Put it this way: if Haskell's keywords were in German, do you suppose I would write my Haskell code in anything but English?
At least, many people all over the world write their code in something other than their native language. :-)
Does the fact that 'data' is a Latin word mean that some fraction of our Haskell identifiers should be in Latin?
data is also an English word nowadays. Best wishes, Wolfgang
participants (10)
-
Derek Elkins
-
Dougal Stanton
-
Henning Thielemann
-
Jon Fairbairn
-
Miguel Mitrofanov
-
Richard O'Keefe
-
Robert Greayer
-
Robin Green
-
roconnor@theorem.ca
-
Wolfgang Jeltsch