# Difference between revisions of "Questions and answers"

Feel free to ask your questions here. Please sign your question using four tildes (~~~~). Questions and answers will be organised as they are added, and linked from here. We don't have much here yet, but the Haskell Newbie page on the old wiki has quite a few questions and answers you can look through.

• Is this a good place to ask questions? MathematicalOrchid 15:30, 18 January 2007 (UTC)
• not yet at least. try the #haskell irc channel on freenode which is usually manned by at least a few very helpfull people. alternatively try the haskell-cafe mailing list --Johannes Ahlmann 12:29, 22 January 2007 (UTC)
• I tried the IRC channel. 300+ people and nobody speaking. Not very helpful. MathematicalOrchid 13:23, 22 January 2007 (UTC)

Hmm, that sounded like a 'no'... OK, I'm going to add a few 'real' questions, and see if that gets any more of a response... MathematicalOrchid 11:47, 22 January 2007 (UTC)

you know what, i really wanted to help, but this is getting ridiculous. when you're too lazy to look at the wiki/documentation and too impatient to find help on #haskell then there's just no help for you... --Johannes Ahlmann 13:30, 22 January 2007 (UTC)

And I thought Haskell was all about being lazy. (Ahem. Sorry about that...) Anyway, what makes you think I haven't read any documentation? (Actually, don't answer that. I didn't come here to start an argument.) MathematicalOrchid 15:52, 22 January 2007 (UTC)

• Which is faster? `putStr (xs ++ ys ++ xs)` or `putStr xs; putStr ys; putStr zs`? How much of a difference does it make? MathematicalOrchid 11:47, 22 January 2007 (UTC)
• hmm, `(++)` is a very slow operation which is O(n) in the length of the first string. for short strings the difference should be small, for very long string you'll see a big difference. concrete timing depends on putStr... --Johannes Ahlmann 12:29, 22 January 2007 (UTC)
• `(++)` is right-associative when there's several, resulting in the fastest possible performance. (I understand this is why the `Show` class is so damn weird...) Even so, I wonder if it's more efficient to join strings or use real I/O... MathematicalOrchid 13:23, 22 January 2007 (UTC)
• Haskell apparently allows you to write functions with bizarre names like '++' or '***'. What are the rules for this? Which characters can or can't you use? Are you required to give a fixity declaration first, or can you just use them? MathematicalOrchid 11:47, 22 January 2007 (UTC)
• please refer the Language_and_library_specification under "Identifiers and Operators". variable identifiers start with a lowercase letter, constructor Identifiers with an uppercase letter and both can contain underscores, single quotes, letters and digits; , operators are formed from one or more of `"!#\$%&*+./<=>?@\^|-~"` (plus a special case involving `(:)`). lacking fixity declarations, the default fixity is left associative and most tightly binding (9). --Johannes Ahlmann 12:29, 22 January 2007 (UTC)
• Right. So I can't name my function '~', but I can name it something that has '~' in it then. I also see from the spec document that apparently only data constructors can start with ':'. (I didn't know that... Well worth knowing!) MathematicalOrchid 15:52, 22 January 2007 (UTC)
• GHC can do all sorts of program optimisations. But, for a given program, how can you tell what it really did when it compiled? Did it inline that function? Was that operation optimised into an in-place update? Is there a way to tell? (Short of using a disassembler that is!) MathematicalOrchid 11:47, 22 January 2007 (UTC)
• Is there a way to make a Haskell program utilise multiple CPUs? (I rephrase: clearly this is very possible theoretically. What I mean is does any known compiler provide a way to do this?) MathematicalOrchid 11:47, 22 January 2007 (UTC)
• I want to write a program that renders bitmap graphics. Is there any way to get this onto the video screen in Haskell? Is there any way to get the data saved to disk in some sane file format? MathematicalOrchid 11:47, 22 January 2007 (UTC)
• have a look at Libraries_and_tools/GUI_libraries. i'd have a look at HGL, HOpenGL and/or gtk2hs. of these, at least gtk2hs has some image handling routines. for pure image format libraries there's unfortunately a little less :(
• This is where it starts to get messy... I already tried using HGL from within Hugs. (Drawing 'pixels' that are really small squares.) However, once it's drawn enough pixels, I get a Dr Watson error and Hugs ungracefully terminates. (Actually, the latest version of Hugs seems to do this a lot.) So I went to compile it with GHC - and it seems GHC doesn't come with that library at all. And the page you linked says that HGL is 'currently broken on Win32'. Hmm... OK, I'm confused now. Then there's HOpenGL. (Is that the same thing as Graphics.Rendering.OpenGL, or is it seperate?) It's nice to know you can have hardware 3D acceleration if you want it, but maybe a tad overkill for just writing a bitmap to the display. Also, IIRC, doesn't OpenGL require you to open a window in a platform-specific way first? And then there's gtk2hs. I don't know if you can run Gtk on Win32... but that one looks like it might be worth investigating. MathematicalOrchid 15:52, 22 January 2007 (UTC)