Functors with an instance of the Traversable type class can be thought of as data structures which permit a traversal of their elements. This has been made precise by the correspondence between traversable functors and finitary containers (also known as polynomial functors) -- established in the context of total, necessarily terminating, functions. However, the Haskell language is non-strict and permits functions that do not terminate. It has long been observed that traversals can at times in fact operate over infinite lists, for example in distributing the Reader applicative. The result of such a traversal remains an infinite structure, however it nonetheless is productive -- i.e. successive amounts of finite computation yield either termination or successive results. To investigate this phenomenon, we draw on tools from guarded recursion, making use of equational reasoning directly in Haskell.
翻译:具有可转移类型类实例的富集剂可被视作允许其元素穿行的数据结构。 精确地说,这是在总功能(必然终止的功能)范围内建立的可穿行的随身带菌和有鳍容器(又称多球菌菌)之间的对应关系。 但是, 哈斯凯尔语是非限制性的,允许功能不会终止。 人们早已发现, 穿行物有时可以运行于无限的列表之上, 比如在分发阅读器的辅助性时。 这种穿行器的结果仍然是无穷无穷的结构, 但不管它如何有效 -- -- 也就是说, 连续量的有限计算可以产生终止或连续的结果。 为了调查这一现象,我们从有节制的循环中吸取工具,在哈斯凯尔语中直接使用等式推理法。