[Haskell-cafe] and from standard Prelude

Oleg Lobachev lobachev at Mathematik.Uni-Marburg.de
Wed Aug 18 08:29:06 EDT 2010


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
> Note that 'equal' includes all partial and total lists, so you can
> rely on the above spec to reason about the behaviour on infinite lists
> and expect that reasoning to work for correct H98 implementations.

ok, thank you.

It was precisely the reason for my question. I used the fold-based definition in my ramblings and then bothered to look into the Prelude code. ;)

> That said, there are a couple functions where the obviously sensible,
> and standard implementations differ from the H98 spec for some partial
> values. Notably splitAt is specified badly in the H98 report (it is
> too lazy).

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 completely evaluated lists, and the evaluation strategies. The practical part is easier, feeding [1..] to various functions in GHCi. I have found [Ennals2003optimistic], but it seems to go in wrong direction.

[Ennals2003optimistic]: Robert Ennals, Simon Peyton Jones. "Optimistic evaluation: an adaptive evaluation strategy for non-strict programs". ICFP 2003. http://portal.acm.org/citation.cfm?id=944705.944731


More information about the Haskell-Cafe mailing list