mapM as a Space Leak (Was: [Haskell-cafe] about Haskell code written to be "too smart")

Thomas Hartman tphyahoo at gmail.com
Thu Mar 26 15:40:43 EDT 2009


Well, that's reassuring.

The reason I asked is that the testp function didn't just show poor
performance. The state monad implementation actually gave a different
answer -- nonterminating, where the pattern matching solution
terminated.

2009/3/26 Jonathan Cast <jonathanccast at fastmail.fm>:
> On Thu, 2009-03-26 at 12:29 -0700, Thomas Hartman wrote:
>> > I wonder if JHC
>> > or some other compiler might work better with these examples?
>>
>> Are you saying that different compilers might give different answers?
>>
>> Yikes!
>>
>> Too clever indeed!
>
> No, they might produce code with different performance characteristics.
>
> Which is very much what you want; there is no way to compile Haskell
> such that reasonable-looking code is
>
>  a) Fast and
>  b) Predictably performant.
>
> The idea of Haskell is to abstract away from the predictable performance
> of the code by a) using a good compiler, and b) putting absolute
> un-questioning faith in your profiler.
>
> jcc
>
>
>


More information about the Haskell-Cafe mailing list