[Haskell-cafe] [] \\ [1..] diverges - intended?

Niklas Hambüchen mail at nh2.me
Sat Jul 26 22:03:57 UTC 2014


On 26/07/14 22:55, Henk-Jan van Tuyl wrote:
> You can define (\\) as follows, terminating in case of the samples you
> gave:

Yes, that's what I mean. Why is it not defined like that?

> but this will not terminate in cases like:
>   [0] \\ [1..]

Yes, this of course not terminate because it has to search for a 0 in
the second list, which takes forever.

But my question was about the first case: Was it intended (or is it
specified) that (\\) cannot work on infinite lists?

Otherwise maybe your implementation should replace the current one?


More information about the Haskell-Cafe mailing list