[Haskell-cafe] A voyage of undiscovery

2009-07-17 Thread Bernie Pope
2009/7/17 Andrew Coppin andrewcop...@btinternet.com: I've been working hard this week, and I'm stumbled upon something which is probably of absolutely no surprise to anybody but me. Consider the following expression:  (foo True, foo 'x') Is this expression well-typed? Astonishingly, the

[Haskell-cafe] Parallellizing array-based function

2009-07-17 Thread Jon Harrop
Is it possible to parallelize array-based functions such as in-place quicksort in Haskell? If so, does anyone have a working implementation? -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e ___ Haskell-Cafe mailing list

[Haskell-cafe] PEPM'10 - Call for Papers (Deadline: 6 Oct 09) - Invited Speakers announced

2009-07-17 Thread Janis Voigtlaender
=== CALL FOR PAPERS ACM SIGPLAN 2010 Workshop on Partial Evaluation and Program Manipulation (PEPM'10) Madrid, January 18-19, 2010 (Affiliated with POPL'10)

Re: [Haskell-cafe] Parsec for C or C++

2009-07-17 Thread Alp Mestan
There is a C++ parser in C++, it may be of help : http://42ndart.org/scalpel/ It's a quite advanced WIP. On Fri, Jul 17, 2009 at 3:58 AM, Sterling Clover s.clo...@gmail.com wrote: A parser for JavaScript (admittedly a much simpler beast) is part of Brown's WebBits:

[Haskell-cafe] powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-17 Thread Thomas Hartman
on haskell reddit today powerSet = filterM (const [True, False]) is said to be beautiful / mind blowing. I just don't get it. I can play with transformations until I get powerSet [] = [[]] powerSet (x:xs) = let pxs = powerSet xs in map (x:) pxs ++ pxs which is understandable to me,

Re: [Haskell-cafe] powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-17 Thread Luke Palmer
On Fri, Jul 17, 2009 at 1:35 AM, Thomas Hartman tphya...@gmail.com wrote: on haskell reddit today powerSet = filterM (const [True, False]) The M is the list, i.e. *nondeterminism* monad. For each element in the list, there is one return value where it appears (True), and one where it does

Re: [Haskell-cafe] powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-17 Thread George Pollard
For each item, we ignore what the item actually is (hence `const`), and say that we both want it (True) and don't want it (False) in the output. Since we are using the list monad we are allowed to say this, and the filter function gives us a list of lists. I think there's probably a more intuitive

[Haskell-cafe] Re: powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-17 Thread Gleb Alexeyev
Thomas Hartman wrote: on haskell reddit today powerSet = filterM (const [True, False]) Does it help if we inline the 'const' function and rewrite [True, False] in monadic notation as (return True `mplus` return False)? powerSet = filterM (\x - return True `mplus` return False). You can

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Cristiano Paris
Thank you all for your answers and sorry for the delay I'm writing this message but before replying, I wanted to be sure to understand your arguments! Now, I'm starting to get into this tying the knot thing and understand why the Haskell version of fib ties the knot while my Python version does

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Thomas Davie
On 17 Jul 2009, at 12:41, Cristiano Paris wrote: Thank you all for your answers and sorry for the delay I'm writing this message but before replying, I wanted to be sure to understand your arguments! Now, I'm starting to get into this tying the knot thing and understand why the Haskell

[Haskell-cafe] Re: powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-17 Thread Gleb Alexeyev
On Jul 17, 2009 1:40pm, Thomas Hartman wrote: my question to all 3 (so far) respondants is, how does your explanation explain that the result is the power set? I guess you forgot to reply to the cafe. Well, to me the modified definition I posted looks like the essence of powerset, the set

Re: [Haskell-cafe] laziness blowup exercise

2009-07-17 Thread Bas van Dijk
On Thu, Jul 16, 2009 at 9:57 PM, Ryan Ingramryani.s...@gmail.com wrote: On Thu, Jul 16, 2009 at 8:22 PM, Thomas Hartmantphya...@gmail.com wrote: Is this being worked on? On Thu, Jul 16, 2009 at 12:35 PM, Bas van Dijkv.dijk@gmail.com wrote: I have no idea. Yes. Bolingbroke,

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-17 Thread Jules Bean
Job Vranish wrote: I was needing a way to zip generic data structures together today and was very annoyed to find that there is no Zippable class, or variant there of. Notice that you can always do this if the LHS is traversable and the RHS is Foldable (as a special case the RHS is the

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Cristiano Paris
On Fri, Jul 17, 2009 at 12:46 PM, Thomas Davietom.da...@gmail.com wrote: Memoization is not a feature of lazyness.  If you can do it in such a way that you don't waste significant amount of RAM, then it may be a nice optimisation, and an alternative evaluation strategy, but it would not be

Re: [Haskell-cafe] Re: powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-17 Thread porges
2009/7/17 Gleb Alexeyev gleb.alex...@gmail.com: On Jul 17, 2009 1:40pm, Thomas Hartman wrote: my question to all 3 (so far) respondants is, how does your explanation explain that the result is the power set? Because powerset(s) = 2^s? I was going to make some nice code but I ended up with

[Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Cristiano Paris
On Fri, Jul 17, 2009 at 12:41 PM, Cristiano Parisfr...@theshire.org wrote: ... Now, to confirm my hypothesis, I wrote a slight different version of fib, like follows: fib' n = 1:1:(fib' n) `plus` (tail $ fib' n) where plus = zipWith (+) i.e. I inserted a fictious argument n in the

Re: [Haskell-cafe] powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-17 Thread Yitzchak Gale
Thomas Hartman wrote: on haskell reddit today powerSet = filterM (const [True, False]) is said to be beautiful / mind blowing. Is this a uniquely haskell obfu, or is there a way of reading this definition that makes sense? To me, these are more obvious: powerSet = map catMaybes . mapM

[Haskell-cafe] Line drawing algorithm

2009-07-17 Thread CK Kashyap
Hi All, I am working on a diagraming utility in Haskell. I started with line drawing. I am doing the basic stuff using the y = mx + c formula to draw a line between (x1,y1) and (x2,y2) Here's what I need to do - if dx dy where dx = (x2 - x1) and dy = (y2 - y1) then I need to vary x between

Re: [Haskell-cafe] Line drawing algorithm

2009-07-17 Thread Neil Brown
CK Kashyap wrote: Hi All, I am working on a diagraming utility in Haskell. I started with line drawing. I am doing the basic stuff using the y = mx + c formula to draw a line between (x1,y1) and (x2,y2) Hi, Are you doing this to learn Haskell, learn about drawing lines, or to just get it

Re: [Haskell-cafe] Line drawing algorithm

2009-07-17 Thread CK Kashyap
Thanks Neil ... Are you doing this to learn Haskell, learn about drawing lines, or to just get it implemented? If either of the latter two, when drawing a straight line you shouldn't need to do floating point operations such as this: Actually, my reasons are first and third. newY =

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Matthias Görgens
BTW, after a -O2 compilation, fib' is apparently as fast a fib. The compiler is your friend. :o) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Alternative IO

2009-07-17 Thread Wolfgang Jeltsch
Am Freitag, 10. Juli 2009 23:41 schrieben Sie: On Jul 10, 2009, at 4:35 AM, Wolfgang Jeltsch wrote: I fear that this instance doesn’t satisfy required laws. As far as I know, the following equalities should hold: (*) = () f * empty = empty empty | g = g This

Re: [Haskell-cafe] Alternative IO

2009-07-17 Thread Wolfgang Jeltsch
Am Samstag, 11. Juli 2009 00:16 schrieben Sie: On Friday 10 July 2009 4:35:15 am Wolfgang Jeltsch wrote: I fear that this instance doesn’t satisfy required laws. As far as I know, the following equalities should hold: (*) = () f * empty = empty IO already fails at this law,

Re: [Haskell-cafe] ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

2009-07-17 Thread Wolfgang Jeltsch
Am Dienstag, 7. Juli 2009 14:42 schrieb Robin Green: On Fri, 10 Jul 2009 10:44:51 +0200 Wolfgang Jeltsch g9ks1...@acme.softbase.org wrote: PASCAL uses “program”, not “programme”, The word program (as in computer program) is spelled program in both British and American English. Probably

Re: [Haskell-cafe] ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

2009-07-17 Thread Wolfgang Jeltsch
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

Re: [Haskell-cafe] What's the status with unicode characters on haddock ?

2009-07-17 Thread Wolfgang Jeltsch
Am Freitag, 10. Juli 2009 09:54 schrieb david48: Hello all, I made a small program for my factory and I wanted to try to document it using haddock. The thing is, the comments are in French and the resulting html pages are unreadable because the accentuated letters are mangled. It's not

Re: [Haskell-cafe] What's the status with unicode characters on haddock ?

2009-07-17 Thread david48
On Fri, Jul 17, 2009 at 4:37 PM, Wolfgang Jeltschg9ks1...@acme.softbase.org wrote: To my knowledge, Haddock only supports ASCII as input encoding. If you want to have characters outside ASCII, you have to escape them using something like #xA0;. Which would mean, while editing the code I'd have

Re: [Haskell-cafe] Alternative IO

2009-07-17 Thread David Menendez
On Fri, Jul 17, 2009 at 10:21 AM, Wolfgang Jeltschg9ks1...@acme.softbase.org wrote: Am Freitag, 10. Juli 2009 23:41 schrieben Sie: Additionally, the second equality you provide is just wrong. f * empty = empty is no more true than f * g = g, I don’t understand this. The equation f * g = g

[Haskell-cafe] Jane Street

2009-07-17 Thread Matthias Görgens
If one of you knows something about working at Jane Street, I'd be happy to have exchange some mails. I am considering applying there. Thanks! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: cabal: : openFile: does not exist (No such file or directory)

2009-07-17 Thread Thomas Hartman
cabal -v3 update will give you a more verbose version of what is going wrong. cabal --help regrettably, cabal --help doesn't tell you this but there is always the man page I suppose. 2009/7/16 Tony Hannan tonyhann...@gmail.com: Hello, I'm on Ubuntu 8.10. I installed ghc 6.10.4 (from binary

Re: [Haskell-cafe] laziness blowup exercise

2009-07-17 Thread Matthias Görgens
Thomas, if you did no know, where to look for `lazy-memory-hole', say in your first example, how would you go about solving that puzzle systematically with a Profiler (or other tools)? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] What's the status with unicode characters on haddock ?

2009-07-17 Thread Wolfgang Jeltsch
Am Freitag, 17. Juli 2009 16:43 schrieben Sie: On Fri, Jul 17, 2009 at 4:37 PM, Wolfgang Jeltschg9ks1...@acme.softbase.org wrote: To my knowledge, Haddock only supports ASCII as input encoding. If you want to have characters outside ASCII, you have to escape them using something like

Re: [Haskell-cafe] laziness blowup exercise

2009-07-17 Thread Thomas Hartman
I don't have a good answer to that, and I unable to reliably solve this type of problem, which is one reason I am posting around on haskell cafe hoping to accumulate wisdom. Here for instance I think I did t = last . take (10^6) $ repeat $ S.empty which doesn't blow up, and by process of

Re: [Haskell-cafe] What's the status with unicode characters on haddock ?

2009-07-17 Thread david48
On Fri, Jul 17, 2009 at 4:05 PM, Wolfgang Jeltschg9ks1...@acme.softbase.org wrote: Yes, it’s a pity. For me, it’s not such a big problem since I don’t write my Haddock comments in my native language (German) but in English. I only experience this problem because I use nice typography, i.e., “ ”

Re: [Haskell-cafe] What's the status with unicode characters on haddock ?

2009-07-17 Thread david48
On Fri, Jul 17, 2009 at 4:15 PM, david48dav.vire+hask...@gmail.com wrote: On Fri, Jul 17, 2009 at 4:05 PM, Wolfgang GHC supports UTF-8 input, and Haddock uses GHC nowadays. So, in my opinion, Haddock should also support UTF-8 input. Do you want to file a feature request? Sure. I'm

[Haskell-cafe] Plot data reconstruction reading pixel colors from image files

2009-07-17 Thread Cetin Sert
Hi, How can I open and read colors of specific pixels of an image file in Haskell? Which packages, functions do you recommend? You can have a look at the quoted conversation for an idea on what I would like to automate. Best Regards, Cetin Sert Hi dear *^o^*, Here are the points from

Re: [Haskell-cafe] laziness blowup exercise

2009-07-17 Thread Matthias Görgens
I tried using your original code and stuffing it into a profiler. But all I get is a triangle of linearly increasing resource usage, and then it breaks for lack of stack. I guess I am just to ignorant about retainer profiling and such stuff. ___

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-17 Thread Andrew Coppin
Derek Elkins wrote: The answer to your questions are on the back of this T-shirt. http://www.cafepress.com/skicalc.6225368 Oh... dear God. o_O ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-17 Thread Andrew Coppin
John Meacham wrote: actually, the rules are pretty straightforward. It doesn't matter where something is bound, just _how_ it is bound. Let-bound names (which includes 'where' and top-level definitions) can be polymorphic. lambda-bound or case-bound names (names bound as an argument to a

Re: [Haskell-cafe] Plot data reconstruction reading pixel colors from image files

2009-07-17 Thread Matthias Görgens
If you don't find anything more specific, I suggest taking a look at Data.Binary and reading a simple format like BMP or so. (You can convert your file to BMP with an external program before.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Plot data reconstruction reading pixel colors from image files

2009-07-17 Thread Felipe Lessa
On Fri, Jul 17, 2009 at 06:31:20PM +0200, Cetin Sert wrote: How can I open and read colors of specific pixels of an image file in Haskell? Which packages, functions do you recommend? You could try DevIL, SDL-image or Gtk, I guess. -- Felipe. ___

[Haskell-cafe] Oops in Haskell

2009-07-17 Thread CK Kashyap
Hi, Can someone please send me a working example based on the contents posted in the URL below? http://yi-editor.blogspot.com/2008/12/prototypes-encoding-oo-style.html Thanks, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Oops in Haskell

2009-07-17 Thread Stefan Holdermans
Kashyap, Can someone please send me a working example based on the contents posted in the URL below? There's a small typo in the post: the definition of Proto should read data Proto = Proto {a :: A, b :: B, c :: C} The rest seems fine to me. (See below for an excerpt). Cheers, Stefan

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-17 Thread Stefan Holdermans
Andrew, That seems simple enough (although problematic to implement). However, the Report seems to say that it matters whether or not the bindings are muturally recursive [but I'm not sure precisely *how* it matters...] It means that functions can only be used monomorphically within

[Haskell-cafe] Pattern matching with where free variables can be used more than once

2009-07-17 Thread Christopher Done
Wouldn't it be great if pattern variables could be used more than once in a pattern? Like so: foo [x,x,_,x] = The values are the same! foo _ = They're not the same! where this could be rewritten to: foo [x,y,_,z] | x == y x == z = The values are the same! foo _ =

Re: [Haskell-cafe] Pattern matching with where free variables can be used more than once

2009-07-17 Thread Stefan Holdermans
Christopher, Wouldn't it be great if pattern variables could be used more than once in a pattern? Like so: foo [x,x,_,x] = The values are the same! foo _ = They're not the same! These are called nonlinear patterns. I think Miranda (a precursor of Haskell, sort of) used to have

Re: [Haskell-cafe] excercise - a completely lazy sorting algorithm

2009-07-17 Thread Petr Pudlak
Hi all, I apologize that I didn't react to your posts, I was on a vacation. (BTW, if you ever come to Slovakia, I strongly recommend visiting Mala (Lesser) Fatra mountains. IMHO it's more beautiful than more-known Tatra mountains.) Thanks for your interest and many intriguing ideas. Especially,

[Haskell-cafe] What is the point of the 'What the bleep' names in haskell?

2009-07-17 Thread Daryoush Mehrtash
Why do Haskell programmers (and libraries) name their function like @ or ###?Why not use a more descriptive label for functions? Daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] What is the point of the 'What the bleep' names in haskell?

2009-07-17 Thread Brandon S. Allbery KF8NH
On Jul 17, 2009, at 15:06 , Daryoush Mehrtash wrote: Why do Haskell programmers (and libraries) name their function like @ or ###?Why not use a more descriptive label for functions? Because symbols can be used as infix functions directly, whereas alphanumerics have to be wrapped in ``

[Haskell-cafe] an instance in other than the last type parameters

2009-07-17 Thread Petr Pudlak
Hi, I have probably a very simple question, but I wasn't able to figure it out myself. Consider a two-parameter data type: data X a b = X a b If I want to make it a functor in the last type variable (b), I can just define instance Functor (X a) where fmap f (X a b) = X a (f b) But how do

Re: [Haskell-cafe] What is the point of the 'What the bleep' names in haskell?

2009-07-17 Thread Don Stewart
dmehrtash: Why do Haskell programmers (and libraries) name their function like @ or # ##?Why not use a more descriptive label for functions? Where are those functions defined?? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] an instance in other than the last type parameters

2009-07-17 Thread Stefan Holdermans
Petr, If I want to make it a functor in the last type variable (b), I can just define instance Functor (X a) where fmap f (X a b) = X a (f b) But how do I write it if I want X to be a functor in its first type variable? Short answer: you can't. Easiest way to workaround is to define

Re: [Haskell-cafe] What is the point of the 'What the bleep' names in haskell?

2009-07-17 Thread Justin Bailey
System.Console.Curses? Sorry couldn't resist ... On Fri, Jul 17, 2009 at 12:18 PM, Don Stewartd...@galois.com wrote: dmehrtash: Why do Haskell programmers (and libraries) name their function like @ or # ##?    Why not use a more descriptive label for functions? Where are those functions

Re: [Haskell-cafe] an instance in other than the last type parameters

2009-07-17 Thread Stefan Holdermans
Petr, Short answer: you can't. Easiest way to workaround is to define a newtype wrapper around your original datatype: newtype X' b a = X' {unX' :: X a b} instance Functor (X' b) where fmap g (X' (X a b)) = X' (X b (g a)) Err fmap g (X' (X a b)) = X' (X (g a) b) Cheers, Stefan

Re: [Haskell-cafe] an instance in other than the last type parameters

2009-07-17 Thread Geoffrey Marchant
data X a b = X a b instance Functor (X a) where fmap f (X a b) = X a (f b) Yeah, that works just fine. On Fri, Jul 17, 2009 at 1:14 PM, Petr Pudlak d...@pudlak.name wrote: Hi, I have probably a very simple question, but I wasn't able to figure it out myself. Consider a two-parameter

Re: [Haskell-cafe] Pattern matching with where free variables can be used more than once

2009-07-17 Thread Wolfgang Jeltsch
Am Freitag, 17. Juli 2009 20:38 schrieb Stefan Holdermans: Christopher, Wouldn't it be great if pattern variables could be used more than once in a pattern? Like so: foo [x,x,_,x] = The values are the same! foo _ = They're not the same! These are called nonlinear

Re: [Haskell-cafe] What is the point of the 'What the bleep' names in haskell?

2009-07-17 Thread Wolfgang Jeltsch
Am Freitag, 17. Juli 2009 21:06 schrieb Daryoush Mehrtash: Why do Haskell programmers (and libraries) name their function like @ or ###?Why not use a more descriptive label for functions? It’s for the same reason that mathematicians say 2 + 3 instead of plus(2,3): it’s more readable at

[Haskell-cafe] uncommon IMO problem - toilet management

2009-07-17 Thread Henning Thielemann
In the last two days I was invigilator at the International Mathematic Olympics 2009 in Bremen, Germany. There we got a problem different from the official math problems. :-) Eventually I solved it using Haskell. Read the detailed description at

Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: first Grapefruit release

2009-07-17 Thread Wolfgang Jeltsch
Am Montag, 16. Februar 2009 15:27 schrieben Sie: On Mon, 16 Feb 2009, Wolfgang Jeltsch wrote: [redirecting to haskell-cafe] Am Sonntag, 15. Februar 2009 00:25 schrieben Sie: Hi Wolfgang, I was wondering if I can use FLTK as GUI backend for Grapefruit? This should be possible in

Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: first Grapefruit release

2009-07-17 Thread Wolfgang Jeltsch
Hello Jeff, it’s been some time that we had the conversation below and I have to tell you the same thing I told Jamie in a haskell-cafe mail sent a few minutes ago: The student who wrote the Qt binding generator never managed to send me a final version of his code. At least, I was able to make

[Haskell-cafe] Re: [Haskell] ANN: data-ordlist-0.0.1 and NumberSieves-0.0

2009-07-17 Thread Henning Thielemann
Leon Smith schrieb: Two new packages have been uploaded to Hackage, one that implements bag (multiset) and set operations on ordered lists, and another that offers three different number theoretic sieves. http://hackage.haskell.org/package/data-ordlist Data.OrdList offers many of the

Re: [Haskell-cafe] ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

2009-07-17 Thread Henning Thielemann
Wolfgang Jeltsch schrieb: 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

Re: [Haskell-cafe] Debugging methods for haskell

2009-07-17 Thread Henning Thielemann
On Thu, 16 Jul 2009, Fernan Bolando wrote: Hi all I recently used 2 hours of work looking for a bug that was causing Program error: Prelude.!!: index too large A good way to avoid such problems is to avoid partial functions at all. (!!) is also inefficient. Is it possible to define the

[Haskell-cafe] can there be (hash-table using) O(n) version of this (I think currently) n log n algo?

2009-07-17 Thread Thomas Hartman
The code below is, I think, n log n, a few seconds on a million + element list. I wonder if it's possible to get this down to O(N) by using a hashtable implemementation, or other better data structure. Further, is there a hashtable implementation for haskell that doesn't live in IO? Maybe in ST

Re: [Haskell-cafe] Plot data reconstruction reading pixel colors from image files

2009-07-17 Thread Henning Thielemann
Felipe Lessa schrieb: On Fri, Jul 17, 2009 at 06:31:20PM +0200, Cetin Sert wrote: How can I open and read colors of specific pixels of an image file in Haskell? Which packages, functions do you recommend? You could try DevIL, SDL-image or Gtk, I guess. Perhaps

[Haskell-cafe] is closing a class this easy?

2009-07-17 Thread Conor McBride
Friends Is closing a class this easy? -- module Moo ( Public(..) ) where class Private x = Public x where blah :: ... class Private x where instance Private A where instance Public A where blah = ... instance Private B where instance Public B

[Haskell-cafe] FFI to double constants, printf

2009-07-17 Thread Maurí­cio
When we printf doubles from C (like when using hsc2hs to bind to a constant) we can get something that's not valid Haskell. See these 2 examples: 3.40282347e+38F inf Do you know some way to printf a double using printf (or any other standard function) that's always going to give me valid

[Haskell-cafe] generalize RecordPuns and RecordWildCards to work with qualified names?

2009-07-17 Thread Evan Laforge
Record punning is not all that useful with qualified module names. If I write '(M.Record { M.rec_x })' it says Qualified variable in pattern and if I write '(M.Record { rec_x })' it says 'Not in scope: `rec_x''. Could it be this extension be further extended slightly so that 'f (M.Record {

Re: [Haskell-cafe] FFI to double constants, printf

2009-07-17 Thread John Van Enk
You probably want something like printf(%.10Lg,d);. Here's a shot C example and its output: #include stdio.h int main(int argc, char * argv[]) { long double d = 0.123456789; printf(%.30Lf\n, d); printf(%.20Lg\n, d); printf(%.20Le\n, d); } /* 0.1234567887336054491370

Re: [Haskell-cafe] is closing a class this easy?

2009-07-17 Thread Edward Kmett
I've used a similar approach for a while, for instance in http://comonad.com/haskell/type-int/src/Data/Type/Boolean.hs http://comonad.com/haskell/type-int/src/Data/Type/Boolean.hs But I think your approach is cleaner than mine, because it doesn't need my seemingly superfluous closure term or

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-17 Thread Edward Kmett
There is a Zip class in category-extras 's Control.Functor.Zip on hackage that covers this use-case. http://hackage.haskell.org/packages/archive/category-extras/latest/doc/html/Control-Functor-Zip.html It can basically be viewed as the ap of an Applicative functor chosen to be the left inverse

[Haskell-cafe] lifting restrictions on defining instances

2009-07-17 Thread John Lask
Can anyone explain the theoretical reason for this limitation, ie other than it is a syntactical restriction, what would it take to lift this restriction ? - Original Message - From: Stefan Holdermans ste...@cs.uu.nl To: Petr Pudlak d...@pudlak.name Cc: haskell-cafe@haskell.org

Re: [Haskell-cafe] can there be (hash-table using) O(n) version of this (I think currently) n log n algo?

2009-07-17 Thread Edward Kmett
Haskell hash tables are a notorious performance pig, mostly due to the fact that when we deal with big arrays, if the mutable array changes at all the garbage collector will have to retraverse the entire thing during the next collection. Guess the most common scenario for imperative hash tables

[Haskell-cafe] Re: FFI to double constants, printf

2009-07-17 Thread Maurí­cio
That helps, but: #include stdio.h #include math.h int main () { long double d = HUGE_VAL; printf(%.30Lf\n, d); } still prints just (as it should, I think): inf Is there maybe some way to check if a double or long double do have a proper value? You probably want something like

Re: [Haskell-cafe] Why is there no Zippable class? Would this work?

2009-07-17 Thread porges
2009/7/18 Edward Kmett ekm...@gmail.com: I wrote a short blog post on this: http://comonad.com/reader/2008/zipping-and-unzipping-functors/ and one on the less powerful dual operations (less powerful because while every Haskell Functor is strong, much fewer are costrong):

Re: [Haskell-cafe] Re: FFI to double constants, printf

2009-07-17 Thread Brandon S. Allbery KF8NH
On Jul 17, 2009, at 22:27 , Maurí cio wrote: Is there maybe some way to check if a double or long double do have a proper value? isNaN :: a - Bool True if the argument is an IEEE not-a-number (NaN) value isInfinite :: a - Bool True if the argument is an IEEE infinity or negative infinity

Re: [Haskell-cafe] lifting restrictions on defining instances

2009-07-17 Thread porges
[Ack, missed the reply-all button...] This was part of my motivation behind the 'removing polymorphism from Functor' thing... to select a different parameter we'd essentially need type-level lambdas... I'll use 'Λ' (capital lambda) for it: instance Functor (Λ a. X a b) where fmap f (X a

Re: [Haskell-cafe] ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

2009-07-17 Thread Richard O'Keefe
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

Re: [Haskell-cafe] ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

2009-07-17 Thread Richard O'Keefe
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

Re: [Haskell-cafe] Pattern matching with where free variables can be used more than once

2009-07-17 Thread Richard O'Keefe
On Jul 18, 2009, at 6:35 AM, Christopher Done wrote: [non-linear patterns] This kind of matching is provided in Prolog and Erlang. Neither of them lets the user define equality. We find the same issue with n+k patterns (e.g., n+1 as a pattern) l++r patterns