Re: [Haskell-cafe] Re: An idea - Feasibility and effort

2008-01-23 Thread Ketil Malde
Achim Schneider [EMAIL PROTECTED] writes: Just out of curiosity: how do you plan to find out server locations (beyond the obvious top-level domain - country heuristics)? $ whois ip | grep Country Some also have location in the TXT field in DNS (Sometimes called an ICBM record). I think

Re: [Haskell-cafe] Has character changed in GHC 6.8?

2008-01-23 Thread Ketil Malde
Peter Verswyvelen [EMAIL PROTECTED] writes: No I just used wrong terminology. When I said unicode, I actually meant UCS-x, You might as well say UCS-4, nobody uses UCS-2 anymore. It's been replaced by UTF-16, which gives you the complexity of UTF-8 without being compact (for 99% of existing

Re: [Haskell-cafe] Has character changed in GHC 6.8?

2008-01-23 Thread Ketil Malde
Johan Tibell [EMAIL PROTECTED] writes: The benefit would be that if the input is not in latin-1 an exception could be thrown rather than returning a Char representing the wrong Unicode code point. I'm not sure what you mean here. All 256 possible values have a meaning. OTOH, going the other

Re: [Haskell-cafe] hxt memory useage

2008-01-25 Thread Ketil Malde
Matthew Pocock [EMAIL PROTECTED] writes: I've been using hxt to process xml files. Now that my files are getting a bit bigger (30m) I'm finding that hxt uses inordinate amounts of memory. : Is this a known issue? Yes. I parse what I suppose are rather large XML files (the largest so far

Re: [Haskell-cafe] hxt memory useage

2008-01-26 Thread Ketil Malde
Don Stewart [EMAIL PROTECTED] writes: So this is a request for an xml-light based on lazy bytestrings, designed for speed at all costs? Yes, I suppose it is. (For certain values of all costs.) For industrial use, I think it is important to have better performance, ideally approaching disk

Re: [Haskell-cafe] Doubting Haskell

2008-03-04 Thread Ketil Malde
Paul Johnson [EMAIL PROTECTED] writes: I'm surprised you found the significant whitespace difficult. I wonder if this has something to do with the editor one uses? I use Emacs, and just keep hitting TAB, cycling through possible alignments, until things align sensibly. I haven't really

[Haskell-cafe] Job opening: Use Haskell to save the environment!

2008-03-05 Thread Ketil Malde
(i.e., approximately €4)/year. Contact Ketil Malde ([EMAIL PROTECTED], +47 55238647) for further details. ¹) The target of the project is the sea louse, which is a large ecological and economical problem. -- If I haven't seen further, it is by standing in the footprints of giants

[Haskell-cafe] SimpleArgs

2008-03-06 Thread Ketil Malde
Hi, Often when I write small scripts, I find I just want a couple of command line arguments but don't want to go the whole GetOpt route. SimpleArgs is an attempt to make the raw getArgs somewhat less raw, and quick and dirty scripts a bit less dirty without sacrificing the quickness. Since I

Re: [Haskell-cafe] Analysing Haskell with Graph Theory

2008-03-07 Thread Ketil Malde
Ivan Miljenovic [EMAIL PROTECTED] writes: Can anyone think of any other kind of functions that would be useful in this kind of source code analysis? Sometimes, it's not obvious where to draw boundaries between modules, perhaps finding a smallest cut (if that is the correct term) could help to

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-10 Thread Ketil Malde
Adrian Hey [EMAIL PROTECTED] writes: But seriously, once you admit the possibility that even if x == y it still matters which of x or y is used in expressions than all hell breaks loose. I shudder to think just how much Haskell code there must be out there that is (at best) ambiguious or just

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-11 Thread Ketil Malde
Krzysztof Skrzętnicki [EMAIL PROTECTED] writes: The above results are for 100 Ints x 10 runs, but I don't expect any drastic changes in longer run. I leave the interpretation up to you. Might I suggest (also) testing with numbers of smaller magnitude? Lots of collisions is another killer

Re: [Haskell-cafe] Re: Constructing Data.Map from ByteString

2008-03-12 Thread Ketil Malde
Dave Tapley [EMAIL PROTECTED] writes: I've upgraded to bytestring-0.9.0.5 from Darcs, no improvement. Also this morning I tried using Data.HashMap with Bytestring's readInt and HashMap's hashInt.. The result was a Stack space overflow :( That's not so good. It works as required, loading

Re: [Haskell-cafe] Re: (flawed?) benchmark : sort

2008-03-12 Thread Ketil Malde
Adrian Hey [EMAIL PROTECTED] writes: So really I think the docs have this backwards. It's sortBy that implements a stable sort (assuming a suitably sane comparison function I guess) and apparently sort is whatever you get from (sortBy compare). But this is unduly restrictive on possible

Re: [Haskell-cafe] Re: Constructing Data.Map from ByteString

2008-03-12 Thread Ketil Malde
Duncan Coutts [EMAIL PROTECTED] writes: To get something really compact we could use an index composed of three unboxed Int arrays. To get something *really* compact, we could build a (kind of) suffix array. That is, we do a lexical sort of the lines, and store the sorted offsets of the

Re: [Haskell-cafe] floating point operations and representation

2008-03-13 Thread Ketil Malde
Jacob Schwartz [EMAIL PROTECTED] writes: A test on IEEE computers (x86 and x86-64), shows that for a range of 64-bit double values, the answers in C do differ (in the last bit) if you use log2(x) and log10(x) versus log (x) / log(2) and log(x) / log(10). I think this may also depend on C

Re: [Haskell-cafe] Re: Some clarity please!

2008-03-13 Thread Ketil Malde
Aaron Denney [EMAIL PROTECTED] writes: Well, the way the report specifies that max's default definition is. I'd actually favor making that not an instance function at all, and instead have max and min be external functions. If you permit a naïve question: Prelude :i Ord class (Eq a) = Ord a

Re: [Haskell-cafe] separate input calculation output

2008-03-25 Thread Ketil Malde
Thomas Engel [EMAIL PROTECTED] writes: My problem is: How can I get the input values into the calculations and back the result to the output. In an other language I would use global variables for this. That would be bad style. An other point is that I want to separate the input from the

Re: [Haskell-cafe] [Newbie] Problem with Data.Map (or something else ?)

2008-03-31 Thread Ketil Malde
Bruno Carnazzi [EMAIL PROTECTED] writes: The program ends for values up to 40 : Wild guess here - I know nothing about the problem, and haven't examined your program in detail - but could it be that you default to Int, and that it wraps silently at some power of two, thereby making your

Re: [Haskell-cafe] function type def

2008-04-01 Thread Ketil Malde
PR Stanley [EMAIL PROTECTED] writes: It's one of those things - I know sort of instinctively why it is so but can't think of the formal rationale for it: f g x = g (g x) :: (t - t) - (t - t) (t - t) - (t - t) So g :: t - t x :: t Thus f :: (t - t) - t - t (The last parenthesis is

Re: [Haskell-cafe] Re: Shouldn't this loop indefinitely = take (last [0..]) [0..]

2008-04-04 Thread Ketil Malde
Neil Mitchell [EMAIL PROTECTED] writes: length, take, drop and index working on machine-sized Ints by default are really a bit of a wart, aren't they? Yes. Also, having strict Int's by default is a bit ugly, [..] (Not that it isn't a worthwhile trade off, but it is still loosing

Re: [Haskell-cafe] Quick check?

2008-04-08 Thread Ketil Malde
Galchin, Vasili [EMAIL PROTECTED] writes: What are some examples of libraries in HackageDB that use either Quick Check (pure side) or Monad testing? Is there a way to use darcs to answer my question? I used the ByteString library as a guideline when developing testing (and to a lesser

Re: [Haskell-cafe] ghc

2008-04-10 Thread Ketil Malde
Cetin Sert [EMAIL PROTECTED] writes: Is GHC required to be installed on the target OS I compile Haskell binaries for in order for these binaries to run? I need a quick answer on that! Quick answer: No. GHC produces normal, standalone binaries. You may have problems with dynamic libraries,

Re: [Haskell-cafe] library version problem

2008-04-11 Thread Ketil Malde
Galchin, Vasili [EMAIL PROTECTED] writes: ghci :m System.Posix I am getting the wrong version of the Unix package. I know this to be true because I did ghc-pkg latest unix and got unix-2.3.0.0 I want unix.2.2.0.0 because this version has changes that I made Naturally, you'll get

Re: [Haskell-cafe] library version problem

2008-04-11 Thread Ketil Malde
Ketil Malde [EMAIL PROTECTED] writes: Either rename your modified version to 2.4 (or similar), specify the exact version in your *application's* cabal file, ..or you could compile your application specifying the package explicitly, using -package unix-2.2.0.0 (and all the other packages

Re: [Haskell-cafe] retrospective on 'seq' - 'unsafeSeq' ?

2008-04-15 Thread Ketil Malde
Bernie Pope [EMAIL PROTECTED] writes: Of course, [unsafeShow] won't be able to print functions in any helpful way, unless we attach source code information to functions as well (which may be worth doing anyway?). It might not be able to print the function's definition, but perhaps its type?

[Haskell-cafe] compressed pointers?

2008-04-16 Thread Ketil Malde
One of the downsides of a 64-bit environment is the increased size of pointers. This means that the cost of a String increases from something like 12 bytes per char to something like 24. I notice BEA uses something called compressed pointers to get the 64-bit (more registers, etc) benefits

Re: [Haskell-cafe] compressed pointers?

2008-04-18 Thread Ketil Malde
Don Stewart [EMAIL PROTECTED] writes: One small upside (performance wise), is that the bottom 3 bits of the pointer are now used to encode the constructor on 64 bits, so 'case' gets a good percent cheaper. Well - my experience (which is from before this optimization was added, I think) is

Re: [Haskell-cafe] lookup tables style guidelines

2008-04-24 Thread Ketil Malde
Don Stewart [EMAIL PROTECTED] writes: 1) what is the most performant lookup table/hashtable/dictionary solution for Haskell? Data.IntMap is awfully good. Is it benchmarked anywhere? Compared to the Judy bindings, or Adrian Hey's AVL trees, or Data.Hashtable? I rewrote (roughly) a

Re: [Haskell-cafe] how can this code be less?

2008-04-25 Thread Ketil Malde
cetin tozkoparan [EMAIL PROTECTED] writes: sublist :: Eq a = [a] - [a] - Bool sublist [] _ = True sublist (_:_) [] = False This can be simplified a bit, I think (Reformatted to one line): sublist (x:xs) (y:ys) | x == y = if isEqual (x:xs) (y:ys) == False then sublist (x:xs) ys else

Re: [Haskell-cafe] announce: Glome.hs-0.3 (Haskell raytracer)

2008-04-26 Thread Ketil Malde
david48 [EMAIL PROTECTED] writes: Personally, I don't see the point in rendering a couple of million mathematically flat surfaces, What about speed ? If it doesn't have to be correct, it can be arbitrarily fast :-) -k -- If I haven't seen further, it is by standing in the footprints of

Re: [Haskell-cafe] runInteractiveProcess and hGetLine on Windows

2008-05-07 Thread Ketil Malde
Richard A. O'Keefe [EMAIL PROTECTED] writes: According to the ASCII standard, it was fully legitimate to use backspace and carriage return to get over-striking (which is why ASCII includes oddities such as ^ and ` : they really are for accents, and , did double duty as cedilla, ' as acute

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-11 Thread Ketil Malde
PR Stanley [EMAIL PROTECTED] writes: What is the underlying rationale for the Maybe data type? It is the equivalent of a database field that can be NULL. is it the safe style of programming it encourages/ Yes. Consider C, where this is typically done with a NULL pointer, or Lisp,

Re: [Haskell-cafe] Endianess

2008-05-13 Thread Ketil Malde
Aaron Denney [EMAIL PROTECTED] writes: I used to be a big-endian advocate, on the principle that it doesn't really matter, and it was standard network byte order. Now I'm convinced that little endian is the way to go I guess it depends a lot on what you grew up with. The names (little/big

Re: [Haskell-cafe] Parsec3 performance issues (in relation to v2)

2008-05-13 Thread Ketil Malde
Neil Mitchell [EMAIL PROTECTED] writes: I think it is known that Parsec 3 is slower than Parsec 2, as a result of the increased generality. I know that in the past someone was working on it, but I am not sure if they ever got anywhere. I got pretty good performance (IMHO - about 10MB/s, still

Re: [Haskell-cafe] Endianess

2008-05-13 Thread Ketil Malde
Jed Brown [EMAIL PROTECTED] writes: This, of course, is because `od -x' regards the input as 16-bit integers. We can get saner output if we regard it is 8-bit integers. Yes, of course. The point was that for big-endian, the word size won't matter. Little-endian words will be reversed with

Re: [Haskell-cafe] How to use arrays efficiently?

2008-05-16 Thread Ketil Malde
Lauri Oksanen [EMAIL PROTECTED] writes: Thanks for help. I did some tests with UArray and it does the trick. The problem remaining is, how to implement UArray Int (Double, Double, Double)? As (UArray Int Double, UArray Int Double, UArray Int Double). Or as UArray Int Double, but with a

Re: [Haskell-cafe] Re: Write Haskell as fast as C.

2008-05-16 Thread Ketil Malde
Andrew Coppin [EMAIL PROTECTED] writes: I'm more worried about what happens in less trivial examples. [Let's face it, who wants to compute the sum of the numbers from 1 to N?] Inspired by Don's blog post, and coincidentally working on a program where profiling points to one particular, short

Re: [Haskell-cafe] Re: Write Haskell as fast as C.

2008-05-16 Thread Ketil Malde
Dan Weston [EMAIL PROTECTED] writes: mkAnn :: ByteString - Annotation mkAnn = pick . B.words where pick (_db:up:rest) = pick' up $ getGo rest pick' up' (go:_:ev:_) = Ann (B.copy up') (read $ B.unpack go) (read $ B.unpack ev) getGo = dropWhile (not . B.isPrefixOf

Re: [Haskell-cafe] Re: Write Haskell as fast as C.

2008-05-17 Thread Ketil Malde
Don Stewart [EMAIL PROTECTED] writes: mkAnn :: ByteString - Annotation mkAnn = pick . B.words where pick (_db:up:rest) = pick' up $ getGo rest pick' up' (go:_:ev:_) = Ann (B.copy up') (read $ B.unpack go) (read $ B.unpack ev) getGo = dropWhile (not . B.isPrefixOf

Re: [Haskell-cafe] Re: Write Haskell as fast as C.

2008-05-18 Thread Ketil Malde
Ketil Malde [EMAIL PROTECTED] writes: data EvidenceCode = IAC | IUG | IFR | NAC | NR | ... deriving Show Could it be that this derived read instance is somehow very inefficient? To answer my own question: this is exactly it, ghc derives less than optimal code in this case. Rather than

Re: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Ketil Malde
Peter Verswyvelen [EMAIL PROTECTED] writes: Is it possible to design hardware that is better suitable for functional languages? As I recall, Lisp machines went out of business when Lisp ran faster on industry standard, 68000-based Suns and Apollos, than on their custom hardware with tags and

Re: [Haskell-cafe] Re: Parsec3 performance issues (in relation to v2)

2008-05-18 Thread Ketil Malde
Antoine Latter [EMAIL PROTECTED] writes: When I specify the parsec-2.1.0.0 on the command-line, the Main.prof doesn't include any parsec CAFs. You need to add -auto-all to the build of Parsec as well. -k -- If I haven't seen further, it is by standing in the footprints of giants

Re: [Haskell-cafe] ByteString comparison question

2008-05-18 Thread Ketil Malde
Philip Müller [EMAIL PROTECTED] writes: import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as C8 Note that these use the same underlying data structure, but Char8 interprets the contents as Char instead of Word8. So the B.heads and B.break should be CS8 - for

Re: [Haskell-cafe] [tagsoup] is it the expected behaviour ?

2008-05-19 Thread Ketil Malde
Fernand [EMAIL PROTECTED] writes: Experimenting with tagsoup (I'm using GHC 6.8.2 and tagsoup-0.6), I found something which appears to me as strange behaviour : when parsing tag's attributes that have spaces enclosing the = sign, tagsoup seems to interpret these as empty attributes' names

Re: [Haskell-cafe] Re: ByteString.pack behavior

2008-05-19 Thread Ketil Malde
Achim Schneider [EMAIL PROTECTED] writes: Nevertheless, a question comes to me - shouldn't compiler report a warning? While doing that is easy in this case, it becomes quite delicate in the general case. More precisely, it grows into the halting problem. I think it would be nice with a

Re: [Haskell-cafe] Rotating backdrop (aka learning Haskell)

2008-05-20 Thread Ketil Malde
Yann Golanski [EMAIL PROTECTED] writes: 1- Get a list out of a file: I managed to do that using the following: parseImageFile :: FilePath - IO [String] parseImageFile file = do inpStr - readFile file return $ filter (/=) (breaks (=='\n') inpStr) Nice, simple and I

Re: [Haskell-cafe] relational data representation in memory using haskell?

2008-05-22 Thread Ketil Malde
Salvatore Insalaco [EMAIL PROTECTED] writes: This doesn't look like a relational structure at all in Haskell. I believe you are abusing terminology here. 'Relation' refers to a table (since it represents a subset of AxBxC.., i.e. a relation), not to references between tables. Mutability and

[Haskell-cafe] Network.CGI and error handling

2008-05-22 Thread Ketil Malde
Hi, I'm trying to implement a CGI, but I have encountered some problems with handling program errors properly. I think it boils down to this: The first program from the documentation at http://hackage.haskell.org/packages/archive/cgi/3001.1.5.2/doc/html/Network-CGI.html import Network.CGI

[Haskell-cafe] Re: Network.CGI and error handling

2008-05-22 Thread Ketil Malde
Since Björn Bringert suggested (on IRC) the problem could be due to laziness, and that I should force the result string before giving it to output, I've been playing around a bit. (The program is somewhat more involved than the short test I provided earlier, but available on request). Without

[Haskell-cafe] Re: Network.CGI and error handling

2008-05-22 Thread Ketil Malde
Ketil Malde [EMAIL PROTECTED] writes: Since Björn Bringert suggested (on IRC) the problem could be due to laziness [..] Does anybody else have it working? I found that other person, and he is us. I played around some more, and thought -- just to not leave any stone unturned -- that I should

Re: [Haskell-cafe] Type Coercion

2008-05-28 Thread Ketil Malde
PR Stanley [EMAIL PROTECTED] writes: (16 :: Float) is a perfectly legitimate statement although I'm surprised that it's allowed in a type strong language such as Haskell. It's a bit like casting in good old C. What's going on here? The literal 16 is really shorthand for fromIntegral

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Ketil Malde
Bulat Ziganshin [EMAIL PROTECTED] writes: well, i don't understand difference between your idea and lazybs implementation HT said earlier that: This would still allow the nice tricks for recursive Fibonacci sequence definition. Which I guess refers to something like: fibs = 1 : 1 :

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Ketil Malde
Ketil Malde [EMAIL PROTECTED] writes: You've lost me at least. ...but perhaps I can find my way back on my own? Today, you can choose between Array, with lazy elements, or UArray, with strict elements. Lazy arrays have the elements defined in advance, strict ones have them calculated

Re: [Haskell-cafe] Benchmarking Framework

2008-05-28 Thread Ketil Malde
Tom Harper [EMAIL PROTECTED] writes: I am in the process of writing a library for my MSc dissertation and would like to do some benchmarking. In doing so I need to compare the time and space of my library with some other code. Is there a framework for doing so in Haskell, aside from the

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Ketil Malde
Henning Thielemann [EMAIL PROTECTED] writes: We could simulate a list with strict elements, i.e. data StrictList a = Elem !a (StrictList a) | End by an unboxed array with a cursor to the next element to be evaluated and a function that generates the next element. [...] looks like

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Ketil Malde
Don Stewart [EMAIL PROTECTED] writes: http://code.haskell.org/~dons/uvector http://code.haskell.org/~dons/code/uvector (I presume? The other URL gives a 404) -k -- If I haven't seen further, it is by standing in the footprints of giants ___

Re: [Haskell-cafe] Copying Arrays

2008-05-30 Thread Ketil Malde
Duncan Coutts [EMAIL PROTECTED] writes: Because I'm writing the Unicode-friendly ByteString =p He's designing a proper Unicode type along the lines of ByteString. So - storing 22.5 bit code points instead of 8-bit quantities? Or storing whatever representation from the input, and providing a

Re: [Haskell-cafe] Copying Arrays

2008-05-30 Thread Ketil Malde
Johan Tibell [EMAIL PROTECTED] writes: I guess this is where I don't follow: why would you need more short strings for Unicode text than for ASCII or 8-bit latin text? But ByteStrings are neither ASCII nor 8-bit Latin text! [...] The intent of the not-yet-existing Unicode string is to

Re: [Haskell-cafe] Copying Arrays

2008-05-30 Thread Ketil Malde
Johan Tibell [EMAIL PROTECTED] writes: Lazy I/O comes with a penalty in terms of correctness! Is there a page describing this in more detail? I believe my programs to be correct, but would like to know if there are additional pitfalls, beyond hClosing a handle with outstanding (unevaluated)

Re: [Haskell-cafe] [ANN] bloomfilter 1.0 - Fast immutable and mutable Bloom filters

2008-06-03 Thread Ketil Malde
Thomas Hartman [EMAIL PROTECTED] writes: What kind of speed do you get on your laptop for Data.Set? How much faster is the bloom filter? I tried to modify examples/Words.hs to use Data.Set insted. The results look like this (first Bloom, second Data.Set, both compiled with -O2):

Re: [Haskell-cafe] More on performance

2008-06-04 Thread Ketil Malde
Henning Thielemann [EMAIL PROTECTED] writes: Now the difficult question: How to write the 'mean' function in terms of 'sum' and 'length' while getting the same performance? Write a RULE pragma converting \xs - (foldl' f y0 xs,foldl' g z0 xs) into \xs - foldl' (\(y,z) x - (f y x,g z x))

Re: [Haskell-cafe] Re: Ubuntu and ghc

2008-06-04 Thread Ketil Malde
Achim Schneider [EMAIL PROTECTED] writes: Caveat: I have only a vague grasp on what exactly is being criticized here - using a modern Linux distribution, tons of packages are available, and almost all issues Claus point out seem to be taken care of - at least as far as I can see. Well, then

Re: [Haskell-cafe] Re: Laziness leaks

2008-06-05 Thread Ketil Malde
Albert Y. C. Lai [EMAIL PROTECTED] writes: I haven't heard the terms laziness leak and strictness leak before Leak refers to a surprise. I the meaning of leak is in a bit of flux. Originally, I believe it refers to a memory leak, where the programmer forgot to call free() before losing the

Re: cabal and platform-independent haskell installation management (again) (Re: [Haskell-cafe] Re: Ubuntu and ghc)

2008-06-05 Thread Ketil Malde
Claus Reinke [EMAIL PROTECTED] writes: 1. there are no systems where packages just work! there are systems where a few people ensure that many people can live in such an illusion, though. Exactly. Integrating Cabal packages into the system package manager is still non-trivial, and a

Re: [Haskell-cafe] getting set up in ubuntu

2008-06-05 Thread Ketil Malde
Martin DeMello [EMAIL PROTECTED] writes: Any Ubuntu people care to share their experiences? Ask, and ye shall receive..at least some kind of answer. I'm especially looking for guidelines on what to install via apt-get and what to install independently. I'd get as much as possible via

Re: [Haskell-cafe] getting set up in ubuntu

2008-06-05 Thread Ketil Malde
Martin DeMello [EMAIL PROTECTED] writes: Thanks! Did you have any conflicts between manual and apt-got stuff? Not yet, but I haven't really hammered my system with packages yet. Is there any equivalent to gentoo's package.provided (which basically says 'I have installed this manually; please

Re: [Haskell-cafe] Design your modules for qualified import

2008-06-09 Thread Ketil Malde
[EMAIL PROTECTED] writes: null filter map lookup On the contrary, these are terrible names _because_ they conflict with the Prelude. I agree. One solution would be to stuff these into Data.List. It's okay if you highly encourage or effectively mandate qualified import, like

Re: [Haskell-cafe] OT: Paper on increasing entropy in software systems

2008-06-15 Thread Ketil Malde
Magnus Therning [EMAIL PROTECTED] writes: I was just listening to Brooks' talk at OOPSLA 2007 and in the QA part at the end he mentions a paper on increasing entropy in software systems. He mentions the authors' names but I can't quite make it out and Google hasn't been very helpful either.

Re: [Haskell-cafe] How to do this in FP way?

2008-06-16 Thread Ketil Malde
Magicloud Magiclouds [EMAIL PROTECTED] writes: static int old; int diff (int now) { /* this would be called once a second */ int ret = now - old; old = now; return ret; } Because there is no variable in Haskell. So how to do this in a FP way? I would claim the FP way is like

Re: [Haskell-cafe] Fast sorting with Bytestring

2008-06-18 Thread Ketil Malde
Stefan O'Rear [EMAIL PROTECTED] writes: Ok, strane ... Well, let's test with some 'normal' text: time ./sort bible /dev/null # ~ 0.4 s time sort bible /dev/null # ~ 0.56 s Ok, not that different. But with Haskell you often expect to get very slow code compared to an

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Ketil Malde
jinjing [EMAIL PROTECTED] writes: Any way here's the code: module Dot where import Prelude hiding ( (.) ) (.) :: a - (a - b) - b a . f = f a infixl 9 . Isn't this (roughly?) the same as flip ($)? As a side note, may I advise you to use another symbol, and leave the poor dot alone?

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Ketil Malde
Albert Y. C. Lai [EMAIL PROTECTED] writes: While we are kind of on this topic, what makes the characters ħ þ prefix operator by default, while º and most other odd ones infix? alphanumeric vs non-alphanumeric Testing this, I find that isAlpha is True also for 'º', but as the OP claims,

Re: [Haskell-cafe] A Monad for on-demand file generation?

2008-07-01 Thread Ketil Malde
Joachim Breitner [EMAIL PROTECTED] writes: 1) unsafeInterleaveIO seems like a big hammer to use for this problem, and there are a lot of gotchas involved that you may not have fully thought out. But you do meet the main criteria (file being read is assumed to be constant for a single run of

Re: [Haskell-cafe] Is there a nicer way to do this?

2008-07-07 Thread Ketil Malde
Don Stewart [EMAIL PROTECTED] writes: splitAt n xs = (take n xs, drop n xs) Thanks. That is odd, though. It makes me wonder what to expect re optimization. Would the compiler/runtime know that splitAt could be done in a single pass? Not with that definition. It would require some

Reading A Monad Tutorial (Re: [Haskell-cafe] Ode from a Haskeller to a Schemer)

2008-07-07 Thread Ketil Malde
(With apologies to Queen.) Is this the RealWorld#? Is this I/O I see? Caught in a monad - No escape back to purity Open a file, it wipes out my smile to see I'm just a programmer, don't need a Ph.D I'm easy come, easy go Don't need this high brow weird monadic action, no real reaction for me,

Re: [Haskell-cafe] memoization

2008-07-13 Thread Ketil Malde
Logesh Pillay [EMAIL PROTECTED] writes: Why? Its as if memoization is being ignored in the haskell version. How to fix? Shouldn't the definition of p' call (the memoized) p somewhere? In other words, I can't see any memoization, you seem to just map a normal, expensive, recursive function p'

Re: [Haskell-cafe] better way to do this?

2009-10-07 Thread Ketil Malde
Peter Verswyvelen bugf...@gmail.com writes: So yes, without using IO, Haskell forces you into this safe spot One could argue that IO should be broken down into a set of sub-monads encapsulating various subsets of the functionality - file system, network access, randomness, and so on. This

Re: [Haskell-cafe] HDBC PostgreSQL

2009-10-10 Thread Ketil Malde
Patrick Brannan brannans...@gmail.com writes: Prelude :module Database.HDBC Database.HDBC.PostgreSQL module `Database.HDBC.PostgreSQL' is not loaded I wonder if I haven't seen this when I'm in the package's top directory, that is, the current directory contains Database/HDBC/PostgreSQL.hs

Re: [Haskell-cafe] Can type be changed along a = chain?

2009-10-12 Thread Ketil Malde
minh thu not...@gmail.com writes: ghci :t (=) (=) :: (Monad m) = m a - (a - m b) - m b This says that, you provide an a and you get a b. Nothing says the a and b have to be the same upon successive uses. (But note that the monad 'm' has to be the same all the way. You can't switch from,

Re: [Haskell-cafe] is proof by testing possible?

2009-10-12 Thread Ketil Malde
Neil Brown nc...@kent.ac.uk writes: swap :: (a,b) - (b,a) We don't need to test it at all, it can only do one thing, swap its arguments. (Assuming it terminates.) swap = undefined Terminates and does not swap its arguments :-) I think this counts as non-termination, and that for semantic

Re: [Haskell-cafe] How to use bracket properly ?

2009-10-19 Thread Ketil Malde
zaxis z_a...@163.com writes: winSSQ count noRed noBlue = do let yesRed = [1..33] \\ noRed let yesBlue = [1..16] \\ noBlue bracket (openFile ssqNum.txt WriteMode) (hClose) (\hd1 - pickSSQ count yesRed yesBlue hd1) It works very well. However, as i am used to C style so i want

Re: [Haskell-cafe] How to use bracket properly ?

2009-10-19 Thread Ketil Malde
Ketil Malde ke...@malde.org writes: Didn't you just ... Oh, dear. Sorry about that. -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

Re: [Haskell-cafe] How can i safely change the value of specified key ?

2009-10-22 Thread Ketil Malde
zaxis z_a...@163.com writes: value - readIORef aaa writeIORef aaa (f value) then aaa will *point to* a new value. Exactly. That's what IORefs are, references pointing to contents that can be changed in the IO monad. The original value will be Garbage Collected, right ? Yes, unless

Re: [Haskell-cafe] Time and space complexity of take k . sort

2009-10-22 Thread Ketil Malde
Paul Johnson p...@cogito.org.uk writes: takeLargest k = take k . sort But of equal practical interest is the space complexity. The optimum algorithm is to take the first k items, sort them, and then iterate through the remaining items by adding each item to the sorted list and then

Re: [Haskell-cafe] A 3 line program -- Reid, Don, Daniel

2009-10-25 Thread Ketil Malde
Philippos Apolinarius phi50...@yahoo.ca writes: Thank you for your help. I am sure that you are right as to the cause of the problem.  However, I do not know what I should do to solve it. The Haskell program is generated by LaTeX macros.  It is useless to import System.IO.UTF8. I did it. Are

Re: [Haskell-cafe] A 3 line program -- Reid, Don, Daniel

2009-10-27 Thread Ketil Malde
Colin Paul Adams co...@colina.demon.co.uk writes: Brandon So yes, it's reasonable to blame the language (spec). On the other hand, the sooner users can get moving to utf-8, the sooner we can get eliminate these kinds of problems. Note also that it mentions the Unicode character set, not a

Re: [Haskell-cafe] What's the deal with Clean?

2009-11-04 Thread Ketil Malde
Duncan Coutts duncan.cou...@googlemail.com writes: The boxed [array types] can be used with any element type (eg an array of records) while unboxed ones work with simple primitive types like ints, floats etc. The difference is about memory layout and therefore performance ...and of

Re: [Haskell-cafe] What's the deal with Clean?

2009-11-04 Thread Ketil Malde
Bulat Ziganshin bulat.zigans...@gmail.com writes: http://shootout.alioth.debian.org/u64q/benchmark.php?test=alllang=ghclang2=cleanbox=1 http://shootout.alioth.debian.org/u64q/benchmark.php?test=alllang=ghclang2=ocamlbox=1 The Haskell compiler isn't the bottleneck. Use it when performance

Re: [Haskell-cafe] What's the deal with Clean?

2009-11-04 Thread Ketil Malde
Bulat Ziganshin bulat.zigans...@gmail.com writes: Well, it clearly demonstrates that it is possible to write fast code in Haskell. my measures says that by psending 3x more time than for C you can optimize haskell code to be only 3x slower than C one Right¹, the interesting thing is not how

Re: [Haskell-cafe] What's the deal with Clean?

2009-11-05 Thread Ketil Malde
Duncan Coutts duncan.cou...@googlemail.com writes: The build operation part often ends up a bit gross, but I have a plan for that which I hope to come back to later on. Yes, they're not good for construction atm. The Builder monoid from the I've used that a bit, but that's not what I'm

Re: [Haskell-cafe] Re: What's the deal with Clean?

2009-11-08 Thread Ketil Malde
L Spice jadenb1...@yahoo.com writes: Doaitse Swierstra wrote: One of this differences between Haskell and Clean I did not see mentioned in this discussion is that Clean does not allow so-called partial parametrisation. I.e. all function calls have to be fully saturated I don't understand

Re: [Haskell-cafe] Is () a 0-length tuple?

2009-11-08 Thread Ketil Malde
Eugene Kirpichov ekirpic...@gmail.com writes: In JavaScript there is a null value, that is the only value of the null type. Isn't () the same thing?  The only value of the unary type? No, () has two values: () and undefined (t.i., _|_). I'd argue that yes, they're the same thing, since any

Re: [Haskell-cafe] Small Japi binding for GHC

2009-11-08 Thread Ketil Malde
Philippos Apolinarius phi50...@yahoo.ca writes: So, I searched for JAPI bindings for Haskell. The only library I found was something called Small Japi binding for GHC.  The package  is incomplete, and  bug ridden. I don't know anything about this particular library, but this happens. Now

Re: [Haskell-cafe] Re: Fwd: Is () a 0-length tuple?

2009-11-08 Thread Ketil Malde
Jon Fairbairn jon.fairba...@cl.cam.ac.uk writes: The empty type in Haskell would be (forall a.a) which has no non-bottom values. With an extension, you can also define: data Void -- without any constructors which is perhaps closer to null types in other languages? -k -- If I haven't

Re: [Haskell-cafe] Small Japi binding for GHC

2009-11-08 Thread Ketil Malde
Philippos Apolinarius phi50...@yahoo.ca writes: Could you tell me what should I do to make my version and examples available? 1) Make sure it builds with cabal. 2) Upload it to Hackage And optionally, 3) make the darcs repository available on the web The process is nicely described here:

Re: [Haskell-cafe] bit of help with n-ary please...

2009-11-08 Thread Ketil Malde
spot135 aca08...@shef.ac.uk writes: So this is what ive got so far. data Tree a = Empty | Leaf a | Branch a [Tree a] [Homework mode on, i.e. hints and careful nudges to help you work it out on your own] The definition above gives two ways to build a Tree with only one data element. Can you

Re: [Haskell-cafe] bit of help with n-ary please...

2009-11-09 Thread Ketil Malde
Ketil Malde ke...@malde.org writes: data Tree a = Empty | Branch a [Tree a] What would the consequences be if you replaced your definition with this one? And, for extra credit, can you identify similar issues with this definition? Can you improve on it? -k -- If I haven't seen

Re: [Haskell-cafe] Static Linking Problem

2009-11-10 Thread Ketil Malde
MightyByte mightyb...@gmail.com writes: After a bit of googling, I came to the conclusion that I needed to compile it with ghc --make -static -optl-static Foo.hs. Using only -static or -optl-static by themselves did not generate a statically linked binary. But when I compile with both those

Re: [Haskell-cafe] faster compiling for ghc

2009-11-12 Thread Ketil Malde
Jason Dagit da...@codersbase.com writes: Running GHC in parallel with --make would be nice, but I find on Windows that the link time is the bottleneck for most projects. Yes, when GHC calls GNU ld, it can be very costly. In my experience, I'll add mine: On my Ubuntu systems, linking is

Re: [Haskell-cafe] Some thoughts about Hackage

2009-11-15 Thread Ketil Malde
I completely agree that some way of measuring the potential usefulness of packages would be great. To some extent, you can get a measure of the popularity of various packages in Debian (and probably other Linux distributions have similar systems). E.g.

<    1   2   3   4   5   6   7   8   9   10   >