On 8/24/10 1:55 PM, Jan-Willem Maessen wrote:
On Wed, Aug 18, 2010 at 9:56 PM, wren ng thornton wrote:
The thing I find puzzling is that the foldr is inlined. The (regular) clever
optimizations for build/foldr seem like they should already handle this
without the need for the extra rules. I won
On Wed, Aug 18, 2010 at 9:56 PM, wren ng thornton wrote:
> Oleg Lobachev wrote:
>>>
>>> #ifdef USE_REPORT_PRELUDE
>>> and = foldr (&&) True
>>> or = foldr (||) False
>>> #else
>>> and [] = True
>>> and (x:xs) = x && and xs
>>> or []
Oleg Lobachev wrote:
#ifdef USE_REPORT_PRELUDE
and = foldr (&&) True
or = foldr (||) False
#else
and [] = True
and (x:xs) = x && and xs
or [] = False
or (x:xs) = x || or xs
{-# RULES
"and/build" forall (g::forall b
On 18 August 2010 13:29, Oleg Lobachev
wrote:
> By the way, does some good reading on streams in Haskell exist? I am
> interested primarily in a theoretical foundation, which should however be
> somehow related to Haskell. My guess would be the relation of streams,
> represented as lazy, not c
Hello,
On Aug 18, 2010, at 13:44 , Duncan Coutts wrote:
> This is just an issue of specification vs implementation. The spec
> from the H98 report is
>
> and = foldr (&&) True
[snip]
> Note that 'equal' includes all partial and total lists, so you can
> rely on the above spec to reason about the
On 18 August 2010 10:05, Oleg Lobachev
wrote:
> Hello all,
>
> the and function, and :: [Bool] -> Bool is defined in two different ways in
> the latest Prelude.
>
> I would expect it to be
>
>> and = foldr (&&) True
>
> However, there is a further recursive definition, and it is the one used!
Th
Oleg Lobachev writes:
>> #else
>> and [] = True
>> and (x:xs) = x && and xs
>> or [] = False
>> or (x:xs) = x || or xs
>>
>> {-# RULES
>>
>> "and/build" forall (g::forall b.(Bool->b->b)->b->b) .
>>
>> and (build g) = g (&&) True
>>
>> "or/
Hello all,
the and function, and :: [Bool] -> Bool is defined in two different ways in the
latest Prelude.
I would expect it to be
> and = foldr (&&) True
However, there is a further recursive definition, and it is the one used! See
http://haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0