Subject line says it all, just about: in hugs/winhugs98 (haskell98 mode), challenge the interpreter with the following 8 characters (not including blanks): Prelude> :s -u Prelude> (<) 2 and the result is not pretty...nor very useful. It has to be interrupted manually. :t (<) 2 is fine, as is \x -> (<) 2 x; the problem does not occur without the -u flag because there is no show function for (<) 2. Of course, you can define one eg. using a datatype, but that doesn't cause a problem either. Also, (< 2) is perfectly fine, but (2 <) has the same problem. the argument 2 is not special; any expression (<) e (with e an instance of Ord) seems to do it. Same problem if you wrap (<) e up in a datatype. Am I right or? And is there a prize for the shortest bug ? Matt Matt Fairtlough Department of Computer Science, University of Sheffield 0114 222 1826
| Subject line says it all, just about: | | in hugs/winhugs98 (haskell98 mode), challenge the interpreter with the | following 8 characters (not including blanks): | | Prelude> :s -u | Prelude> (<) 2 | | and the result is not pretty...nor very useful. It has to be interrupted | manually. | ... | Am I right or? And is there a prize for the shortest bug ? This isn't a bug. When you use -u, you're asking Hugs to show you its internal structures as best as it can, without trying to make use of any show functions. In this case, your partial application involves a dictionary for Ord (i.e., a collection of functions that implement the operations of the Ord class), and that structure is infinite (in fact it's cyclic, a consequence of the reliance on default definitions for members of Ord that aren't spelled out explicitly). And of course it takes rather a lot of time and characters to print out an infinite structure ... My advice, if you don't want to look under the hood, don't use :set -u All the best, Mark
participants (2)
-
Mark P Jones -
Matt Fairtlough