Questions and answers

From HaskellWiki
Revision as of 13:36, 22 January 2007 by JohannesAhlmann (talk | contribs) (imaging)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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)

  • 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)
      • Ouch. Reading the spec sounds like fun...
  • 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)
    • * yes, ghc 6.6 supports multiple CPUs. see GHC/Concurrency#Multiprocessor_GHC --Johannes Ahlmann 12:29, 22 January 2007 (UTC)
      • Right... Do I really need the nightly build to get this functionality? Or is that information outdated? That aside, I just need to compile my program with "-threaded" and run it with "+RTS -N2" or whatever? MathematicalOrchid 13:23, 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)