Stream: show and tell

Topic: Miss Identifying Infinite Type...


view this post on Zulip GordonBGood (Jan 28 2024 at 08:07):

I have just filled another new issue where purely functional code with some reasonably complex nested recursions causes the compiler Type Inference to think it has found an infinitely recursive Type when it actually has correctly identified the function type.

My apologies for the length of the sample, but shorter algorithms don't seem to see the problem.

The algorithm tested here is a modification of the Richard Bird lazy incremental Sieve of Eratosthenes with the added optimization that the storage is infinitely tree folded to reduce access depth and get about O(n log n) performance. The lazy sequences are implemented as Co-Inductive Stream's (CIS's) since memoization is not required by the algorithm and, in fact, memoization via the Lazy module was removed from Elm, so for comparison purposes...


Last updated: Jul 06 2025 at 12:14 UTC