RE: [Haskell-cafe] Flattening tail recursion?

2004-12-13 Thread Simon Peyton-Jones
I have not been following the details, but yes, the strictness analyser only runs when you say -O, and without strictness analysis you can get different space behaviour. Sometimes more, sometimes less. In this case, strictness analysis helps. Simon | -Original Message- | From: [EMAIL

Re: [Haskell-cafe] AbstractDataType question

2004-12-13 Thread Ketil Malde
Tomasz Zielonka [EMAIL PROTECTED] writes: Record field labels can be also used in pattern matching and in record update. Especially the latter is very useful. But not quite as elegant -- while record query lets you modify the underlying structure and replace the old record queries with

Re: [Haskell-cafe] Flattening tail recursion?

2004-12-13 Thread Daniel Fischer
Hi everyone, I had the idea that, instead of using 'seq', one might check for parity: countLines2 aux (_:l) | even aux = ... | odd aux = ... that prevents stack overflow, but is much slower than countLines1 aux (_:l) | aux `seq` False = ... | otherwise = ... I

Re: [Haskell-cafe] FiniteMapFiniteMap

2004-12-13 Thread Duncan Coutts
On Mon, 2004-12-13 at 14:56 -0500, S. Alexander Jacobson wrote: Hmm cool. Binary does not appear in the GHC docs... Is it new? Ah, it's not a user library distributed with GHC, it's a library used internally in the implementation of GHC. If you want to use it you have to rip it out of the ghc

[Haskell-cafe] special term describing f :: (Monad m) = (a - m b) ?

2004-12-13 Thread Henning Sato von Rosen
What is a function of the followning type called: f :: (Monad m) = (a - m b) Is there a special term describing such a function (a function into a monad)? For f in a = f is en example. Need it for an article/report. Regards/Henning ___ Haskell-Cafe

Re: [Haskell-cafe] special term describing f :: (Monad m) = (a - m b) ?

2004-12-13 Thread Ralf Hinze
What is a function of the followning type called: f :: (Monad m) = (a - m b) Is there a special term describing such a function (a function into a monad)? It is often called a procedure or an effectful function (I assume that `a' and `b' are not meant to be universally quantified). I

[Haskell-cafe] Named function fields vs. type classes

2004-12-13 Thread John Goerzen
Hi, I often have a situation where I'm designing specialized components to do a more general task. Examples could include mail folder code (maildir, mbox, etc), configuration file parsing, protocol handlers for URL accesses, logging backends, etc. For some of these, I've used a data object

Re: [Haskell-cafe] Named function fields vs. type classes

2004-12-13 Thread Ralf Laemmel
Major apologies for this repeated plug for HList. Anyway, HLists [1] are *exactly* designed for this sort of problem. Well, one can also use existential quantification + bounded polymorphism; with the shapes benchmark providing a good example [2]. The trade-offs are explored a little bit on the

Re: [Haskell-cafe] The difference between ($) and application

2004-12-13 Thread Andrew Pimlott
On Tue, Dec 14, 2004 at 11:23:24AM +0100, Henning Thielemann wrote: On Tue, 14 Dec 2004, Andrew Pimlott wrote: (Of course, it's still useful, by itself or in a slice, as a higher-order operator.) You can also use 'id' in this cases, right? I'm thinking of things like zipWith ($)

Re: [Haskell-cafe] Named function fields vs. type classes

2004-12-13 Thread Keith Wansbrough
On the other hand, it's difficult or impossible to make a list of a bunch of different types of things that have nothing in common save being members of the class. I've recently been playing with making, for each class C, a interface datatype IC (appropriately universally and existentially

Re: [Haskell-cafe] AbstractDataType question

2004-12-13 Thread Tomasz Zielonka
On Mon, Dec 13, 2004 at 11:29:56AM +0100, Ketil Malde wrote: Tomasz Zielonka [EMAIL PROTECTED] writes: Record field labels can be also used in pattern matching and in record update. Especially the latter is very useful. But not quite as elegant -- while record query lets you modify the

Re: [Haskell-cafe] Flattening tail recursion?

2004-12-13 Thread Stefan Holdermans
Will, countLines [] = 0 countLines (_:ls) = 1 + countLines ls I would have thought that this was tail recursive and would be flattened into iteration by the compiler. Can anyone explain why? Is it because the call is embedded in an expression? This is the tail-recursive version: \begin{code}

Re: [Haskell-cafe] Flattening tail recursion?

2004-12-13 Thread John Meacham
On Mon, Dec 13, 2004 at 11:56:45AM +0100, Daniel Fischer wrote: I had the idea that, instead of using 'seq', one might check for parity: countLines2 aux (_:l) | even aux = ... | odd aux = ... that prevents stack overflow, but is much slower than countLines1 aux (_:l)

[Haskell-cafe] The difference between ($) and application

2004-12-13 Thread oleg
The operator ($) is often considered an application operator of a lower precedence. Modulo precedence, there seem to be no difference between ($) and `the white space', and so one can quickly get used to treat these operators as being semantically the same. However, they are not the same in all

Re: [Haskell-cafe] The difference between ($) and application

2004-12-13 Thread Andrew Pimlott
On Mon, Dec 13, 2004 at 07:49:00PM -0800, [EMAIL PROTECTED] wrote: The operator ($) is often considered an application operator of a lower precedence. Modulo precedence, there seem to be no difference between ($) and `the white space', and so one can quickly get used to treat these operators