[Haskell-cafe] Two-iteration optimisation (was: GHC Predictability)

Andrew Coppin andrewcoppin at btinternet.com
Fri May 16 14:42:33 EDT 2008


Luke Palmer wrote:
> On Thu, May 15, 2008 at 8:45 PM, Andrew Coppin
> <andrewcoppin at btinternet.com> wrote:
>   
>> Yitzchak Gale wrote:
>>     
>>> And of course, you wouldn't want that:
>>>
>>> f xs = xs : map expensiveCalculation xs
>>>
>>> Please don't fuse those two loops into one.
>>>
>>>       
>> ...doesn't type check. Did you mean (++)?
>>     
>
> Hmm?  While the name might be misleading...
>
> expensiveCalculation = (:[])
>   

Ah. So f :: [x] -> [[x]]. Devious...



More information about the Haskell-Cafe mailing list