Specifications of 'any', 'all', 'findIndices'

Bjorn Lisper lisper@it.kth.se
Tue, 23 Jan 2001 12:43:28 +0100 (MET)


Koen:
>The definitions in the Haskell report are a *specification*,
>not an implementation. It probably depends on the compiler
>which particular implementation runs faster.

>Therefore, the Haskell report provides a clear (yes, this is
>debatable) *possible* implementation, and the compiler
>writer is free to implement this in whatever way (s)he
>likes. As long as the implementation has the same functional
>behavior as the specification in the report.

Hear, hear. What I in turn would like to add is that specifications like 

any p = or . map p

are on a higher level of abstraction than definitions like

any p []     = False
any p (x:xs) = p x || any p xs

This makes it easier to find different implementations, which makes it
easier to adapt the implementation to fit different architectures. The first
specification is, for instance, directly data parallel which facilitates an
implementation on a parallel machine or in hardware.

Björn Lisper